Skip to content

Conversation

@Lanse505
Copy link
Contributor

No description provided.

@Lanse505 Lanse505 requested a review from SkySom August 18, 2019 19:46
}

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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?


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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

this.optional = LazyOptional.of(() -> handler);
}
public class PosInvHandlerCapabilityProvider implements ICapabilityProvider, INBTSerializable<CompoundNBT> {
private PosInvHandler handler = new PosInvHandler("quiver", 62, 30, 9)
Copy link
Contributor

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.

public static ContainerType<QuiverContainer> TYPE;
private final PosInvHandler handler;
private PlayerInventory inventory;
private boolean hasPlayerInventory;
Copy link
Contributor

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)));
Copy link
Contributor

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.

Copy link
Contributor Author

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

Still missing final

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.

3 participants