Jump to content

kpzip

Members
  • Posts

    23
  • Joined

  • Last visited

Everything posted by kpzip

  1. Turns out this was caused by some transparent places in the texture file, Thanks for your help!
  2. I am having a problem with a specific item that uses a JSON model when it is rendered in your inventory where some of the faces are missing: This is my model: And this is my block class:
  3. ok so I tried removing all cubes but one and the z-fighting still persists
  4. ok I will try later. Thanks for the help!
  5. I tried offsetting all of the strings 1 pixel up, but the Z-fighting persists. Im not sure if I understand what you are saying
  6. I have a JSON model that seems to produce a lot of Z-fighting (outlined in red in the image below) This is my JSON model : This is the block Class:
  7. I have since resolved this issue in my mod.
  8. I am having a problem where you cannot shift-click items into or out of a GUI This is my Container code: This is my Tile Entity Code:
  9. The model for my custom entity has some issues with z-fighting: (seen on the top of the claws) Here is me model file: Here is my render code:
  10. Thanks, By looking at the ItemBlockSpecial class, I was able to figure out what to do
  11. I assume I need to use the custom ItemBlock when registering the block, but what code do I put in the itemblock?
  12. I have created a custom slab in my mod and when I place one down on top of another slab, It doesn't form a double slab, but instead places a slab on top of the block. This is my Generic Slab code: package com.kpzip.SushiMod.blocks.shapes.slab; import java.util.Random; import net.minecraft.block.BlockSlab; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import com.kpzip.SushiMod.Main; import com.kpzip.SushiMod.init.ModBlocks; import com.kpzip.SushiMod.init.ModItems; import com.kpzip.SushiMod.util.IHasModel; public abstract class BambooSlab extends BlockSlab implements IHasModel{ public BambooSlab(String name) { super(Material.WOOD); this.setUnlocalizedName(name); this.setRegistryName(name); this.setSoundType(SoundType.WOOD); if (this instanceof BambooHalfSlab) { this.setCreativeTab(Main.SUSHI_BLOCKS); } setHardness(2); setResistance(15); setHarvestLevel("axe", 0); IBlockState state = this.blockState.getBaseState(); if (!this.isDouble()) { state = state.withProperty(HALF, EnumBlockHalf.BOTTOM); } this.setDefaultState(state); this.useNeighborBrightness = true; ModBlocks.BLOCKS.add(this); ModItems.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName())); } @Override public void registerModels() { Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "inventory"); } @Override public String getUnlocalizedName(int meta) { return this.getUnlocalizedName(); } @Override public IProperty<?> getVariantProperty() { return HALF; } @Override public Comparable<?> getTypeForItem(ItemStack stack) { return EnumBlockHalf.BOTTOM; } @Override public int damageDropped(IBlockState state) { return 0; } @Override public IBlockState getStateFromMeta(int meta) { if (!this.isDouble()) { return this.getDefaultState().withProperty(HALF, EnumBlockHalf.values()[meta % EnumBlockHalf.values().length]); } return this.getDefaultState(); } @Override public int getMetaFromState(IBlockState state) { if (!this.isDouble()) { return 0; } return ((EnumBlockHalf)state.getValue(HALF)).ordinal() + 1; } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(ModBlocks.BAMBOO_SLAB_HALF); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {HALF}); } } This is my Double Slab code: package com.kpzip.SushiMod.blocks.shapes.slab; public class BambooDoubleSlab extends BambooSlab { public BambooDoubleSlab(String name) { super(name); } @Override public boolean isDouble() { return true; } } And this is my half slab code: package com.kpzip.SushiMod.blocks.shapes.slab; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import com.kpzip.SushiMod.blocks.shapes.IHasCustomShape; import com.kpzip.SushiMod.init.ModBlocks; public class BambooHalfSlab extends BambooSlab implements IHasCustomShape { public BambooHalfSlab(String name) { super(name); } @Override public boolean isDouble() { return false; } @Override public IBlockState getStateFromMeta(int meta) { if (meta == 0) { return this.getDefaultState().withProperty(HALF, EnumBlockHalf.BOTTOM); } else { return this.getDefaultState().withProperty(HALF, EnumBlockHalf.TOP); } } @Override public int getMetaFromState(IBlockState state) { if (state.getValue(HALF) == EnumBlockHalf.BOTTOM) { return 0; } else { return 1; } } } Minecraft 1.12.2 7_20_2019 9_22_31 AM.mp4
  13. kpzip

    ~~

    I am experienced with modding for 1.12.2, if you would like a mod for that version, I would be happy to work on it!
  14. kpzip

    ~~

    What MC version do you want this mod for?
  15. I have fixed the problem. Thank you for your help!
  16. I have figured it out. All I need to know now is how to offset the texture.
  17. I'm confused. What lines of code should I move to the other method? I tried moving the bind texture line to the foreground layer method, but that changed nothing.
  18. I am having a problem with a custom chest that I have created where the GUI looks extremely weird. It doesn't display the assigned texture and instead displays some random characters on the right side of the GUI. Here is my GUI code: package com.kpzip.SushiMod.inventory.gui; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import com.kpzip.SushiMod.blocks.tileentity.TileEntityBambooChest; import com.kpzip.SushiMod.inventory.container.ContainerBambooChest; import com.kpzip.SushiMod.util.Reference; public class GuiBambooChest extends GuiContainer { public static final ResourceLocation GUI_CHEST = new ResourceLocation(Reference.MOD_ID + ":textures/gui/bamboo_chest_gui.png"); private final InventoryPlayer playerInventory; private final TileEntityBambooChest te; public GuiBambooChest(InventoryPlayer playerInventory, TileEntityBambooChest chestInventory, EntityPlayer player) { super(new ContainerBambooChest(playerInventory, chestInventory, player)); this.playerInventory=playerInventory; this.te=chestInventory; this.xSize=179; this.ySize=256; } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(GUI_CHEST); } @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { this.fontRenderer.drawString(this.te.getDisplayName().getUnformattedText(), 8, 6, 16086784); this.fontRenderer.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 92, 16086784); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); }
  19. I have two Items in my mod that I would like to be obtainable via fishing. I'm not sure on how to do this, whether I need an event or a loot table or what. Thanks in advance for any feedback.
  20. Thanks! I was confused because I didn't have to do that for my other event handler. It works now
  21. I have created a calamari Item in my mod and I would like it to drop when a squid dies. I have created an event handler class and I made a method with the SubscribeEvent annotation. I have also annotated the EventHandler class with EventBusSubscriber. The method does not trigger at all. I know this because I put some print statements to try and detect if this method was being called. It is not being called at all. This is my event handler code: package com.kpzip.SushiMod.util.handlers; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntitySquid; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; import com.kpzip.SushiMod.init.ModItems; import com.kpzip.SushiMod.init.ModPotions; @EventBusSubscriber public class EventHandler { @SubscribeEvent public void onEntityDeath(LivingDeathEvent event) { if (event.getEntity() instanceof EntitySquid) { event.getEntity().world.spawnEntity(new EntityItem(event.getEntity().world, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, new ItemStack(ModItems.RAW_CALAMARI, 1))); } System.out.println(event.getEntity().world); System.out.println(event.getEntity().posX); System.out.println(event.getEntity().posY); System.out.println(event.getEntity().posZ); } }
  22. I will try doing that. Thanks for the help!
  23. I have a TESR for a custom chest that I have for my mod. When I break the chest, the particles don't have a proper texture, and I'm wondering if you need to set a texture file for the particles. Here is my code for the TESR: package com.kpzip.SushiMod.blocks.animation; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.kpzip.SushiMod.blocks.tileentity.TileEntityBambooChest; import com.kpzip.SushiMod.util.Reference; @SideOnly(Side.CLIENT) public class RenderBambooChest extends TileEntitySpecialRenderer<TileEntityBambooChest> { private static final ResourceLocation TEXTURE = new ResourceLocation(Reference.MOD_ID + ":textures/blocks/bamboo_chest.png"); private final ModelBambooChest MODEL = new ModelBambooChest(); @Override public void render(TileEntityBambooChest te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { GlStateManager.enableDepth(); GlStateManager.depthFunc(515); GlStateManager.depthMask(true); ModelBambooChest model = MODEL; if (destroyStage >= 0) { this.bindTexture(DESTROY_STAGES[destroyStage]); GlStateManager.matrixMode(5890); GlStateManager.pushMatrix(); GlStateManager.scale(4.0F, 4.0F, 1.0F); GlStateManager.translate(0.0625F, 0.0625F, 0.0625F); GlStateManager.matrixMode(5888); } else this.bindTexture(TEXTURE); GlStateManager.pushMatrix(); GlStateManager.enableRescaleNormal(); GlStateManager.translate((float)x, (float)y + 1.0F, (float)z + 1.0F); GlStateManager.scale(1.0F, -1.0F, -1.0F); GlStateManager.translate(0.5F, 0.5F, 0.5F); GlStateManager.translate(-0.5F, -0.5F, -0.5F); float f = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * partialTicks; f = 1.0F - f; f = 1.0F - f * f * f; model.lid.rotateAngleX = -(f * ((float)Math.PI / 2F)); model.renderAll(); GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); if (destroyStage >= 0) { GlStateManager.matrixMode(5890); GlStateManager.popMatrix(); GlStateManager.matrixMode(5888); } } } And here is my code for the model in case you need it: package com.kpzip.SushiMod.blocks.animation; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class ModelBambooChest extends ModelBase { public ModelRenderer handle; public ModelRenderer lid; public ModelRenderer storage; public ModelBambooChest() { this.textureWidth = 64; this.textureHeight = 64; this.lid = new ModelRenderer(this, 0, 0); this.lid.setRotationPoint(1.0F, 7.0F, 15.0F); this.lid.addBox(0.0F, -5.0F, -14.0F, 14, 5, 14, 0.0F); this.handle = new ModelRenderer(this, 0, 0); this.handle.setRotationPoint(8.0F, 7.0F, 15.0F); this.handle.addBox(-1.0F, -2.0F, -15.0F, 2, 4, 1, 0.0F); this.storage = new ModelRenderer(this, 0, 19); this.storage.setRotationPoint(1.0F, 6.0F, 1.0F); this.storage.addBox(0.0F, 0.0F, 0.0F, 14, 10, 14, 0.0F); } public void renderAll() { this.handle.rotateAngleX = this.lid.rotateAngleX; this.lid.render(0.0625F); this.handle.render(0.0625F); this.storage.render(0.0625F); } }
×
×
  • Create New...

Important Information

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