-
Notifications
You must be signed in to change notification settings - Fork 2
Fixed the Quiver GUI #12
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
base: develop/1.14.x
Are you sure you want to change the base?
Conversation
src/main/java/com/teamacronymcoders/epos/capability/PosInvHandlerCapabilityProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/com/teamacronymcoders/epos/client/gui/QuiverGui.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| @Override | ||
| protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Titanium really not handle a lot of this stuff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, this is why the GUI was such a bitch.
Currently Titanium only has a TileEntity specific implementation.
I had to do this implementation to get it working on an item :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what I'm hearing is PR time?
src/main/java/com/teamacronymcoders/epos/client/gui/QuiverGui.java
Outdated
Show resolved
Hide resolved
|
|
||
| public QuiverContainer(int id, PlayerInventory playerInventory, PacketBuffer buffer) { | ||
| this(((QuiverItem) playerInventory.player.getHeldItemMainhand().getItem()).getHandler(playerInventory.player.getHeldItemMainhand()), playerInventory); | ||
| public QuiverContainer(int id, PlayerInventory player, PacketBuffer buffer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PlayerInventory should be named that, if it's not actually PlayerEntity. Also you really should read from the buffer what hand the Quiver is in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do I read hands from the buffer?
And how do I pass it in the actual thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass it in as an int index would be the best.
src/main/java/com/teamacronymcoders/epos/feature/EposModules.java
Outdated
Show resolved
Hide resolved
src/main/java/com/teamacronymcoders/epos/feature/quiver/QuiverItem.java
Outdated
Show resolved
Hide resolved
src/main/java/com/teamacronymcoders/epos/capability/PosInvHandlerCapabilityProvider.java
Outdated
Show resolved
Hide resolved
| this.optional = LazyOptional.of(() -> handler); | ||
| } | ||
| public class PosInvHandlerCapabilityProvider implements ICapabilityProvider, INBTSerializable<CompoundNBT> { | ||
| private PosInvHandler handler = new PosInvHandler("quiver", 62, 30, 9) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be final as well.
src/main/java/com/teamacronymcoders/epos/container/QuiverContainer.java
Outdated
Show resolved
Hide resolved
| public static ContainerType<QuiverContainer> TYPE; | ||
| private final PosInvHandler handler; | ||
| private PlayerInventory inventory; | ||
| private boolean hasPlayerInventory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what cases do you not have a player inventory?
| if (!world.isRemote) { | ||
| stack.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(capHandler -> NetworkHooks.openGui((ServerPlayerEntity) player, new GuiQuiverAddonScreen((PosInvHandler) capHandler))); | ||
| stack.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(handler -> | ||
| NetworkHooks.openGui((ServerPlayerEntity) player, new QuiverGui(new QuiverContainer((PosInvHandler) handler, player.inventory), player.inventory, null))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Casting without double checking Player.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which case would the ClientPlayerEntity ever be on !world.isRemote side?
| public class PosInvHandlerCapabilityProvider implements ICapabilityProvider { | ||
| private final LazyOptional<IItemHandler> optional; | ||
| public class PosInvHandlerCapabilityProvider implements ICapabilityProvider, INBTSerializable<CompoundNBT> { | ||
| private PosInvHandler handler; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still missing final
No description provided.