diff --git a/src/main/java/forestry/core/gui/GuiForestry.java b/src/main/java/forestry/core/gui/GuiForestry.java index 81dd1961e..b44d4d0e2 100755 --- a/src/main/java/forestry/core/gui/GuiForestry.java +++ b/src/main/java/forestry/core/gui/GuiForestry.java @@ -19,7 +19,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.entity.player.InventoryPlayer; diff --git a/src/main/java/forestry/core/models/ModelCrate.java b/src/main/java/forestry/core/models/ModelCrate.java index 1294e22e7..bffefc79c 100644 --- a/src/main/java/forestry/core/models/ModelCrate.java +++ b/src/main/java/forestry/core/models/ModelCrate.java @@ -23,9 +23,12 @@ import java.io.StringReader; import java.util.IdentityHashMap; import java.util.Map; +import javax.vecmath.Vector3f; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.ModelBlock; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.IResource; @@ -40,8 +43,12 @@ import net.minecraftforge.client.ItemModelMesherForge; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.model.IFlexibleBakedModel; import net.minecraftforge.client.model.IModel; +import net.minecraftforge.client.model.IModelState; +import net.minecraftforge.client.model.IPerspectiveAwareModel; import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.client.model.MultiModel; +import net.minecraftforge.client.model.SimpleModelState; +import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -73,7 +80,8 @@ public class ModelCrate extends BlankItemModel { MODEL_COMPASS = ObfuscationReflectionHelper.getPrivateValue(ModelBakery.class, event.modelLoader, 15); MODEL_CLOCK = ObfuscationReflectionHelper.getPrivateValue(ModelBakery.class, event.modelLoader, 16); } catch (IOException e) { - Log.error("Failed to bake crate model model."); + Log.error("Failed to init the crate model."); + e.printStackTrace(); } } @@ -200,10 +208,10 @@ public class ModelCrate extends BlankItemModel { /** * Bake the crate model; */ - private IFlexibleBakedModel getModelCrate() { + /*private IFlexibleBakedModel getModelCrate() { IFlexibleBakedModel flexModel = getModel(new ItemStack(PluginStorage.items.crate, 1, 1)); return crateModel.bake(crateModel.getDefaultState(), flexModel.getFormat(), textureGetter); - } + }*/ /** * Bake the crated model @@ -213,16 +221,29 @@ public class ModelCrate extends BlankItemModel { ItemCrated crated = (ItemCrated) stack.getItem(); String crateUID = StringUtil.cleanItemName(crated); if (crates.get(crateUID) == null) { - IFlexibleBakedModel baseBaked = getModelCrate(); - + IFlexibleBakedModel baseBaked = getModel(new ItemStack(PluginStorage.items.crate, 1, 1)); //Set the crate color index to 100 for (BakedQuad quad : baseBaked.getGeneralQuads()) { ObfuscationReflectionHelper.setPrivateValue(BakedQuad.class, quad, 100, 1); } - crates.put(crateUID, new MultiModel.Baked(baseBaked, bakeContentModels(crated))); + crates.put(crateUID, new MultiModel.Baked(null, true, new IPerspectiveAwareModel.MapWrapper(baseBaked, getTransformations()), bakeContentModels(crated))); } return crates.get(crateUID); } + + public IModelState getTransformations(){ + TRSRTransformation thirdperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( + new Vector3f(0, 1f / 16, -3f / 16), + TRSRTransformation.quatFromYXZDegrees(new Vector3f(-90, 0, 0)), + new Vector3f(0.55f, 0.55f, 0.55f), + null)); + TRSRTransformation firstperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( + new Vector3f(0, 4f / 16, 2f / 16), + TRSRTransformation.quatFromYXZDegrees(new Vector3f(0, -135, 25)), + new Vector3f(1.7f, 1.7f, 1.7f), + null)); + return new SimpleModelState(ImmutableMap.of(TransformType.THIRD_PERSON, thirdperson, TransformType.FIRST_PERSON, firstperson)); + } @Override public boolean isGui3d() { diff --git a/src/main/java/forestry/core/render/RenderEscritoire.java b/src/main/java/forestry/core/render/RenderEscritoire.java index dfc5acb10..dc9af2054 100755 --- a/src/main/java/forestry/core/render/RenderEscritoire.java +++ b/src/main/java/forestry/core/render/RenderEscritoire.java @@ -40,7 +40,7 @@ public class RenderEscritoire extends TileEntitySpecialRenderer if (escritoire != null) { render(escritoire.getStackInSlot(InventoryEscritoire.SLOT_ANALYZE), escritoire.getOrientation(), x, y, z); } else { - render(null, EnumFacing.EAST, x, y, z); + render(null, EnumFacing.SOUTH, x, y, z); } } diff --git a/src/main/java/forestry/factory/gui/widgets/MemorizedRecipeSlot.java b/src/main/java/forestry/factory/gui/widgets/MemorizedRecipeSlot.java index 6330b1441..363b4595b 100644 --- a/src/main/java/forestry/factory/gui/widgets/MemorizedRecipeSlot.java +++ b/src/main/java/forestry/factory/gui/widgets/MemorizedRecipeSlot.java @@ -15,8 +15,6 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.ItemStack; -import org.lwjgl.opengl.GL11; - import forestry.core.gui.widgets.ItemStackWidgetBase; import forestry.core.gui.widgets.WidgetManager; import forestry.core.proxy.Proxies; diff --git a/src/main/java/forestry/plugins/compat/PluginIC2.java b/src/main/java/forestry/plugins/compat/PluginIC2.java index 6d09a2382..24e18e04c 100644 --- a/src/main/java/forestry/plugins/compat/PluginIC2.java +++ b/src/main/java/forestry/plugins/compat/PluginIC2.java @@ -15,7 +15,6 @@ import com.google.common.collect.ImmutableMap; import javax.annotation.Nonnull; import java.util.Set; -import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -23,8 +22,6 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.event.FMLInterModComms; -import net.minecraftforge.fml.common.registry.GameRegistry; - import forestry.api.circuits.ChipsetManager; import forestry.api.circuits.CircuitSocketType; import forestry.api.circuits.ICircuitLayout; diff --git a/src/main/resources/assets/forestry/blockstates/crates.json b/src/main/resources/assets/forestry/blockstates/crates.json deleted file mode 100644 index c0c339524..000000000 --- a/src/main/resources/assets/forestry/blockstates/crates.json +++ /dev/null @@ -1,696 +0,0 @@ -{ - "forge_marker": 1, - "defaults": { - "model": "forestry:crate", - "transform": "forge:default-block" - }, - "variants": { - "crate": [ - { - "model": "forestry:crate-filled" - } - ], - "cratedacaciawood": [ - { - "custom": { - "location": "acacia_log#axis=y", - "uid": "cratedacaciawood" - } - } - ], - "cratedandesite": [ - { - "custom": { - "location": "andesite#normal", - "uid": "cratedandesite" - } - } - ], - "cratedbirchwood": [ - { - "custom": { - "location": "birch_log#axis=y", - "uid": "cratedbirchwood" - } - } - ], - "cratedbogearth": [ - { - "custom": { - "location": "forestry:soil#soil=bog_earth", - "uid": "cratedbogearth" - } - } - ], - "cratedbrick": [ - { - "custom": { - "location": "brick_block#normal", - "uid": "cratedbrick" - } - } - ], - "cratedcacti": [ - { - "custom": { - "location": "cactus#normal", - "uid": "cratedcacti" - } - } - ], - "cratedcobblestone": [ - { - "custom": { - "location": "cobblestone#normal", - "uid": "cratedcobblestone" - } - } - ], - "crateddarkoakwood": [ - { - "custom": { - "location": "dark_oak_log#axis=y", - "uid": "crateddarkoakwood" - } - } - ], - "crateddiorite": [ - { - "custom": { - "location": "diorite#normal", - "uid": "crateddiorite" - } - } - ], - "crateddirt": [ - { - "custom": { - "location": "dirt#normal", - "uid": "crateddirt" - } - } - ], - "cratedgranite": [ - { - "custom": { - "location": "granite#normal", - "uid": "cratedgranite" - } - } - ], - "cratedgravel": [ - { - "custom": { - "location": "gravel#normal", - "uid": "cratedgravel" - } - } - ], - "cratedhumus": [ - { - "custom": { - "location": "forestry:soil#soil=humus", - "uid": "cratedhumus" - } - } - ], - "cratedjunglewood": [ - { - "custom": { - "location": "jungle_log#axis=y", - "uid": "cratedjunglewood" - } - } - ], - "cratedmycelium": [ - { - "custom": { - "location": "mycelium#snowy=false", - "uid": "cratedmycelium" - } - } - ], - "cratedpeat": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/peat", - "uid": "cratedpeat" - } - } - ], - "cratedapatite": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/apatite", - "uid": "cratedapatite" - } - } - ], - "cratedfertilizer": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/fertilizerCompound", - "uid": "cratedfertilizer" - } - } - ], - "cratedmulch": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/mulch", - "uid": "cratedmulch" - } - } - ], - "cratedphosphor": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/phosphor", - "uid": "cratedphosphor" - } - } - ], - "cratedash": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/ash", - "uid": "cratedash" - } - } - ], - "cratedtin": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/ingotTin", - "uid": "cratedtin" - } - } - ], - "cratedcopper": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/ingotCopper", - "uid": "cratedcopper" - } - } - ], - "cratedbronze": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/ingotBronze", - "uid": "cratedbronze" - } - } - ], - "cratedwheat": [ - { - "custom": { - "isItem": true, - "location": "item/wheat", - "uid": "cratedwheat" - } - } - ], - "cratedcookies": [ - { - "custom": { - "isItem": true, - "location": "item/cookie", - "uid": "cratedcookies" - } - } - ], - "cratedredstone": [ - { - "custom": { - "isItem": true, - "location": "item/redstone", - "uid": "cratedredstone" - } - } - ], - "cratedlapis": [ - { - "custom": { - "isItem": true, - "location": "item/dye_blue", - "uid": "cratedlapis" - } - } - ], - "cratedreeds": [ - { - "custom": { - "isItem": true, - "location": "item/reeds", - "uid": "cratedreeds" - } - } - ], - "cratedclay": [ - { - "custom": { - "isItem": true, - "location": "item/clay_ball", - "uid": "cratedclay" - } - } - ], - "cratedglowstone": [ - { - "custom": { - "isItem": true, - "location": "item/glowstone_dust", - "uid": "cratedglowstone" - } - } - ], - "cratedapples": [ - { - "custom": { - "isItem": true, - "location": "item/apple", - "uid": "cratedapples" - } - } - ], - "cratednetherwart": [ - { - "custom": { - "isItem": true, - "location": "item/nether_wart", - "uid": "cratednetherwart" - } - } - ], - "cratedcharcoal": [ - { - "custom": { - "isItem": true, - "location": "item/charcoal", - "uid": "cratedcharcoal" - } - } - ], - "cratedcoal": [ - { - "custom": { - "isItem": true, - "location": "item/coal", - "uid": "cratedcoal" - } - } - ], - "cratedseeds": [ - { - "custom": { - "isItem": true, - "location": "item/wheat_seeds", - "uid": "cratedseeds" - } - } - ], - "cratedpotatoes": [ - { - "custom": { - "isItem": true, - "location": "item/potato", - "uid": "cratedpotatoes" - } - } - ], - "cratedcarrots": [ - { - "custom": { - "isItem": true, - "location": "item/carrot", - "uid": "cratedcarrots" - } - } - ], - "cratedbeeswax": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/beeswax", - "uid": "cratedbeeswax" - } - } - ], - "cratedpollen": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/pollen", - "uid": "cratedpollen" - } - } - ], - "cratedcrystallinepollen": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/pollen", - "uid": "cratedcrystallinepollen" - } - } - ], - "cratedpropolis": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/propolis", - "uid": "cratedpropolis" - } - } - ], - "cratedhoneydew": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/honeydew", - "uid": "cratedhoneydew" - } - } - ], - "cratedroyaljelly": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/royalJelly", - "uid": "cratedroyaljelly" - } - } - ], - "cratedhoneycombs": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/beecombs/honey", - "uid": "cratedhoneycombs" - } - } - ], - "cratedcocoacomb": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/beecombs/cocoa", - "uid": "cratedcocoacomb" - } - } - ], - "cratedsimmeringcombs": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/beecombs/simmering", - "uid": "cratedsimmeringcombs" - } - } - ], - "cratedstringycombs": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/beecombs/stringy", - "uid": "cratedstringycombs" - } - } - ], - "cratedfrozencombs": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/beecombs/frozen", - "uid": "cratedfrozencombs" - } - } - ], - "crateddrippingcombs": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/beecombs/dripping", - "uid": "crateddrippingcombs" - } - } - ], - "cratedsilkycombs": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/beecombs/silky", - "uid": "cratedsilkycombs" - } - } - ], - "cratedparchedcombs": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/beecombs/parched", - "uid": "cratedparchedcombs" - } - } - ], - "cratedmysteriouscombs": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/beecombs/mysterious", - "uid": "cratedmysteriouscombs" - } - } - ], - "cratedpowderycombs": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/beecombs/powdery", - "uid": "cratedpowderycombs" - } - } - ], - "cratedwheatencombs": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/beecombs/wheaten", - "uid": "cratedwheatencombs" - } - } - ], - "cratedmossycombs": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/beecombs/mossy", - "uid": "cratedmossycombs" - } - } - ], - "cratedmellowcombs": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/beecombs/mellow", - "uid": "cratedmellowcombs" - } - } - ], - "cratedrefractorywax": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/refractoryWax", - "uid": "cratedrefractorywax" - } - } - ], - "cratedcherry": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/fruits/cherry", - "uid": "cratedcherry" - } - } - ], - "cratedwalnut": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/fruits/walnut", - "uid": "cratedwalnut" - } - } - ], - "cratedchestnut": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/fruits/chestnut", - "uid": "cratedchestnut" - } - } - ], - "cratedlemon": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/fruits/lemon", - "uid": "cratedlemon" - } - } - ], - "cratedplum": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/fruits/plum", - "uid": "cratedplum" - } - } - ], - "cratedpapaya": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/fruits/papaya", - "uid": "cratedpapaya" - } - } - ], - "crateddates": [ - { - "custom": { - "isItem": true, - "location": "forestry:item/fruits/dates", - "uid": "crateddates" - } - } - ], - "cratednetherbrick": [ - { - "custom": { - "location": "nether_brick#normal", - "uid": "cratednetherbrick" - } - } - ], - "cratednetherrack": [ - { - "custom": { - "location": "netherrack#normal", - "uid": "cratednetherrack" - } - } - ], - "cratedobsidian": [ - { - "custom": { - "location": "obsidian#normal", - "uid": "cratedobsidian" - } - } - ], - "cratedpodzol": [ - { - "custom": { - "location": "podzol#snowy=false", - "uid": "cratedpodzol" - } - } - ], - "cratedprismarine": [ - { - "custom": { - "location": "prismarine#normal", - "uid": "cratedprismarine" - } - } - ], - "cratedprismarinebrick": [ - { - "custom": { - "location": "prismarine_bricks#normal", - "uid": "cratedprismarinebrick" - } - } - ], - "cratedprismarinedark": [ - { - "custom": { - "location": "dark_prismarine#normal", - "uid": "cratedprismarinedark" - } - } - ], - "cratedredsand": [ - { - "custom": { - "location": "red_sand#normal", - "uid": "cratedredsand" - } - } - ], - "cratedsand": [ - { - "custom": { - "location": "sand#normal", - "uid": "cratedsand" - } - } - ], - "cratedsandstone": [ - { - "custom": { - "location": "sandstone#normal", - "uid": "cratedsandstone" - } - } - ], - "cratedsoulsand": [ - { - "custom": { - "location": "soul_sand#normal", - "uid": "cratedsoulsand" - } - } - ], - "cratedsprucewood": [ - { - "custom": { - "location": "spruce_log#axis=y", - "uid": "cratedsprucewood" - } - } - ], - "cratedstone": [ - { - "custom": { - "location": "stone#normal", - "uid": "cratedstone" - } - } - ], - "cratedwood": [ - { - "custom": { - "location": "oak_log#axis=y", - "uid": "cratedwood" - } - } - ] - } -} diff --git a/src/main/resources/assets/forestry/models/item/crate-filled.json b/src/main/resources/assets/forestry/models/item/crate-filled.json index 8c9d6f32b..a8b3ae3cb 100644 --- a/src/main/resources/assets/forestry/models/item/crate-filled.json +++ b/src/main/resources/assets/forestry/models/item/crate-filled.json @@ -2,5 +2,17 @@ "parent": "builtin/generated", "textures": { "layer0": "forestry:items/crate-filled" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } } }