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

allow quantum tanks to lock their fluids #278

Merged
merged 4 commits into from
Dec 12, 2021
Merged

allow quantum tanks to lock their fluids #278

merged 4 commits into from
Dec 12, 2021

Conversation

TechLord22
Copy link
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
Member

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

@serenibyss
Copy link
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
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
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
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
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
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
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
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
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
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
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
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.

None yet

3 participants