Jump to content

RustyGearGames

Members
  • Posts

    20
  • Joined

  • Last visited

RustyGearGames's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I have a custom block setup to be a coal generator, everything seems to work fine until you load and process one coal in the machine. Once you close and reopen the block, the screen will flash a copy of the GUI progress bar and the top section of the GUI texture about 50% to right of the intended GUI. The original GUI is still in place but only in that short instance is there an issue. This is my GUI class for the generator. package com.rustygeargames.advancedtechmod.blocks.gui; import com.rustygeargames.advancedtechmod.blocks.container.ContainerCoalGenerator; import com.rustygeargames.advancedtechmod.tileentity.TileEntityCoalGenerator; import com.rustygeargames.advancedtechmod.util.RefStrings; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; public class GuiCoalGenerator extends GuiContainer { private static final ResourceLocation TEXTURES = new ResourceLocation(RefStrings.MOD_ID + ":textures/gui/coal_generator.png"); private final InventoryPlayer player; private final TileEntityCoalGenerator tileentity; public GuiCoalGenerator(InventoryPlayer player, TileEntityCoalGenerator tileentity) { super(new ContainerCoalGenerator(player, tileentity)); this.player = player; this.tileentity = tileentity; } private String toString(int cookProgressScaled) { return toString(this.getCookProgressScaled(24)); } @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { String tileName = this.tileentity.getDisplayName().getUnformattedText(); String cookprogress = toString(); this.fontRenderer.drawString(tileName, (this.xSize / 2 - this.fontRenderer.getStringWidth(tileName) / 2) -5, 6, 4210752); this.fontRenderer.drawString(this.player.getDisplayName().getUnformattedText(), 7, this.ySize - 96 + 2, 4210752); this.fontRenderer.drawString(Integer.toString(this.tileentity.getEnergyStored()), 115, 72, 4210752); this.fontRenderer.drawString(Integer.toString(this.tileentity.cookTime), 115, 50, 4210752); } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); this.mc.getTextureManager().bindTexture(TEXTURES); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); //ArrowProgress int l = this.getCookProgressScaled(24); this.drawTexturedModalRect(this.guiLeft + 113, this.guiTop + 32, 176, 0, l + 1, 16); //EnergyBar int k = this.getEnergyStoredScaled(75); this.drawTexturedModalRect(this.guiLeft + 152, this.guiTop + 7, 176, 17, 16, 75 - k); } private int getEnergyStoredScaled(int pixels) { int i = this.tileentity.getEnergyStored(); int j = this.tileentity.getMaxEnergyStored(); return i != 0 && j != 0 ? i * pixels / j : 0; } private int getCookProgressScaled(int pixels) { int i = this.tileentity.cookTime; return i != 0 ? i * pixels / 25 : 0; } public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); super.drawScreen(mouseX, mouseY, partialTicks); this.renderHoveredToolTip(mouseX, mouseY); } }
  2. Oh. My. God. That fixed it, thank you so much. I Have spent way to much on this for such a simple mistake. Once again, thanks for helping me. Side note how do I state a topic as solved (if Possible)
  3. Its being called from the preInitReg method in the RegistryHandler class. My bad I failed to edit the entirety of the class so it was still a static method. However, it should be updated properly now.
  4. you are correct, Sorry, My main used to contain that and i moved it. give me a sec ill post the class containing it.
  5. My apologies. I will fix this I have edited the original post to include my Main mod class file.
  6. What exactly do you want then? I was taught you can use an If statement checking for isClientSide to be true, then you can. correct me if im wrong.
  7. its called client side from my main class
  8. "sm" isnt my modid its a shortened version of my modid, it wasnt my choice to do this. and i have edited the post for the full files inclusion.
  9. Issue: Currently I am having an issue where I can't get two fluid blocks in my mod to render. Using 'ModelLoader.setCustomMeshDefinition' and 'ModelLoader.setCustomStateMapper' as i was told to do in one of a few available tutorials, The first fluid "registered" using these methods get the texture from the last fluid "registered" and all the others fail to have textures completely. I Have spent many hours trying to find documentation on these methods or my issue but was only able to find scraps, uninformative tutorials or outdated information. If someone could please tell me what I'm doing wrong or missing that would be greatly appreciated. ModBlocks.java public static final List<Block> BLOCKS = new ArrayList<Block>(); public static final Block Copper_Ore = new BlockBase("copper_ore", Material.IRON); public static final Block Silver_Ore = new BlockBase("silver_ore", Material.IRON); //FLUIDS public static final Block Molten_Copper = new BlockFluid("molten_copper",ModFluid.MOLTEN_COPPER_FLUID,Material.LAVA); public static final Block Molten_Silver = new BlockFluid("molten_silver",ModFluid.MOLTEN_SILVER_FLUID,Material.LAVA); public static void registerBlock(Block block) { ForgeRegistries.BLOCKS.register(block); ForgeRegistries.ITEMS.register(new ItemBlock(block).setRegistryName(block.getRegistryName())); } RenderHandler.java package com.xjacobx24.simplemod.util.handlers; import com.xjacobx24.simplemod.init.ModBlocks; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.StateMapperBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.client.model.ModelLoader; public class RenderHandler { public static void CallMe() { new RenderHandler().registerCustomMeshesAndStates(); } public void registerCustomMeshesAndStates() { ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(ModBlocks.Molten_Copper), new ItemMeshDefinition() { @Override public ModelResourceLocation getModelLocation(ItemStack stack) { return new ModelResourceLocation("sm:molten_copper", "fluid"); } }); ModelLoader.setCustomStateMapper(ModBlocks.Molten_Copper, new StateMapperBase() { @Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return new ModelResourceLocation("sm:molten_copper", "fluid"); } }); ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(ModBlocks.Molten_Silver), new ItemMeshDefinition() { @Override public ModelResourceLocation getModelLocation(ItemStack stack) { return new ModelResourceLocation("sm:molten_silver", "fluid"); } }); ModelLoader.setCustomStateMapper(ModBlocks.Molten_Silver, new StateMapperBase() { @Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return new ModelResourceLocation("sm:molten_silver", "fluid"); } }); } } Main.java package com.xjacobx24.simplemod; import com.xjacobx24.simplemod.generation.ModWorldGen; import com.xjacobx24.simplemod.init.ModBlocks; import com.xjacobx24.simplemod.proxy.ClientProxy; import com.xjacobx24.simplemod.proxy.CommonProxy; import com.xjacobx24.simplemod.util.Reference; import com.xjacobx24.simplemod.util.handlers.RegistryHandler; import com.xjacobx24.simplemod.util.handlers.RenderHandler; import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.registries.IForgeRegistry; import slimeknights.mantle.pulsar.control.PulseManager; import slimeknights.tconstruct.TinkerIntegration; import slimeknights.tconstruct.common.TinkerOredict; import slimeknights.tconstruct.common.config.Config; import slimeknights.tconstruct.debug.TinkerDebug; import slimeknights.tconstruct.gadgets.TinkerGadgets; import slimeknights.tconstruct.library.book.TinkerBook; import slimeknights.tconstruct.plugin.Chisel; import slimeknights.tconstruct.plugin.ChiselAndBits; import slimeknights.tconstruct.plugin.CraftingTweaks; import slimeknights.tconstruct.plugin.theoneprobe.TheOneProbe; import slimeknights.tconstruct.plugin.waila.Waila; import slimeknights.tconstruct.shared.TinkerCommons; import slimeknights.tconstruct.shared.TinkerFluids; import slimeknights.tconstruct.smeltery.TinkerSmeltery; import slimeknights.tconstruct.tools.AggregateModelRegistrar; import slimeknights.tconstruct.tools.TinkerMaterials; import slimeknights.tconstruct.tools.TinkerModifiers; import slimeknights.tconstruct.tools.TinkerTools; import slimeknights.tconstruct.tools.harvest.TinkerHarvestTools; import slimeknights.tconstruct.tools.melee.TinkerMeleeWeapons; import slimeknights.tconstruct.tools.ranged.TinkerRangedWeapons; import slimeknights.tconstruct.world.TinkerWorld; @Mod(modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION) public class Main { @Instance public static Main instance; @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.COMMON_PROXY_CLASS) public static CommonProxy proxy; public static PulseManager pulseManager = new PulseManager(Config.pulseConfig); static { FluidRegistry.enableUniversalBucket(); } @EventHandler public static void PreInit(FMLPreInitializationEvent event) { RegistryHandler.preInitReg(event); } @EventHandler public static void init(FMLInitializationEvent event) { GameRegistry.registerWorldGenerator(new ModWorldGen(), 0); } @EventHandler public static void Postinit(FMLPostInitializationEvent event) { } } RegistryHandler.java package com.xjacobx24.simplemod.util.handlers; import com.xjacobx24.simplemod.init.ModBlocks; import com.xjacobx24.simplemod.init.ModFluid; import com.xjacobx24.simplemod.init.ModItems; import com.xjacobx24.simplemod.util.IHasModel; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.StateMapperBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @EventBusSubscriber public class RegistryHandler { @SubscribeEvent public static void onItemRegister(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0])); } @SubscribeEvent public static void onBlockRegister(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0])); } /* @SubscribeEvent public static void onFluidRegister(FluidRegistry.FluidRegisterEvent event) { FluidRegistry.registerFluid(ModFluid.CORUNDUM); System.out.println("FluidRegisterd"); } */ @SubscribeEvent public static void onModelRegister(ModelRegistryEvent event) { for(Item item : ModItems.ITEMS) { if(item instanceof IHasModel) { ((IHasModel)item).registerModels(); } } for(Block block : ModBlocks.BLOCKS) { if(block instanceof IHasModel) { ((IHasModel)block).registerModels(); } } } public static void preInitReg(FMLPreInitializationEvent event) { ModFluid.registerFluids(); //MUST BE CALLED FIRST!!!!!!!! RenderHandler.CallMe();//Calls registerCustomMeshesAndStates } }
  10. Sorry for the late reply, but thanks a lot it worked well, and saved me alot of headache and frustration.
  11. Id like to have an if statement check for specific biomes, how would i go about doing so?
  12. Im trying to call it from my eventhandler where i have a keybind setup wich works fine (i have printed to console) the issue is, when i try to call the function from anywhere it says i need to add arguments to match but the defasult is null and Im not sure what to replace them with. this is what my quickfix throws at me as a fix. ItemGun.Reload(null, null, null, null); -thanks in advanced
×
×
  • Create New...

Important Information

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