diff --git a/MC18_notes.txt b/MC18_notes.txt index 15af37855..100a19167 100644 --- a/MC18_notes.txt +++ b/MC18_notes.txt @@ -1,25 +1,26 @@ -- API -- * Updated to BlockPos and EnumFacing everywhere where it made sense * Registering repainting blocks will need to also receive a PropertyEnum with EnumDyeColor as the component type -so Botania knows what property to set the color on (todo actually do this) +so Botania knows what property to set the color on * ICorporeaSpark.getInventory had to be changed to ICorporeaSpark.getSparkInventory because the signature clashed (IInventory vs ItemStack[], respectively) This can be changed to match vanilla signature, but either would break backward compat. * SubTileEntity.getComparatorInputOverride parameter removed (it was actually incorrect also. Not side, but the meta of the block). Anyways, vanilla removed it from their method so we follow suit. * SubTileEntity's methods that are copied from block (onBlockadded, etc.) updated to match vanilla counterparts -* Multiblock system reworked to use states +* Multiblock system reworked to use states and blockposes -- Other -- * Most things left untouched to make patches from upstream easier * Most uses of chunkcoordinates directly convert blockpos (THANK YOU VAZKII FOR USING THEM). Remove creation of extra instances since BlockPos'es are immutable and thus can be reused everywhere. -* Some really needed fields in EntityItem are private now. Reflection time :( -* Alfglass just uses the vanilla random model selection system to choose a pattern. Some of your builds may look different. +* Some really needed fields in EntityItem are private now. Reflection time :(. If this is a +* Alfglass now just uses the vanilla random model selection system to choose a pattern. Some of your builds may look different. Unless someone figures out a way to use the old one -- Todo -- -* Fix all the block signatures (easy) -* Fix all other low hanging errors (easy-med) -* Find all the block metadatas and give them all meaningful block states and properties (tedious/med-hard) * JSON models for everything (tedious/med-hard) -* Migrate the PlayerRender events (baubles, etc.) to LayerRenderers (med) \ No newline at end of file +* Migrate the PlayerRender events (baubles, etc.) to LayerRenderers (med) +* For rendering arbitrary icons (that DO NOT HAVE AN ITEM) in a 3D style (manaResource icons, etc.) + - Sub to texture stitch and bake our own model there to use? + - This remains the largest portion of what is left + - Where is the method to render an arbitrary baked model? \ No newline at end of file diff --git a/src/main/java/vazkii/botania/client/core/helper/IconHelper.java b/src/main/java/vazkii/botania/client/core/helper/IconHelper.java index 5481dfb43..88cb4e9ae 100644 --- a/src/main/java/vazkii/botania/client/core/helper/IconHelper.java +++ b/src/main/java/vazkii/botania/client/core/helper/IconHelper.java @@ -11,10 +11,13 @@ package vazkii.botania.client.core.helper; import net.minecraft.block.Block; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.IFlexibleBakedModel; import vazkii.botania.client.lib.LibResources; public final class IconHelper { @@ -59,4 +62,106 @@ public final class IconHelper { return forName(ir, item.getUnlocalizedName().replaceAll("item\\.", "") + s); } + private static String json + + /** + * Takes an icon, generates a "flat 3D" model in the style of held items. + * Used for rendering icons in 3D that have no item form + * @param sprite The texture to bake + * @return A baked model representing the flat 3D form of the given texture + */ + public IFlexibleBakedModel bakeModelFromIcon(TextureAtlasSprite sprite) { + + } + + /** + * From 1.7, takes a sprite and renders it in the "flat 3D" style of held items + * Use this ONLY for sprites that don't have a corresponding item! + * For items, use built in methods that use the bakedmodel since those are much more efficient + * Args: tess, maxu, minv, minu, maxv, width, height, thickness(?) + * todo 1.8 find a replacement for this method, possibly the above bakeModelFromIcon + */ + public static void renderItemIn2D(Tessellator tess, float p_78439_1_, float p_78439_2_, float p_78439_3_, float p_78439_4_, int width, int height, float p_78439_7_) + { + WorldRenderer wr = tess.getWorldRenderer(); + wr.startDrawingQuads(); + wr.setNormal(0.0F, 0.0F, 1.0F); + wr.addVertexWithUV(0.0D, 0.0D, 0.0D, (double)p_78439_1_, (double)p_78439_4_); + wr.addVertexWithUV(1.0D, 0.0D, 0.0D, (double)p_78439_3_, (double)p_78439_4_); + wr.addVertexWithUV(1.0D, 1.0D, 0.0D, (double)p_78439_3_, (double)p_78439_2_); + wr.addVertexWithUV(0.0D, 1.0D, 0.0D, (double)p_78439_1_, (double)p_78439_2_); + tess.draw(); + wr.startDrawingQuads(); + wr.setNormal(0.0F, 0.0F, -1.0F); + wr.addVertexWithUV(0.0D, 1.0D, (double)(0.0F - p_78439_7_), (double)p_78439_1_, (double)p_78439_2_); + wr.addVertexWithUV(1.0D, 1.0D, (double)(0.0F - p_78439_7_), (double)p_78439_3_, (double)p_78439_2_); + wr.addVertexWithUV(1.0D, 0.0D, (double)(0.0F - p_78439_7_), (double)p_78439_3_, (double)p_78439_4_); + wr.addVertexWithUV(0.0D, 0.0D, (double)(0.0F - p_78439_7_), (double)p_78439_1_, (double)p_78439_4_); + tess.draw(); + float f5 = 0.5F * (p_78439_1_ - p_78439_3_) / (float)width; + float f6 = 0.5F * (p_78439_4_ - p_78439_2_) / (float)height; + wr.startDrawingQuads(); + wr.setNormal(-1.0F, 0.0F, 0.0F); + int k; + float f7; + float f8; + + for (k = 0; k < width; ++k) + { + f7 = (float)k / (float)width; + f8 = p_78439_1_ + (p_78439_3_ - p_78439_1_) * f7 - f5; + wr.addVertexWithUV((double)f7, 0.0D, (double)(0.0F - p_78439_7_), (double)f8, (double)p_78439_4_); + wr.addVertexWithUV((double)f7, 0.0D, 0.0D, (double)f8, (double)p_78439_4_); + wr.addVertexWithUV((double)f7, 1.0D, 0.0D, (double)f8, (double)p_78439_2_); + wr.addVertexWithUV((double)f7, 1.0D, (double)(0.0F - p_78439_7_), (double)f8, (double)p_78439_2_); + } + + tess.draw(); + wr.startDrawingQuads(); + wr.setNormal(1.0F, 0.0F, 0.0F); + float f9; + + for (k = 0; k < width; ++k) + { + f7 = (float)k / (float)width; + f8 = p_78439_1_ + (p_78439_3_ - p_78439_1_) * f7 - f5; + f9 = f7 + 1.0F / (float)width; + wr.addVertexWithUV((double)f9, 1.0D, (double)(0.0F - p_78439_7_), (double)f8, (double)p_78439_2_); + wr.addVertexWithUV((double)f9, 1.0D, 0.0D, (double)f8, (double)p_78439_2_); + wr.addVertexWithUV((double)f9, 0.0D, 0.0D, (double)f8, (double)p_78439_4_); + wr.addVertexWithUV((double)f9, 0.0D, (double)(0.0F - p_78439_7_), (double)f8, (double)p_78439_4_); + } + + tess.draw(); + wr.startDrawingQuads(); + wr.setNormal(0.0F, 1.0F, 0.0F); + + for (k = 0; k < height; ++k) + { + f7 = (float)k / (float)height; + f8 = p_78439_4_ + (p_78439_2_ - p_78439_4_) * f7 - f6; + f9 = f7 + 1.0F / (float)height; + wr.addVertexWithUV(0.0D, (double)f9, 0.0D, (double)p_78439_1_, (double)f8); + wr.addVertexWithUV(1.0D, (double)f9, 0.0D, (double)p_78439_3_, (double)f8); + wr.addVertexWithUV(1.0D, (double)f9, (double)(0.0F - p_78439_7_), (double)p_78439_3_, (double)f8); + wr.addVertexWithUV(0.0D, (double)f9, (double)(0.0F - p_78439_7_), (double)p_78439_1_, (double)f8); + } + + tess.draw(); + wr.startDrawingQuads(); + wr.setNormal(0.0F, -1.0F, 0.0F); + + for (k = 0; k < height; ++k) + { + f7 = (float)k / (float)height; + f8 = p_78439_4_ + (p_78439_2_ - p_78439_4_) * f7 - f6; + wr.addVertexWithUV(1.0D, (double)f7, 0.0D, (double)p_78439_3_, (double)f8); + wr.addVertexWithUV(0.0D, (double)f7, 0.0D, (double)p_78439_1_, (double)f8); + wr.addVertexWithUV(0.0D, (double)f7, (double)(0.0F - p_78439_7_), (double)p_78439_1_, (double)f8); + wr.addVertexWithUV(1.0D, (double)f7, (double)(0.0F - p_78439_7_), (double)p_78439_3_, (double)f8); + } + + tess.draw(); + } + } \ No newline at end of file diff --git a/src/main/java/vazkii/botania/common/block/tile/TileSpawnerClaw.java b/src/main/java/vazkii/botania/common/block/tile/TileSpawnerClaw.java index f63a795a6..f20023109 100644 --- a/src/main/java/vazkii/botania/common/block/tile/TileSpawnerClaw.java +++ b/src/main/java/vazkii/botania/common/block/tile/TileSpawnerClaw.java @@ -10,6 +10,7 @@ */ package vazkii.botania.common.block.tile; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.List; @@ -43,66 +44,72 @@ public class TileSpawnerClaw extends TileMod implements IManaReceiver, IUpdatePl TileEntityMobSpawner spawner = (TileEntityMobSpawner) tileBelow; MobSpawnerBaseLogic logic = spawner.getSpawnerBaseLogic(); - if(!((Boolean) isActivated.invoke(logic))) { - if(!worldObj.isRemote) - mana -= 6; + try { + if(!((Boolean) isActivated.invoke(logic))) { + if(!worldObj.isRemote) + mana -= 6; - if(logic.getSpawnerWorld().isRemote) { - if(logic.spawnDelay > 0) - --logic.spawnDelay; + if(logic.getSpawnerWorld().isRemote) { + if(logic.spawnDelay > 0) + --logic.spawnDelay; - if(Math.random() > 0.5) - Botania.proxy.wispFX(worldObj, getPos().getX() + 0.3 + Math.random() * 0.5, getPos().getY() - 0.3 + Math.random() * 0.25, getPos().getZ() + Math.random(), 0.6F - (float) Math.random() * 0.3F, 0.1F, 0.6F - (float) Math.random() * 0.3F, (float) Math.random() / 3F, -0.025F - 0.005F * (float) Math.random(), 2F); + if(Math.random() > 0.5) + Botania.proxy.wispFX(worldObj, getPos().getX() + 0.3 + Math.random() * 0.5, getPos().getY() - 0.3 + Math.random() * 0.25, getPos().getZ() + Math.random(), 0.6F - (float) Math.random() * 0.3F, 0.1F, 0.6F - (float) Math.random() * 0.3F, (float) Math.random() / 3F, -0.025F - 0.005F * (float) Math.random(), 2F); - logic.prevMobRotation = logic.getMobRotation(); - logic.mobRotation = (logic.getMobRotation() + 1000.0F / (logic.spawnDelay + 200.0F)) % 360.0D; - } else if(logic.spawnDelay == -1) - resetTimer(logic); + logic.prevMobRotation = logic.getMobRotation(); + logic.mobRotation = (logic.getMobRotation() + 1000.0F / (logic.spawnDelay + 200.0F)) % 360.0D; + } else if(logic.spawnDelay == -1) + resetTimer(logic); - if(logic.spawnDelay > 0) { - --logic.spawnDelay; - return; - } + if(logic.spawnDelay > 0) { + --logic.spawnDelay; + return; + } - boolean flag = false; + boolean flag = false; - int spawnCount = ReflectionHelper.getPrivateValue(MobSpawnerBaseLogic.class, logic, LibObfuscation.SPAWN_COUNT); - int spawnRange = ReflectionHelper.getPrivateValue(MobSpawnerBaseLogic.class, logic, LibObfuscation.SPAWN_RANGE); - int maxNearbyEntities = ReflectionHelper.getPrivateValue(MobSpawnerBaseLogic.class, logic, LibObfuscation.MAX_NEARBY_ENTITIES); + int spawnCount = ReflectionHelper.getPrivateValue(MobSpawnerBaseLogic.class, logic, LibObfuscation.SPAWN_COUNT); + int spawnRange = ReflectionHelper.getPrivateValue(MobSpawnerBaseLogic.class, logic, LibObfuscation.SPAWN_RANGE); + int maxNearbyEntities = ReflectionHelper.getPrivateValue(MobSpawnerBaseLogic.class, logic, LibObfuscation.MAX_NEARBY_ENTITIES); - for(int i = 0; i < spawnCount; ++i) { - Entity entity = EntityList.createEntityByName(logic.getEntityNameToSpawn(), logic.getSpawnerWorld()); + for(int i = 0; i < spawnCount; ++i) { + Entity entity = EntityList.createEntityByName(logic.getEntityNameToSpawn(), logic.getSpawnerWorld()); - if (entity == null) - return; + if (entity == null) + return; - int j = logic.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), new AxisAlignedBB(logic.func_177221_b(), logic.func_177221_b().add(1, 1, 1)).expand(spawnRange * 2, 4.0D, spawnRange * 2)).size(); + int j = logic.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), new AxisAlignedBB(logic.func_177221_b(), logic.func_177221_b().add(1, 1, 1)).expand(spawnRange * 2, 4.0D, spawnRange * 2)).size(); - if (j >= maxNearbyEntities) { - resetTimer(logic); - return; - } + if (j >= maxNearbyEntities) { + resetTimer(logic); + return; + } - double d2 = logic.func_177221_b().getX() + (logic.getSpawnerWorld().rand.nextDouble() - logic.getSpawnerWorld().rand.nextDouble()) * spawnRange; - double d3 = logic.func_177221_b().getY() + logic.getSpawnerWorld().rand.nextInt(3) - 1; - double d4 = logic.func_177221_b().getZ() + (logic.getSpawnerWorld().rand.nextDouble() - logic.getSpawnerWorld().rand.nextDouble()) * spawnRange; - EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; - entity.setLocationAndAngles(d2, d3, d4, logic.getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F); + double d2 = logic.func_177221_b().getX() + (logic.getSpawnerWorld().rand.nextDouble() - logic.getSpawnerWorld().rand.nextDouble()) * spawnRange; + double d3 = logic.func_177221_b().getY() + logic.getSpawnerWorld().rand.nextInt(3) - 1; + double d4 = logic.func_177221_b().getZ() + (logic.getSpawnerWorld().rand.nextDouble() - logic.getSpawnerWorld().rand.nextDouble()) * spawnRange; + EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; + entity.setLocationAndAngles(d2, d3, d4, logic.getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F); - if(entityliving == null || entityliving.getCanSpawnHere()) { - if(!worldObj.isRemote) - logic.func_98265_a(entity); - logic.getSpawnerWorld().playAuxSFX(2004, logic.func_177221_b(), 0); + if(entityliving == null || entityliving.getCanSpawnHere()) { + if(!worldObj.isRemote) + logic.func_98265_a(entity); + logic.getSpawnerWorld().playAuxSFX(2004, logic.func_177221_b(), 0); - if (entityliving != null) - entityliving.spawnExplosionParticle(); + if (entityliving != null) + entityliving.spawnExplosionParticle(); - flag = true; - } - } + flag = true; + } + } - if (flag) - resetTimer(logic); + if (flag) + resetTimer(logic); + } + } catch (IllegalAccessException e) { + Botania.instance.handleIMC(); + } catch (InvocationTargetException e) { + e.printStackTrace(); } } } diff --git a/src/main/java/vazkii/botania/common/core/helper/Vector3.java b/src/main/java/vazkii/botania/common/core/helper/Vector3.java index 6028af953..56c9f1bc3 100644 --- a/src/main/java/vazkii/botania/common/core/helper/Vector3.java +++ b/src/main/java/vazkii/botania/common/core/helper/Vector3.java @@ -17,6 +17,7 @@ import java.math.RoundingMode; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; import net.minecraft.util.Vec3; import org.lwjgl.opengl.GL11; @@ -61,20 +62,24 @@ public class Vector3 return new Vector3(this); } + public static Vector3 fromBlockPos(BlockPos pos) { + return new Vector3(pos.getX(), pos.getY(), pos.getZ()); + } + public static Vector3 fromEntity(Entity e) { return new Vector3(e.posX, e.posY, e.posZ); } public static Vector3 fromEntityCenter(Entity e) { - return new Vector3(e.posX, e.posY - e.yOffset + e.height / 2, e.posZ); + return new Vector3(e.posX, e.posY - /*e.yOffset todo 1.8 */ 0 + e.height / 2, e.posZ); } public static Vector3 fromTileEntity(TileEntity e) { - return new Vector3(e.xCoord, e.yCoord, e.zCoord); + return fromBlockPos(e.getPos()); } public static Vector3 fromTileEntityCenter(TileEntity e) { - return new Vector3(e.xCoord + 0.5, e.yCoord + 0.5, e.zCoord + 0.5); + return fromTileEntity(e).add(0.5); } public Vector3 set(double d, double d1, double d2) { diff --git a/src/main/java/vazkii/botania/common/crafting/ModPureDaisyRecipes.java b/src/main/java/vazkii/botania/common/crafting/ModPureDaisyRecipes.java index eb846ed31..bcf6a78c5 100644 --- a/src/main/java/vazkii/botania/common/crafting/ModPureDaisyRecipes.java +++ b/src/main/java/vazkii/botania/common/crafting/ModPureDaisyRecipes.java @@ -18,14 +18,14 @@ import vazkii.botania.common.lib.LibOreDict; public final class ModPureDaisyRecipes { public static void init() { - BotaniaAPI.registerPureDaisyRecipe("stone", ModBlocks.livingrock, 0); - BotaniaAPI.registerPureDaisyRecipe("logWood", ModBlocks.livingwood, 0); + BotaniaAPI.registerPureDaisyRecipe("stone", ModBlocks.livingrock.getDefaultState()); + BotaniaAPI.registerPureDaisyRecipe("logWood", ModBlocks.livingwood.getDefaultState()); - BotaniaAPI.registerPureDaisyRecipe("netherrack", Blocks.cobblestone, 0); - BotaniaAPI.registerPureDaisyRecipe("soulSand", Blocks.sand, 0); - BotaniaAPI.registerPureDaisyRecipe("ice", Blocks.packed_ice, 0); - BotaniaAPI.registerPureDaisyRecipe(LibOreDict.BLAZE_BLOCK, Blocks.obsidian, 0); - BotaniaAPI.registerPureDaisyRecipe(Blocks.water, Blocks.snow, 0); + BotaniaAPI.registerPureDaisyRecipe("netherrack", Blocks.cobblestone.getDefaultState()); + BotaniaAPI.registerPureDaisyRecipe("soulSand", Blocks.sand.getDefaultState()); + BotaniaAPI.registerPureDaisyRecipe("ice", Blocks.packed_ice.getDefaultState()); + BotaniaAPI.registerPureDaisyRecipe(LibOreDict.BLAZE_BLOCK, Blocks.obsidian.getDefaultState()); + BotaniaAPI.registerPureDaisyRecipe(Blocks.water, Blocks.snow.getDefaultState()); } } diff --git a/src/main/java/vazkii/botania/common/item/equipment/armor/terrasteel/ItemTerrasteelHelm.java b/src/main/java/vazkii/botania/common/item/equipment/armor/terrasteel/ItemTerrasteelHelm.java index 4f4d62bb0..e8eecdbb4 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/armor/terrasteel/ItemTerrasteelHelm.java +++ b/src/main/java/vazkii/botania/common/item/equipment/armor/terrasteel/ItemTerrasteelHelm.java @@ -16,7 +16,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; @@ -24,7 +23,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderPlayerEvent; @@ -124,7 +122,7 @@ public class ItemTerrasteelHelm extends ItemTerrasteelArmor implements IManaDisc GlStateManager.rotate(180F, 1F, 0F, 0F); GlStateManager.translate(-0.26F, 0.15F, -0.39F); GlStateManager.scale(0.5F, 0.5F, 0.5F); - ItemRenderer.renderItemIn2D(Tessellator.getInstance(), f1, f2, f, f3, willIcon.getIconWidth(), willIcon.getIconHeight(), 1F / 16F); + IconHelper.renderItemIn2D(Tessellator.getInstance(), f1, f2, f, f3, willIcon.getIconWidth(), willIcon.getIconHeight(), 1F / 16F); GlStateManager.popMatrix(); } } diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemHolyCloak.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemHolyCloak.java index b0797ca33..b88b0a717 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemHolyCloak.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemHolyCloak.java @@ -12,6 +12,7 @@ package vazkii.botania.common.item.equipment.bauble; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemIcePendant.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemIcePendant.java index 03f6ce547..43915808e 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemIcePendant.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemIcePendant.java @@ -18,6 +18,7 @@ import java.util.Map; import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.IIconRegister; @@ -113,7 +114,7 @@ public class ItemIcePendant extends ItemBauble implements IBaubleRender { @Override public void onPlayerBaubleRender(ItemStack stack, RenderPlayerEvent event, RenderType type) { if(type == RenderType.BODY) { - Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); + Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); Helper.rotateIfSneaking(event.entityPlayer); boolean armor = event.entityPlayer.getCurrentArmor(2) != null; GlStateManager.rotate(180F, 1F, 0F, 0F); diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemItemFinder.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemItemFinder.java index fa44d39e3..5ded3be7f 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemItemFinder.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemItemFinder.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.IIconRegister; @@ -221,7 +222,7 @@ public class ItemItemFinder extends ItemBauble implements IBaubleRender { float f3 = gemIcon.getMaxV(); boolean armor = event.entityPlayer.getCurrentArmor(3) != null; Helper.translateToHeadLevel(event.entityPlayer); - Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); + Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); GlStateManager.rotate(90F, 0F, 1F, 0F); GlStateManager.rotate(180F, 1F, 0F, 0F); GlStateManager.translate(-0.4F, 0.1F, armor ? -0.3F : -0.25F); diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemSuperLavaPendant.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemSuperLavaPendant.java index 4787c2470..4e1171c70 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemSuperLavaPendant.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemSuperLavaPendant.java @@ -11,6 +11,7 @@ package vazkii.botania.common.item.equipment.bauble; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.IIconRegister; diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemTinyPlanet.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemTinyPlanet.java index 5bcfc272e..e58917198 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemTinyPlanet.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemTinyPlanet.java @@ -13,7 +13,7 @@ package vazkii.botania.common.item.equipment.bauble; import java.util.List; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -108,7 +108,8 @@ public class ItemTinyPlanet extends ItemBauble implements IBaubleRender { Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); GlStateManager.translate(0.25F, -0.5F, 0F); GlStateManager.scale(0.5F, 0.5F, 0.5F); - RenderBlocks.getInstance().renderBlockAsItem(ModBlocks.tinyPlanet, 0, 1F); + Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlockBrightness(ModBlocks.tinyPlanet.getDefaultState(), 1.0F); +// RenderBlocks.getInstance().renderBlockAsItem(ModBlocks.tinyPlanet, 0, 1F); todo 1.8 } } diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemTravelBelt.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemTravelBelt.java index 441150355..6ee95b1bc 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemTravelBelt.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemTravelBelt.java @@ -16,6 +16,7 @@ import java.util.List; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/vazkii/botania/common/item/material/ItemManaResource.java b/src/main/java/vazkii/botania/common/item/material/ItemManaResource.java index b2e5e90bf..f23181ff7 100644 --- a/src/main/java/vazkii/botania/common/item/material/ItemManaResource.java +++ b/src/main/java/vazkii/botania/common/item/material/ItemManaResource.java @@ -26,6 +26,7 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; +import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; @@ -62,6 +63,15 @@ public class ItemManaResource extends ItemMod implements IFlowerComponent, IElve MinecraftForge.EVENT_BUS.register(this); } + @SubscribeEvent + @SideOnly(Side.CLIENT) + public void onTextureStitch(TextureStitchEvent.Pre evt) { + tailIcon = IconHelper.forName(evt.map, "tail"); + phiFlowerIcon = IconHelper.forName(evt.map, "phiFlower"); + goldfishIcon = IconHelper.forName(evt.map, "goldfish"); + nerfBatIcon = IconHelper.forName(evt.map, "nerfBat"); + } + @SubscribeEvent public void onPlayerInteract(PlayerInteractEvent event) { boolean rightEvent = event.action == Action.RIGHT_CLICK_AIR; @@ -128,19 +138,6 @@ public class ItemManaResource extends ItemMod implements IFlowerComponent, IElve par3List.add(new ItemStack(par1, 1, i)); } - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - icons = new IIcon[types]; - for(int i = 0; i < icons.length; i++) - icons[i] = IconHelper.forName(par1IconRegister, LibItemNames.MANA_RESOURCE_NAMES[i]); - - tailIcon = IconHelper.forName(par1IconRegister, "tail"); - phiFlowerIcon = IconHelper.forName(par1IconRegister, "phiFlower"); - goldfishIcon = IconHelper.forName(par1IconRegister, "goldfish"); - nerfBatIcon = IconHelper.forName(par1IconRegister, "nerfBat"); - } - @Override @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { diff --git a/src/main/java/vazkii/botania/common/item/rod/ItemTornadoRod.java b/src/main/java/vazkii/botania/common/item/rod/ItemTornadoRod.java index 96da44966..878840508 100644 --- a/src/main/java/vazkii/botania/common/item/rod/ItemTornadoRod.java +++ b/src/main/java/vazkii/botania/common/item/rod/ItemTornadoRod.java @@ -104,10 +104,10 @@ public class ItemTornadoRod extends ItemMod implements IManaUsingItem, IAvatarWi } - @Override - public IIcon getIconIndex(ItemStack par1ItemStack) { - return isFlying(par1ItemStack) ? iconFlying : iconIdle; - } +// @Override todo 1.8 +// public IIcon getIconIndex(ItemStack par1ItemStack) { +// return isFlying(par1ItemStack) ? iconFlying : iconIdle; +// } @Override public EnumAction getItemUseAction(ItemStack par1ItemStack) { @@ -119,12 +119,6 @@ public class ItemTornadoRod extends ItemMod implements IManaUsingItem, IAvatarWi return 720000; } - @Override - public void registerIcons(IIconRegister par1IconRegister) { - iconIdle = IconHelper.forItem(par1IconRegister, this, 0); - iconFlying = IconHelper.forItem(par1IconRegister, this, 1); - } - public boolean isFlying(ItemStack stack) { return ItemNBTHelper.getBoolean(stack, TAG_FLYING, false); } @@ -150,7 +144,7 @@ public class ItemTornadoRod extends ItemMod implements IManaUsingItem, IAvatarWi if(tile.getCurrentMana() >= COST && tile.isEnabled()) { int range = 5; int rangeY = 3; - List players = world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(te.xCoord + 0.5 - range, te.yCoord + 0.5 - rangeY, te.zCoord + 0.5 - range, te.xCoord + 0.5 + range, te.yCoord + 0.5 + rangeY, te.zCoord + 0.5 + range)); + List players = world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(te.getPos().add(-0.5 + range, -0.5 + rangeY, -0.5 + range), te.getPos().add(0.5 + range, 0.5 + rangeY, 0.5 + range))); for(EntityPlayer p : players) { if(p.motionY > 0.3 && p.motionY < 2 && !p.isSneaking()) { p.motionY = 2.8;