Jump to content

Arthur Wesley

Members
  • Posts

    32
  • Joined

  • Last visited

Converted

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Arthur Wesley's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I'm trying to render a custom [chestplate] but it won't work properly. I made the code using Tabula mod, but what happens is that the rendered parts connected to the arms won't move, they just stay static. Anything I miss? Model class: import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.client.renderer.GlStateManager; public class ModelMSapphireArmor extends ModelBiped { public ModelRenderer Chestplate; public ModelRenderer ShoulderRight; public ModelRenderer MegaRight; public ModelRenderer MegaRight_1; public ModelRenderer MegaRight_2; public ModelMSapphireArmor() { this.textureWidth = 128; this.textureHeight = 128; this.MegaRight = new ModelRenderer(this, 110, 32); this.MegaRight.setRotationPoint(-3.0F, -2.0F, -2.0F); this.MegaRight.addBox(-9.0F, -4.8F, 0.9F, 2, 3, 2, 0.0F); this.MegaRight_1 = new ModelRenderer(this, 92, 32); this.MegaRight_1.setRotationPoint(-3.0F, -2.0F, -2.0F); this.MegaRight_1.addBox(-7.0F, -0.1F, 0.1F, 3, 3, 4, 0.0F); this.ShoulderRight = new ModelRenderer(this, 74, 42); this.ShoulderRight.setRotationPoint(-3.0F, -2.0F, -2.0F); this.ShoulderRight.addBox(-8.5F, 3.6F, -1.0F, 8, 10, 8, 0.0F); this.Chestplate = new ModelRenderer(this, 73, -4); this.Chestplate.setRotationPoint(-4.0F, 0.0F, -2.0F); this.Chestplate.addBox(-1.7F, 0.0F, -1.0F, 16, 22, 8, 0.0F); this.MegaRight_2 = new ModelRenderer(this, 76, 32); this.MegaRight_2.setRotationPoint(-3.0F, -2.0F, -2.0F); this.MegaRight_2.addBox(-8.5F, -2.5F, 0.5F, 3, 3, 3, 0.0F); this.bipedBody.addChild(Chestplate); this.bipedRightArm.addChild(ShoulderRight); this.bipedRightArm.addChild(MegaRight); this.bipedRightArm.addChild(MegaRight_1); this.bipedRightArm.addChild(MegaRight_2); } @Override public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { this.MegaRight.render(f5); this.MegaRight_1.render(f5); GlStateManager.pushMatrix(); GlStateManager.translate(this.ShoulderRight.offsetX, this.ShoulderRight.offsetY, this.ShoulderRight.offsetZ); GlStateManager.translate(this.ShoulderRight.rotationPointX * f5, this.ShoulderRight.rotationPointY * f5, this.ShoulderRight.rotationPointZ * f5); GlStateManager.scale(0.65D, 0.55D, 0.7D); GlStateManager.translate(-this.ShoulderRight.offsetX, -this.ShoulderRight.offsetY, -this.ShoulderRight.offsetZ); GlStateManager.translate(-this.ShoulderRight.rotationPointX * f5, -this.ShoulderRight.rotationPointY * f5, -this.ShoulderRight.rotationPointZ * f5); this.ShoulderRight.render(f5); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); GlStateManager.translate(this.Chestplate.offsetX, this.Chestplate.offsetY, this.Chestplate.offsetZ); GlStateManager.translate(this.Chestplate.rotationPointX * f5, this.Chestplate.rotationPointY * f5, this.Chestplate.rotationPointZ * f5); GlStateManager.scale(0.65D, 0.55D, 0.7D); GlStateManager.translate(-this.Chestplate.offsetX, -this.Chestplate.offsetY, -this.Chestplate.offsetZ); GlStateManager.translate(-this.Chestplate.rotationPointX * f5, -this.Chestplate.rotationPointY * f5, -this.Chestplate.rotationPointZ * f5); this.Chestplate.render(f5); GlStateManager.popMatrix(); this.MegaRight_2.render(f5); } public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } } Armor Render class: import net.minecraft.client.model.ModelBiped; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import tutuicraft3.sapphirecraft.Main; import tutuicraft3.sapphirecraft.init.ItemInit; import tutuicraft3.sapphirecraft.util.interfaces.IHasModel; public class ArmorModel extends ItemArmor implements IHasModel { public ArmorModel(String name, CreativeTabs tab, ArmorMaterial materialIn, EntityEquipmentSlot equipmentSlotIn) { super(materialIn, 1, equipmentSlotIn); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(tab); setMaxStackSize(1); ItemInit.ITEMS.add(this); } @Override public boolean hasEffect(ItemStack stack) { return true; } @Override public void registerModels() { Main.proxy.registerModel(this, 0); } @Override public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) { if(itemStack != ItemStack.EMPTY) { if(itemStack.getItem() instanceof ItemArmor) { ModelMSapphireArmor model = new ModelMSapphireArmor(); model.bipedHead.showModel = armorSlot == EntityEquipmentSlot.HEAD; model.isChild = _default.isChild; model.isRiding = _default.isRiding; model.isSneak = _default.isSneak; model.rightArmPose = _default.rightArmPose; model.leftArmPose = _default.leftArmPose; return model; } } return null; } } VIDEO
  2. Oops, I'm sorry, those github code were outdated, I just posted my actual one
  3. This is my container class: package tutuicraft3.sapphirecraft.blocks.msinfusortileentity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryBasic; import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ContainerMSInfusor extends Container { private final IInventory tileMSInfusor; private final IInventory outputSlot; private final IInventory inputSlots; private final World world; public ContainerMSInfusor(InventoryPlayer playerInv, final TileEntityMSInfusor infusor, IInventory mSInfusorInv, World world) { this.outputSlot = new InventoryCraftResult(); this.inputSlots = new InventoryBasic("Infuse", true, 2); this.world = world; this.tileMSInfusor = mSInfusorInv; addSlotToContainer(new Slot(inputSlots, 0, 27, 40)); addSlotToContainer(new Slot(inputSlots, 1, 76, 40)); addSlotToContainer(new Slot(outputSlot, 2, 134, 40) { public boolean isItemValid(ItemStack stack) { return false; } }); for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for (int k = 0; k < 9; k++) { addSlotToContainer(new Slot(playerInv, k, 8 + k * 18, 142)); } } public void onContainerClosed(EntityPlayer playerIn) { super.onContainerClosed(playerIn); if (!this.world.isRemote) { this.clearContainer(playerIn, this.world, this.inputSlots); } } @Override public boolean canInteractWith(EntityPlayer player) { return true; } @Override public ItemStack transferStackInSlot(EntityPlayer player, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = inventorySlots.get(index); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); int containerSlots = inventorySlots.size() - player.inventory.mainInventory.size(); if (index < containerSlots) { if (!this.mergeItemStack(itemstack1, containerSlots, inventorySlots.size(), true)) { return ItemStack.EMPTY; } } else if (!this.mergeItemStack(itemstack1, 0, containerSlots, false)) { return ItemStack.EMPTY; } if (itemstack1.getCount() == 0) { slot.putStack(ItemStack.EMPTY); } else { slot.onSlotChanged(); } if (itemstack1.getCount() == itemstack.getCount()) { return ItemStack.EMPTY; } slot.onTake(player, itemstack1); } return itemstack; } } Now I need a Recipes class, that can detect the input and output slots of my container class?, then detect the recipes items like I said before and then it outputs the result?
  4. And how should I add slots to my container class, like, which method to use? public class MSInfusorContainer extends Container { private final IInventory tileFurnace; private int cookTime; private int totalCookTime; private int furnaceBurnTime; private int currentItemBurnTime; public MSInfusorContainer(InventoryPlayer playerInventory, IInventory furnaceInventory) { this.tileFurnace = furnaceInventory; this.addSlotToContainer(new Slot(furnaceInventory, 0, 27, 40)); //<-- I'm talking about this, they are in the correct position in GUI, //but I should add what kind of slot, this furnace itself? this.addSlotToContainer(new SlotFurnaceFuel(furnaceInventory, 1, 76, 40)); this.addSlotToContainer(new SlotFurnaceOutput(playerInventory.player, furnaceInventory, 2, 134, 40)); //... } And to call each slot in my MSInfusorRecipes class, how could I do that?
  5. I really don't know how to make custom recipes for my TileEntity, so what I want is to make Mega Sapphire items by placeing a normal sapphire tool in the first slot and a mega sapphire in the second slot of my sapphire infusor: https://github.com/Arthgames3/1.12.2-SapphireCraft
  6. I've made it. Just had to add drawDefaultBackground(); to my GUI class on drawGuiContainerBackgroundLayer method: @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { drawDefaultBackground(); GlStateManager.color(1, 1, 1, 1); mc.getTextureManager().bindTexture(BG_TEXTURE); int x = (width - xSize) / 2; int y = (height - ySize) / 2; drawTexturedModalRect(x, y, 0, 0, xSize, ySize); }
  7. One little thing, I noticed that my GUI is different from the others in one aspect, it doesn't get it's outer part darker. Normal GUIs have its "focus", making everything around it draker, but mine just opens the GUI and don't get darker, strange because I followed correctly the tutorial, and in there his GUI was darker around.
  8. Yay, the slots are worknig. I only need now a recipe system. package tutuicraft3.sapphirecraft.blocks.msinfusortileentity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotCrafting; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; public class MSInfusorContainer extends Container { public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); public InventoryCraftResult craftResult = new InventoryCraftResult(); private final World world; public MSInfusorContainer(InventoryPlayer playerInv, World worldIn, final TileEntityMSInfusor infusor) { this.world = worldIn; IItemHandler inventory = infusor.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.NORTH); addSlotToContainer(new SlotCrafting(playerInv.player, this.craftMatrix, this.craftResult, 0, 134, 40)); addSlotToContainer(new Slot(this.craftMatrix, 0, 27, 40)); addSlotToContainer(new Slot(this.craftMatrix, 1, 76, 40) { @Override public void onSlotChanged() { infusor.markDirty(); } }); for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for (int k = 0; k < 9; k++) { addSlotToContainer(new Slot(playerInv, k, 8 + k * 18, 142)); } } @Override public void onContainerClosed(EntityPlayer playerIn) { super.onContainerClosed(playerIn); if (!this.world.isRemote) { this.clearContainer(playerIn, this.world, this.craftMatrix); } } @Override public boolean canInteractWith(EntityPlayer player) { return true; } @Override public ItemStack transferStackInSlot(EntityPlayer player, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = inventorySlots.get(index); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); int containerSlots = inventorySlots.size() - player.inventory.mainInventory.size(); if (index < containerSlots) { if (!this.mergeItemStack(itemstack1, containerSlots, inventorySlots.size(), true)) { return ItemStack.EMPTY; } } else if (!this.mergeItemStack(itemstack1, 0, containerSlots, false)) { return ItemStack.EMPTY; } if (itemstack1.getCount() == 0) { slot.putStack(ItemStack.EMPTY); } else { slot.onSlotChanged(); } if (itemstack1.getCount() == itemstack.getCount()) { return ItemStack.EMPTY; } slot.onTake(player, itemstack1); } return itemstack; } }
  9. And how can I implement some code that makes the items inside the Container to go back to the player's inventory, when the container is closed? I can't manage to find any clue in the vanilla classes.
  10. Thanks for now, I'll see if my noob skills will be able to do it.
  11. And how about the processing, recipes? Like I put two items in the first two slots and it creates a new one... Like the anvil
  12. So, I want to do my own Tile Entity that works exactly like the vanilla furnace/anvil, but with a diferent GUI and my own recipes. I was wondering if someone could help me, please. https://github.com/Arthgames3/1.12.2-SapphireCraft
  13. So, I'll create a new, fresh workspace and start everything from 0 following a more advanced tutorial. Thanks for all the help. "By the way, I'm 14 years old, I chose start programming Java with minecraft because I thought it was going to be interesting, because it's something I like. I choose to ask help for advanced modders because I thought I could learn more that way. Yes, I have done an algoritm course and I am actually making a Basic Java course, even if I know the real basicalready. I just think even if I learn advanced Java I couldn't just go and make a mod, I still should need to search, because it's minecraft forge, with it's own methods and callings ways. So yeah, call me noob, call me odd, call me wathever you want, I am just entering the programming world, and maybe I've done it in the wrong way..."
×
×
  • Create New...

Important Information

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