Skip to content

allow quantum tanks to lock their fluids#278

Merged
bruberu merged 4 commits intomasterfrom
locking
Dec 12, 2021
Merged

allow quantum tanks to lock their fluids#278
bruberu merged 4 commits intomasterfrom
locking

Conversation

@TechLord22
Copy link
Copy Markdown
Member

No description provided.

@TechLord22 TechLord22 force-pushed the locking branch 3 times, most recently from 43a62e5 to f380783 Compare December 1, 2021 05:33
@serenibyss
Copy link
Copy Markdown
Member

Stealing this PR to improve it a bit and add more features :trollface:

@serenibyss
Copy link
Copy Markdown
Member

Changes since my commits:

  • Quantum Tank now works as a FluidHandlerItemStack, meaning it can be used to empty into inventories (like other Quantum Tanks, Fluid Hatches, etc), and can be used to click into GT machine fluid slots
  • Locking now forces the Fluid to be rendered in the Fluid Slot, even when empty (additionally keeps the name/amount in the UI)
  • You can now use JEI ghost ingredients to set the locked fluid
  • You can also use other FluidHandlerItemStacks to set the locked fluid
  • There are two new buttons related to voiding:
    • Void (All): Void all fluids of the tank
    • Void (Partial): Void fluids in the tank only when the tank is 95% full

@serenibyss serenibyss added status: high priority Issue or PR should be prioritized for reviews and removed low priority labels Dec 8, 2021
@serenibyss
Copy link
Copy Markdown
Member

Changing this to Release Priority as this PR now includes several breaking changes to the Tank's NBT

@Override
public void handleClientAction(int id, PacketBuffer buf) {
super.handleClientAction(id, buf);
if (id == 12) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should put this value in GregtechDataCodes.

} else {
phantomTank.setFluid(null);
}
} else if (id == 13) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should put this value in GregtechDataCodes.

@Override
public boolean mouseClicked(int mouseX, int mouseY, int button) {
if (isMouseOverElement(mouseX, mouseY)) {
writeClientAction(12, buf -> {});
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should put this value in GregtechDataCodes.

FluidStack stack = phantomTank.getFluid();
if (stack == null && lastPhantomStack != null) {
lastPhantomStack = null;
writeUpdateInfo(10, buf -> {});
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should put this value in GregtechDataCodes.

if (!stack.isFluidEqual(lastPhantomStack)) {
lastPhantomStack = stack.copy();
NBTTagCompound stackTag = stack.writeToNBT(new NBTTagCompound());
writeUpdateInfo(11, buf -> buf.writeCompoundTag(stackTag));
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should put this value in GregtechDataCodes.

writeUpdateInfo(11, buf -> buf.writeCompoundTag(stackTag));
} else if (stack.amount != 0) {
lastPhantomStack.amount = 0;
writeUpdateInfo(12, buf -> {});
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should put this value in GregtechDataCodes.

@Override
public void readUpdateInfo(int id, PacketBuffer buf) {
super.readUpdateInfo(id, buf);
if (id == 10) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should put this value in GregtechDataCodes.

super.readUpdateInfo(id, buf);
if (id == 10) {
lastPhantomStack = null;
} else if (id == 11) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should put this value in GregtechDataCodes.

return;
}
lastPhantomStack = FluidStack.loadFluidStackFromNBT(stackTag);
} else if (id == 12) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should put this value in GregtechDataCodes.

Copy link
Copy Markdown
Member

@bruberu bruberu left a comment

Choose a reason for hiding this comment

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

This also works properly on a server, although definitely put those codes in GregtechDataCodes.

@bruberu bruberu merged commit 7d5a1bd into master Dec 12, 2021
@bruberu bruberu deleted the locking branch December 12, 2021 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: high priority Issue or PR should be prioritized for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants