Grinder Block - #96
Conversation
| register(new BlockInfiniteProducer()); | ||
| register(new BlockPowerAnalyzer()); | ||
|
|
||
| initBlockGrinder(); |
There was a problem hiding this comment.
Why have a function called initBlockGrinder? it turns something that could be one line into 4 lines now. In the future I could see having an initMachines but there really isn't a reason to put the actual register itself in its own function.
There was a problem hiding this comment.
Reasoning was that I imagined there would be some extra stuff I would have to do to fully initialize the grinder, which will actually be the case when the object is made generic. Like:
private void initBlockGrinder() {
int numInputs = 1;
int numOutputs = 1;
String modelResourceLocation = "some/file/path/grinder.json";
String guiLocation = "some/file/path/gui.png";
String name = "blockGrinder";
register(new SimpleIOMachine(numInputs, numOutputs, modelResourceLocation, guiLocation, name));
}
There was a problem hiding this comment.
Alright that works for me then we can revisit this once you make it generic
| } | ||
|
|
||
| @Override | ||
| public void onBlockAdded(World parWorld, BlockPos parBlockPos, IBlockState parIBlockState) { |
There was a problem hiding this comment.
Nitpick up for discussion: Why 'par'? I assume it stands for 'parameter' but why not just do something like:
(World world, BlockPos position, IBlockState state) for example?
There was a problem hiding this comment.
So I didn't write the par part myself. That's how it is populated when you create the class and all the unimplemented methods for the interface are created by IntelliJ. I do agree it would look better w/o the par though. I'll make the change.
| } | ||
|
|
||
| @Override | ||
| public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, |
There was a problem hiding this comment.
Here you have an inconsistency now because you were doing World parWorld styled variable names and now they are the World worldstyle. I prefer the World world but we definitely have to be consistent.
There was a problem hiding this comment.
Refer to my prior blame of IntelliJ and Forge
| } | ||
|
|
||
| @Override | ||
| public boolean onBlockActivated(World parWorld, BlockPos parBlockPos, |
| private int ticksGrindingItemSoFar; | ||
| private int ticksPerItem; | ||
|
|
||
| public ContainerGrinder(InventoryPlayer parInventoryPlayer, IInventory parIInventory) { |
There was a problem hiding this comment.
parameter nit again
| } | ||
|
|
||
| @Override | ||
| public boolean canExtractItem(int parSlotIndex, ItemStack parStack, EnumFacing parFacing) { |
| return grinderItemStackArray[slotEnum.INPUT_SLOT.ordinal()] != null; | ||
| } | ||
|
|
||
| private int timeToGrindOneItem(ItemStack parItemStack) { |
| private final InventoryPlayer inventoryPlayer; | ||
| private final IInventory tileGrinder; | ||
|
|
||
| public GuiGrinder(InventoryPlayer parInventoryPlayer, IInventory parInventoryGrinder) { |
| } | ||
|
|
||
| @Override | ||
| protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { |
There was a problem hiding this comment.
Possibly make some of these values below private static final ints to make some values more clear
There was a problem hiding this comment.
Careful with using private static final too much. It weighs the class down with variables for no reason if the values aren't used in more than one location. But yea I could definitely use more named local variables.
| import net.minecraft.world.World; | ||
|
|
||
| import javax.annotation.Nullable; | ||
| public abstract class BlockContainerTileEntity<TE extends TileEntity> |
There was a problem hiding this comment.
insert space above class
The Grinder Block grinds items that are specified to have a grinding recipe. Still needs proper models for rendering.