From 2babb6cf0b57bbeaedb8b94973df14bfc9528490 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 9 Jan 2016 00:04:30 +0100 Subject: [PATCH] Some more texture work, fixed Special Render for items --- .../mod/blocks/render/RenderInventory.java | 48 ------------------- .../mod/misc/special/RenderSpecial.java | 15 +++--- .../mod/misc/special/SpecialRenderInit.java | 1 + .../mod/proxy/ClientProxy.java | 24 ++++------ .../mod/tile/TileEntityXPSolidifier.java | 1 + .../actuallyadditions/mod/util/AssetUtil.java | 9 ---- .../actuallyadditions/mod/util/WorldUtil.java | 1 - .../blockstates/blockXPSolidifier.json | 8 ++++ .../models/block/blockXPSolidifier.json | 12 +++++ .../models/item/blockXPSolidifier.json | 10 ++++ 10 files changed, 48 insertions(+), 81 deletions(-) delete mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderInventory.java create mode 100644 src/main/resources/assets/actuallyadditions/blockstates/blockXPSolidifier.json create mode 100644 src/main/resources/assets/actuallyadditions/models/block/blockXPSolidifier.json create mode 100644 src/main/resources/assets/actuallyadditions/models/item/blockXPSolidifier.json diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderInventory.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderInventory.java deleted file mode 100644 index a24babb8f..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderInventory.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file ("RenderInventory.java") is part of the Actually Additions Mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense/ - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2016 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.blocks.render; - -//TODO Fix the rendering handler -public class RenderInventory{ - - private RenderTileEntity tileRender; - private int renderID; - - public RenderInventory(RenderTileEntity tileRender, int renderID){ - this.tileRender = tileRender; - this.renderID = renderID; - } - - /*@Override - public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer){ - GlStateManager.glPushMatrix(); - Minecraft.getMinecraft().renderEngine.bindTexture(this.tileRender.resLoc); - GlStateManager.glTranslatef(0F, 1F, 0F); - GlStateManager.glRotatef(180F, 1F, 0F, 0F); - this.tileRender.theModel.render(0.0625F); - GlStateManager.glPopMatrix(); - } - - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer){ - return false; - } - - @Override - public boolean shouldRender3DInInventory(int modelId){ - return true; - } - - @Override - public int getRenderId(){ - return this.renderID; - }*/ -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java index afe50f1b1..e37be527d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java @@ -38,16 +38,14 @@ public class RenderSpecial{ return; } - boolean isBlock = this.theThingToRender.getItem() instanceof ItemBlock; - float size = isBlock ? 0.5F : 0.6F; - double offsetUp = isBlock ? 0F : 0.2F; - if(ClientProxy.pumpkinBlurPumpkinBlur){ this.theThingToRender = new ItemStack(Calendar.getInstance().get(Calendar.DAY_OF_MONTH)%2 == 0 ? Blocks.lit_pumpkin : Blocks.pumpkin); - size = 0.5F; - offsetUp = 0; } + boolean isBlock = this.theThingToRender.getItem() instanceof ItemBlock; + float size = isBlock ? 0.5F : 0.4F; + double offsetUp = isBlock ? 0D : 0.1875D; + double bobHeight = 70; double theTime = Minecraft.getSystemTime(); double time = theTime/50; @@ -81,8 +79,11 @@ public class RenderSpecial{ AssetUtil.renderBlockInWorld(Block.getBlockFromItem(this.theThingToRender.getItem()), this.theThingToRender.getItemDamage()); } else{ - GlStateManager.translate(-0.5D, 0D, 0D); + GlStateManager.pushMatrix(); + GlStateManager.translate(0D, 0.5D, 0D); + GlStateManager.rotate(180F, 1F, 0F, 0F); AssetUtil.renderItemInWorld(this.theThingToRender); + GlStateManager.popMatrix(); } } GlStateManager.enableLighting(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java index 3bf0f506e..9fffe9530 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java @@ -62,6 +62,7 @@ public class SpecialRenderInit{ //Add a new Special Renderer to the list if(stack != null){ specialList.put(key, new RenderSpecial(stack)); + System.out.println(stack.toString()); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java index 012f45116..713ef1337 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java @@ -20,7 +20,6 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.event.InitEvents; import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit; import de.ellpeck.actuallyadditions.mod.tile.*; -import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.playerdata.PersistentClientData; import net.minecraft.client.Minecraft; @@ -28,7 +27,6 @@ import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.event.FMLInitializationEvent; @@ -77,14 +75,14 @@ public class ClientProxy implements IProxy{ InitEvents.initClient(); - registerRenderer(TileEntityCompost.class, new RenderTileEntity(new ModelCompost()), AssetUtil.compostRenderId); - registerRenderer(TileEntityFishingNet.class, new RenderTileEntity(new ModelFishingNet()), AssetUtil.fishingNetRenderId); - registerRenderer(TileEntityFurnaceSolar.class, new RenderTileEntity(new ModelFurnaceSolar()), AssetUtil.furnaceSolarRenderId); - registerRenderer(TileEntityCoffeeMachine.class, new RenderTileEntity(new ModelCoffeeMachine()), AssetUtil.coffeeMachineRenderId); - registerRenderer(TileEntityPhantomBooster.class, new RenderTileEntity(new ModelPhantomBooster()), AssetUtil.phantomBoosterRenderId); - registerRenderer(TileEntitySmileyCloud.class, new RenderSmileyCloud(new ModelSmileyCloud()), AssetUtil.smileyCloudRenderId); - registerRenderer(TileEntityLaserRelay.class, new RenderLaserRelay(new ModelLaserRelay()), AssetUtil.laserRelayRenderId); - registerRenderer(TileEntityBookletStand.class, new RenderTileEntity(new ModelBookletStand()), AssetUtil.bookletStandRenderId); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCompost.class, new RenderTileEntity(new ModelCompost())); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFishingNet.class, new RenderTileEntity(new ModelFishingNet())); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFurnaceSolar.class, new RenderTileEntity(new ModelFurnaceSolar())); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCoffeeMachine.class, new RenderTileEntity(new ModelCoffeeMachine())); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPhantomBooster.class, new RenderTileEntity(new ModelPhantomBooster())); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmileyCloud.class, new RenderSmileyCloud(new ModelSmileyCloud())); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaserRelay.class, new RenderLaserRelay(new ModelLaserRelay())); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBookletStand.class, new RenderTileEntity(new ModelBookletStand())); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAtomicReconstructor.class, new RenderReconstructorLens()); //TODO Fix villager @@ -111,10 +109,4 @@ public class ClientProxy implements IProxy{ public void addRenderVariant(Item item, ResourceLocation[] location){ modelVariantsForRegistering.put(item, location); } - - private static void registerRenderer(Class tileClass, RenderTileEntity tileRender, int renderID){ - ClientRegistry.bindTileEntitySpecialRenderer(tileClass, tileRender); - //TODO Fix inventory rendering - //RenderingRegistry.registerBlockHandler(new RenderInventory(tileRender, renderID)); - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java index 124dd30eb..8561761f6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java @@ -95,6 +95,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } } + //TODO Fix XP System to fit points needed in 1.8 (OpenBlocks?) /** * Gets the Player's XP * (Excerpted from OpenBlocks' XP system with permission, thanks guys!) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java index 4870fa947..3eee47264 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java @@ -31,15 +31,6 @@ public class AssetUtil{ public static final ResourceLocation GUI_INVENTORY_LOCATION = getGuiLocation("guiInventory"); public static final int TESR_RENDER_ID = 2; - public static int compostRenderId; - public static int fishingNetRenderId; - public static int furnaceSolarRenderId; - public static int coffeeMachineRenderId; - public static int phantomBoosterRenderId; - public static int smileyCloudRenderId; - public static int laserRelayRenderId; - public static int bookletStandRenderId; - public static ResourceLocation getGuiLocation(String file){ return new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/gui/"+file+".png"); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java index f4f8f69f5..17cc3c5d8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java @@ -398,7 +398,6 @@ public class WorldUtil{ } else{ //Check the Server if a Block that changed on the Client really changed, if not, revert the change - //TODO Check if this is the right action Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, pos, Minecraft.getMinecraft().objectMouseOver.sideHit)); } return removed; diff --git a/src/main/resources/assets/actuallyadditions/blockstates/blockXPSolidifier.json b/src/main/resources/assets/actuallyadditions/blockstates/blockXPSolidifier.json new file mode 100644 index 000000000..2f4234c7a --- /dev/null +++ b/src/main/resources/assets/actuallyadditions/blockstates/blockXPSolidifier.json @@ -0,0 +1,8 @@ +{ + "variants": { + "meta=0": { "model": "actuallyadditions:blockXPSolidifier", "y": 0 }, + "meta=1": { "model": "actuallyadditions:blockXPSolidifier", "y": 180 }, + "meta=2": { "model": "actuallyadditions:blockXPSolidifier", "y": -90 }, + "meta=3": { "model": "actuallyadditions:blockXPSolidifier", "y": 90 } + } +} diff --git a/src/main/resources/assets/actuallyadditions/models/block/blockXPSolidifier.json b/src/main/resources/assets/actuallyadditions/models/block/blockXPSolidifier.json new file mode 100644 index 000000000..e4b14ae63 --- /dev/null +++ b/src/main/resources/assets/actuallyadditions/models/block/blockXPSolidifier.json @@ -0,0 +1,12 @@ +{ + "parent": "block/cube", + "textures": { + "particle": "actuallyadditions:blocks/blockXPSolidifier", + "down": "actuallyadditions:blocks/blockXPSolidifierTop", + "up": "actuallyadditions:blocks/blockXPSolidifierTop", + "north": "actuallyadditions:blocks/blockXPSolidifierFront", + "east": "actuallyadditions:blocks/blockXPSolidifier", + "south": "actuallyadditions:blocks/blockXPSolidifier", + "west": "actuallyadditions:blocks/blockXPSolidifier" + } +} diff --git a/src/main/resources/assets/actuallyadditions/models/item/blockXPSolidifier.json b/src/main/resources/assets/actuallyadditions/models/item/blockXPSolidifier.json new file mode 100644 index 000000000..25c5378a7 --- /dev/null +++ b/src/main/resources/assets/actuallyadditions/models/item/blockXPSolidifier.json @@ -0,0 +1,10 @@ +{ + "parent": "actuallyadditions:block/blockXPSolidifier", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +} \ No newline at end of file