Jump to content

Nozzomi

Members
  • Posts

    31
  • Joined

  • Last visited

Nozzomi's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I'm trying to render a custom helmet and the helmet rotates fine horizontally but it seems that it rotates on the x/z as well when I look vertically. Here's a picture of what's happening: https://imgur.com/a/TOYUDqb Item class: public class MythusArmorVar2 extends ArmorItem { public MythusArmorVar2(IArmorMaterial mat, EquipmentSlotType slot) { super(mat, slot, new Properties().group(Mythus.MYTHUS_TAB)); } @Nullable @Override public <A extends BipedModel<?>> A getArmorModel(LivingEntity ent, ItemStack stack, EquipmentSlotType slot, A _default) { if(!stack.isEmpty()) { if(stack.getItem() instanceof ArmorItem) { KabutoHelmModel helm_model = new KabutoHelmModel(1); helm_model.bipedHead.showModel = slot == EquipmentSlotType.HEAD; helm_model.isChild = _default.isChild; helm_model.isSneak = _default.isSneak; helm_model.isSitting = _default.isSitting; helm_model.rightArmPose = _default.rightArmPose; helm_model.leftArmPose = _default.leftArmPose; return (A) helm_model; } } return null; } } Model Class: public class KabutoHelmModel extends BipedModel<LivingEntity> { private final ModelRenderer basehelm; public KabutoHelmModel(float scale) { super(scale,0, 64, 64); textureWidth = 64; textureHeight = 64; basehelm = new ModelRenderer(this); basehelm.setRotationPoint(0.0F, 24.0F, 0.0F); basehelm.setTextureOffset(34, 0).addBox(-4.0F, -32.0F, -5.0F, 8.0F, 4.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(26, 16).addBox(4.0F, -32.0F, -4.0F, 1.0F, 4.0F, 8.0F, 0.0F, false); basehelm.setTextureOffset(23, 0).addBox(5.0F, -28.0F, -4.0F, 1.0F, 2.0F, 9.0F, 0.0F, false); basehelm.setTextureOffset(5, 25).addBox(4.0F, -30.0F, -5.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(60, 0).addBox(2.0F, -28.0F, -5.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(36, 16).addBox(-3.0F, -28.0F, -5.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(52, 4).addBox(-1.0F, -28.0F, -5.0F, 2.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(36, 21).addBox(-2.0F, -26.0F, -5.0F, 4.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(48, 9).addBox(1.0F, -27.0F, -5.0F, 1.0F, 1.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(53, 0).addBox(-2.0F, -27.0F, -5.0F, 1.0F, 1.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(24, 19).addBox(-5.0F, -30.0F, -5.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(0, 21).addBox(5.0F, -30.0F, -5.0F, 2.0F, 4.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(12, 12).addBox(-7.0F, -30.0F, -5.0F, 2.0F, 4.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(0, 9).addBox(7.0F, -30.0F, -4.0F, 1.0F, 4.0F, 3.0F, 0.0F, false); basehelm.setTextureOffset(0, 0).addBox(-8.0F, -30.0F, -4.0F, 1.0F, 4.0F, 3.0F, 0.0F, false); basehelm.setTextureOffset(0, 21).addBox(-6.0F, -28.0F, -4.0F, 1.0F, 2.0F, 9.0F, 0.0F, false); basehelm.setTextureOffset(0, 9).addBox(-7.0F, -26.0F, -4.0F, 1.0F, 2.0F, 10.0F, 0.0F, false); basehelm.setTextureOffset(28, 16).addBox(-6.0F, -26.0F, 5.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(0, 26).addBox(5.0F, -26.0F, 5.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(28, 3).addBox(-5.0F, -28.0F, 4.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(28, 0).addBox(4.0F, -28.0F, 4.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(12, 12).addBox(6.0F, -26.0F, -4.0F, 1.0F, 2.0F, 10.0F, 0.0F, false); basehelm.setTextureOffset(12, 24).addBox(-5.0F, -32.0F, -4.0F, 1.0F, 4.0F, 8.0F, 0.0F, false); basehelm.setTextureOffset(30, 31).addBox(-4.0F, -32.0F, 4.0F, 8.0F, 4.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(22, 28).addBox(-5.0F, -28.0F, 5.0F, 10.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(24, 11).addBox(-6.0F, -26.0F, 6.0F, 12.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(24, 14).addBox(-3.0F, -29.0F, -6.0F, 6.0F, 1.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(34, 5).addBox(-3.0F, -31.0F, -6.0F, 6.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(24, 0).addBox(-4.0F, -33.0F, -6.0F, 1.0F, 3.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(18, 13).addBox(-5.0F, -35.0F, -6.0F, 1.0F, 3.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(17, 9).addBox(-6.0F, -37.0F, -6.0F, 1.0F, 3.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(22, 24).addBox(3.0F, -33.0F, -6.0F, 1.0F, 3.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(24, 16).addBox(2.0F, -33.0F, -6.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(12, 9).addBox(3.0F, -35.0F, -6.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(5, 9).addBox(4.0F, -37.0F, -6.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(24, 4).addBox(-3.0F, -33.0F, -6.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(4, 16).addBox(-4.0F, -35.0F, -6.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(0, 16).addBox(-5.0F, -37.0F, -6.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(15, 24).addBox(4.0F, -35.0F, -6.0F, 1.0F, 3.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(11, 24).addBox(5.0F, -37.0F, -6.0F, 1.0F, 3.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(0, 0).addBox(-4.0F, -33.0F, -4.0F, 8.0F, 1.0F, 8.0F, 0.0F, false); basehelm.setTextureOffset(0, 33).addBox(-1.0F, -34.0F, 0.0F, 2.0F, 1.0F, 2.0F, 0.0F, false); this.bipedHead.addChild(basehelm); } @Override public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ basehelm.setRotationPoint(0.0F, 24.0F, 0.0F); basehelm.render(matrixStack, buffer, packedLight, packedOverlay); } //TODO figure out why it isn't working @Override public void setRotationAngles(LivingEntity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { super.setRotationAngles(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); this.basehelm.copyModelAngles(this.bipedHead); } }
  2. Huh, I couldn't reproduce it either... I ended up fixing the problem in the original code by creating a new world since I figured that if it worked in the git clone, it must've had something to do with the run folder. In hindsight, I probably should've created a new world in the first place since I was attaching a capability to the player. Thank you for helping me through!
  3. Also, I changed the orElse into an orElseThrow and it hasn't given me any errors (though I'm not sure whether or not to be happy since the problem isn't any clearer...) public static final RegistryObject<ContainerType<CoreStorageContainer>> CORE_STORAGE_CONTAINER = CONTAINERS.register("core_storage_container", () -> new ContainerType<>((id, inv) -> new CoreStorageContainer(id, inv, inv.player.getCapability(CapabilityCoreStorage.CORE_STORAGE_CAPABILITY).orElseThrow(() -> new NullPointerException("Core Storage Capability not found!")))));
  4. Wait, but don't I? I have e.addCapability(CapabilityCoreStorage.LOCATION, new CapabilityCoreStorage()); where LOCATION is just the ResourceLocation needed to attach the capability, right?
  5. Video The sword is placed in according to the server but the breakpoint doesn't stop me when I click with the sword. The setStackInSlot part is because the item is already recognized as in there...? (It's definitely your word over mine, I'm a little lost)
  6. I think what I've found is that inserItem and setStackInSlot isn't called when I try to ghost insert my item in the custom inventory, but the item somehow still ends up in the slot it's not supposed to be in. I also tried sticking an extra isItemValid() check in the setStackInSlot method before the super, but it ended up not showing the items, but if I clicked on the slot, the item would still be there, just no longer showing.
  7. Is it possible for me to extend on the player's regular ItemStackHandler capability? Maybe if I add the container through an already existing capability, it'll go more smoothly. How would I extend upon that capability?
  8. That's super weird, I guess the only option now is to...reinstantiate (is that the correct term or even a word?!?!) the forge project and will see what happens Was there anything that might've royally screwed me over in terms of adding the inventory?
  9. No, they aren't for(int i = 0; i < cores.getSlots(); i++) { this.addSlot(new SlotItemHandler(cores, i, slotCoords.get(i).left, slotCoords.get(i).right)); } I didn't think that they'd affect the player inventory because they're using the indices for a different IItemHandler...it seems I might be wrong though...?
  10. for (int i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { Mythus.LOG.info(j + i * 9 + 9); this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 132 + i * 18)); } } for (int i = 0; i < 9; ++i) { Mythus.LOG.info(i); this.addSlot(new Slot(inventory, i, 8 + i * 18, 190)); } What would be wrong with this? No numbers are repeating in the logs I think
  11. Here's a video of me showing what I'm having problems with. First, I'm showing the clicking the item into the slot that's doesn't allow it, then opening and closing that inventory, where the item ends up in the slot. After that, I'm switching between the vanilla inventory and the custom inventory quickly and the items eventually start to pile up in my inventory.
  12. I tried using the capability, but the result is the same. The inventory is saving properly though, but so at least that's not a problem. This is what I have now instead public static final RegistryObject<ContainerType<CoreStorageContainer>> CORE_STORAGE_CONTAINER = CONTAINERS.register("core_storage_container", () -> new ContainerType<>((id, inv) -> new CoreStorageContainer(id, inv, inv.player.getCapability(CapabilityCoreStorage.CORE_STORAGE_CAPABILITY).orElse(new CoreStorageInstance()))));
  13. I open the gui in the container by using ClientTickEvent Then in the packet I just use the NetworkHooks#openGui And uhhh, I just register the container type using the DeferredRegister public static final RegistryObject<ContainerType<CoreStorageContainer>> CORE_STORAGE_CONTAINER = CONTAINERS.register("core_storage_container", () -> new ContainerType<CoreStorageContainer>((id, inv) -> new CoreStorageContainer(id, inv, new CoreStorageInstance())));
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.