Skip to content

Creative Chests And Creative Tanks#334

Merged
bruberu merged 8 commits intomasterfrom
creativeItemsAndFluids
Dec 15, 2021
Merged

Creative Chests And Creative Tanks#334
bruberu merged 8 commits intomasterfrom
creativeItemsAndFluids

Conversation

@bruberu
Copy link
Copy Markdown
Member

@bruberu bruberu commented Dec 12, 2021

Simply adds creative chests and creative tanks to the game, which act much like creative emitters. They are configurable in which item/fluid is outputted, the quantities outputted each "cycle", and the length in ticks of said "cycle".

2021-12-12.11-01-40.mp4

@bruberu bruberu force-pushed the creativeItemsAndFluids branch from 1b5efa7 to 85fc43f Compare December 12, 2021 21:33
Copy link
Copy Markdown
Contributor

@ALongStringOfNumbers ALongStringOfNumbers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both the chest and the tank need to override getParticleTexture so that there are breaking particles. For an example of what to return, see MetaTileEntityBuffer.

Both the chest and the tank failed to serialize their NBT when broken, resulting in loss of settings such as the stored item/fluid, if they were active, etc

public void writeItemStackData(NBTTagCompound itemStack) {
super.writeItemStackData(itemStack);
ItemStack stack = this.handler.getStackInSlot(0);
if (stack != null && stack.getCount() > 0) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should check if the stack is not empty instead of the stack not being null. Because getStackInSlot pulls from a NonNull List


private int itemsPerCycle = 1;
private int ticksPerCycle = 1;
private final ItemStackHandler handler = new ItemStackHandler(1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about overriding getSlotLimit for this ItemStackHandler to return 1, just for a nicer display when adding something to the slot. Right now if you click in a stack of 4 of an item, the slot will display the stack of 4, which might be a bit confusing considering that the amount produced is set by the field entry and not the stacksize in the slot.

@bruberu bruberu merged commit fbe7082 into master Dec 15, 2021
@bruberu bruberu deleted the creativeItemsAndFluids branch December 15, 2021 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants