Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creative Chests And Creative Tanks #334

Merged
merged 8 commits into from
Dec 15, 2021
Merged

Creative Chests And Creative Tanks #334

merged 8 commits into from
Dec 15, 2021

Conversation

bruberu
Copy link
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
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
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
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