diff options
author | Raven Szewczyk <git@eigenraven.me> | 2024-05-25 14:09:28 +0100 |
---|---|---|
committer | Raven Szewczyk <git@eigenraven.me> | 2024-05-25 14:09:28 +0100 |
commit | a7e6e9fa443440063e2a0b9b7b017852d4e023ee (patch) | |
tree | 35a05b74d32420c6be83810ebafec8d88092d9a3 /goodgen/src/main/java/goodgenerator/client | |
parent | 13d47567b6b1103647e5a819e601b426911bb89d (diff) | |
parent | 84481c22d7d4e0834de97a150d257ce6e85ad690 (diff) | |
download | GT5-Unofficial-a7e6e9fa443440063e2a0b9b7b017852d4e023ee.tar.gz GT5-Unofficial-a7e6e9fa443440063e2a0b9b7b017852d4e023ee.tar.bz2 GT5-Unofficial-a7e6e9fa443440063e2a0b9b7b017852d4e023ee.zip |
Merge in GoodGenerator with history
git-subtree-dir: goodgen
git-subtree-mainline: 13d47567b6b1103647e5a819e601b426911bb89d
git-subtree-split: 84481c22d7d4e0834de97a150d257ce6e85ad690
Diffstat (limited to 'goodgen/src/main/java/goodgenerator/client')
3 files changed, 181 insertions, 0 deletions
diff --git a/goodgen/src/main/java/goodgenerator/client/ClientProxy.java b/goodgen/src/main/java/goodgenerator/client/ClientProxy.java new file mode 100644 index 0000000000..b8a885cab6 --- /dev/null +++ b/goodgen/src/main/java/goodgenerator/client/ClientProxy.java @@ -0,0 +1,24 @@ +package goodgenerator.client; + +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import goodgenerator.common.CommonProxy; + +public class ClientProxy extends CommonProxy { + + @Override + public void preInit(FMLPreInitializationEvent event) { + super.preInit(event); + } + + @Override + public void init(FMLInitializationEvent event) { + super.init(event); + } + + @Override + public void postInit(FMLPostInitializationEvent event) { + super.postInit(event); + } +} diff --git a/goodgen/src/main/java/goodgenerator/client/GUI/GG_UITextures.java b/goodgen/src/main/java/goodgenerator/client/GUI/GG_UITextures.java new file mode 100644 index 0000000000..2b9bc8df84 --- /dev/null +++ b/goodgen/src/main/java/goodgenerator/client/GUI/GG_UITextures.java @@ -0,0 +1,22 @@ +package goodgenerator.client.GUI; + +import com.gtnewhorizons.modularui.api.drawable.UITexture; + +public class GG_UITextures { + + private static final String MODID = "goodgenerator"; + + public static final UITexture PICTURE_NAQUADAH_REACTOR = UITexture.fullImage(MODID, "gui/picture/naquadah_reactor"); + public static final UITexture PICTURE_NEUTRON_ACTIVATOR = UITexture + .fullImage(MODID, "gui/picture/neutron_activator"); + public static final UITexture PICTURE_EXTREME_HEAT_EXCHANGER = UITexture + .fullImage(MODID, "gui/picture/extreme_heat_exchanger"); + public static final UITexture PICTURE_COMPONENT_ASSLINE = UITexture + .fullImage(MODID, "gui/picture/component_assline"); + public static final UITexture OVERLAY_BUTTON_LOCK_OFF = UITexture.fullImage(MODID, "gui/overlay_button/lock_off"); + public static final UITexture OVERLAY_BUTTON_LOCK_ON = UITexture.fullImage(MODID, "gui/overlay_button/lock_on"); + public static final UITexture OVERLAY_BUTTON_ASSEMBLER_MODE = UITexture + .fullImage(MODID, "gui/overlay_button/assembler_mode"); + public static final UITexture OVERLAY_BUTTON_PRECISE_MODE = UITexture + .fullImage(MODID, "gui/overlay_button/precise_mode"); +} diff --git a/goodgen/src/main/java/goodgenerator/client/render/BlockRenderHandler.java b/goodgen/src/main/java/goodgenerator/client/render/BlockRenderHandler.java new file mode 100644 index 0000000000..01893339f5 --- /dev/null +++ b/goodgen/src/main/java/goodgenerator/client/render/BlockRenderHandler.java @@ -0,0 +1,135 @@ +package goodgenerator.client.render; + +import static gregtech.common.render.GT_Renderer_Block.*; +import static net.minecraftforge.common.util.ForgeDirection.*; +import static net.minecraftforge.common.util.ForgeDirection.EAST; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.world.IBlockAccess; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; +import goodgenerator.blocks.regularBlock.ITextureBlock; +import gregtech.GT_Mod; + +public class BlockRenderHandler implements ISimpleBlockRenderingHandler { + + public static final float blockMin = 0.0F; + public static final float blockMax = 1.0F; + public static BlockRenderHandler INSTANCE; + public final int mRenderID; + + public BlockRenderHandler() { + this.mRenderID = RenderingRegistry.getNextAvailableRenderId(); + INSTANCE = this; + RenderingRegistry.registerBlockHandler(this); + } + + @Override + public void renderInventoryBlock(Block aBlock, int metadata, int modelId, RenderBlocks aRenderer) { + aRenderer.enableAO = false; + aRenderer.useInventoryTint = true; + + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + + if (aBlock instanceof ITextureBlock) { + ITextureBlock tc = (ITextureBlock) aBlock; + aBlock.setBlockBoundsForItemRender(); + aRenderer.setRenderBoundsFromBlock(aBlock); + renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, metadata, DOWN), true); + renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, metadata, UP), true); + renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, metadata, NORTH), true); + renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, metadata, SOUTH), true); + renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, metadata, WEST), true); + renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, metadata, EAST), true); + } + + aBlock.setBlockBounds(blockMin, blockMin, blockMin, blockMax, blockMax, blockMax); + aRenderer.setRenderBoundsFromBlock(aBlock); + + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + aRenderer.useInventoryTint = false; + } + + @Override + public boolean renderWorldBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, int aModelID, + RenderBlocks aRenderer) { + aRenderer.enableAO = Minecraft.isAmbientOcclusionEnabled() && GT_Mod.gregtechproxy.mRenderTileAmbientOcclusion; + aRenderer.useInventoryTint = false; + if (aBlock instanceof ITextureBlock) { + aBlock.setBlockBounds(blockMin, blockMin, blockMin, blockMax, blockMax, blockMax); + aRenderer.setRenderBoundsFromBlock(aBlock); + ITextureBlock tc = (ITextureBlock) aBlock; + renderNegativeYFacing( + aWorld, + aRenderer, + aBlock, + aX, + aY, + aZ, + tc.getTexture(aBlock, DOWN, aWorld, aX, aY, aZ), + true); + renderPositiveYFacing( + aWorld, + aRenderer, + aBlock, + aX, + aY, + aZ, + tc.getTexture(aBlock, UP, aWorld, aX, aY, aZ), + true); + renderNegativeZFacing( + aWorld, + aRenderer, + aBlock, + aX, + aY, + aZ, + tc.getTexture(aBlock, NORTH, aWorld, aX, aY, aZ), + true); + renderPositiveZFacing( + aWorld, + aRenderer, + aBlock, + aX, + aY, + aZ, + tc.getTexture(aBlock, SOUTH, aWorld, aX, aY, aZ), + true); + renderNegativeXFacing( + aWorld, + aRenderer, + aBlock, + aX, + aY, + aZ, + tc.getTexture(aBlock, WEST, aWorld, aX, aY, aZ), + true); + renderPositiveXFacing( + aWorld, + aRenderer, + aBlock, + aX, + aY, + aZ, + tc.getTexture(aBlock, EAST, aWorld, aX, aY, aZ), + true); + } + return false; + } + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } + + @Override + public int getRenderId() { + return this.mRenderID; + } +} |