diff --git a/src/main/java/vazkii/botania/api/subtile/SubTileEntity.java b/src/main/java/vazkii/botania/api/subtile/SubTileEntity.java index e98186e83..73c4b0c80 100644 --- a/src/main/java/vazkii/botania/api/subtile/SubTileEntity.java +++ b/src/main/java/vazkii/botania/api/subtile/SubTileEntity.java @@ -133,7 +133,7 @@ public class SubTileEntity { /** * Called when a player right clicks this sub tile. */ - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) { return false; } + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { return false; } /** * Called when this sub tile is added to the world. diff --git a/src/main/java/vazkii/botania/client/render/entity/RenderCorporeaSpark.java b/src/main/java/vazkii/botania/client/render/entity/RenderCorporeaSpark.java index 72c14ad6b..46a51ffea 100644 --- a/src/main/java/vazkii/botania/client/render/entity/RenderCorporeaSpark.java +++ b/src/main/java/vazkii/botania/client/render/entity/RenderCorporeaSpark.java @@ -62,7 +62,7 @@ public class RenderCorporeaSpark extends RenderSparkBase { float absTime = Math.abs(time) - pticks; - ItemStack stack = entity.getDisplayedItem().or(ItemStack.EMPTY); + ItemStack stack = entity.getDisplayedItem(); if(stack.isEmpty()) return; diff --git a/src/main/java/vazkii/botania/client/render/tile/RenderTileStarfield.java b/src/main/java/vazkii/botania/client/render/tile/RenderTileStarfield.java index db0dd8032..31ef153ad 100644 --- a/src/main/java/vazkii/botania/client/render/tile/RenderTileStarfield.java +++ b/src/main/java/vazkii/botania/client/render/tile/RenderTileStarfield.java @@ -32,121 +32,206 @@ public class RenderTileStarfield extends TileEntitySpecialRenderer= 1) + if (j >= 1) { - bindTexture(END_PORTAL_TEXTURE); + this.bindTexture(END_PORTAL_TEXTURE); + flag = true; + Minecraft.getMinecraft().entityRenderer.func_191514_d(true); } - if (i == 1) + if (j == 1) { GlStateManager.enableBlend(); - GlStateManager.blendFunc(1, 1); - f5 = 0.5F; + GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); } - float f7 = (float)-(y + f3); - float f8 = f7 + (float)ActiveRenderInfo.getPosition().yCoord; - float f9 = f7 + f4 + (float)ActiveRenderInfo.getPosition().yCoord; - float f10 = f8 / f9; - f10 = (float)(y + f3) + f10; - GlStateManager.translate(f, f10, f2); - GlStateManager.texGen(GlStateManager.TexGen.S, 9217); - GlStateManager.texGen(GlStateManager.TexGen.T, 9217); - GlStateManager.texGen(GlStateManager.TexGen.R, 9217); - GlStateManager.texGen(GlStateManager.TexGen.Q, 9216); - GlStateManager.texGen(GlStateManager.TexGen.S, 9473, func_147525_a(1.0F, 0.0F, 0.0F, 0.0F)); - GlStateManager.texGen(GlStateManager.TexGen.T, 9473, func_147525_a(0.0F, 0.0F, 1.0F, 0.0F)); - GlStateManager.texGen(GlStateManager.TexGen.R, 9473, func_147525_a(0.0F, 0.0F, 0.0F, 1.0F)); - GlStateManager.texGen(GlStateManager.TexGen.Q, 9474, func_147525_a(0.0F, 1.0F, 0.0F, 0.0F)); + GlStateManager.texGen(GlStateManager.TexGen.S, 9216); + GlStateManager.texGen(GlStateManager.TexGen.T, 9216); + GlStateManager.texGen(GlStateManager.TexGen.R, 9216); + GlStateManager.texGen(GlStateManager.TexGen.S, 9474, this.getBuffer(1.0F, 0.0F, 0.0F, 0.0F)); + GlStateManager.texGen(GlStateManager.TexGen.T, 9474, this.getBuffer(0.0F, 1.0F, 0.0F, 0.0F)); + GlStateManager.texGen(GlStateManager.TexGen.R, 9474, this.getBuffer(0.0F, 0.0F, 1.0F, 0.0F)); GlStateManager.enableTexGenCoord(GlStateManager.TexGen.S); GlStateManager.enableTexGenCoord(GlStateManager.TexGen.T); GlStateManager.enableTexGenCoord(GlStateManager.TexGen.R); - GlStateManager.enableTexGenCoord(GlStateManager.TexGen.Q); GlStateManager.popMatrix(); GlStateManager.matrixMode(5890); GlStateManager.pushMatrix(); GlStateManager.loadIdentity(); - GlStateManager.translate(0.0F, Minecraft.getSystemTime() % 20000 / 20000.0F, 0.0F); - GlStateManager.scale(f5, f5, f5); GlStateManager.translate(0.5F, 0.5F, 0.0F); - GlStateManager.rotate((i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F); - GlStateManager.translate(-0.5F, -0.5F, 0.0F); - GlStateManager.translate(-f, -f2, -f1); - f8 = f7 + (float)ActiveRenderInfo.getPosition().yCoord; - GlStateManager.translate((float)ActiveRenderInfo.getPosition().xCoord * f4 / f8, (float)ActiveRenderInfo.getPosition().zCoord * f4 / f8, -f1); + GlStateManager.scale(0.5F, 0.5F, 1.0F); + float f2 = (float)(j + 1); + GlStateManager.translate(17.0F / f2, (2.0F + f2 / 1.5F) * ((float)Minecraft.getSystemTime() % 800000.0F / 800000.0F), 0.0F); + GlStateManager.rotate((f2 * f2 * 4321.0F + f2 * 9.0F) * 2.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.scale(4.5F - f2 / 4.0F, 4.5F - f2 / 4.0F, 1.0F); + GlStateManager.multMatrix(PROJECTION); + GlStateManager.multMatrix(MODELVIEW); Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer worldrenderer = tessellator.getBuffer(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); - float f11 = (field_147527_e.nextFloat() * 0.5F + 0.1F) * f6; - float f12 = (field_147527_e.nextFloat() * 0.5F + 0.4F) * f6; - float f13 = (field_147527_e.nextFloat() * 0.5F + 0.5F) * f6; - - if (i == 0) - { - f11 = f12 = 1.0F * f6; - } + VertexBuffer vertexbuffer = tessellator.getBuffer(); + vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR); + float f3 = (RANDOM.nextFloat() * 0.5F + 0.1F) * f1; + float f4 = (RANDOM.nextFloat() * 0.5F + 0.4F) * f1; + float f5 = (RANDOM.nextFloat() * 0.5F + 0.5F) * f1; // Botania: change color based on time Color color = Color.getHSBColor(Minecraft.getSystemTime() / 20F % 360 / 360F, 1F, 1F); - f11 = color.getRed() / 255F; - f12 = color.getGreen() / 255F; - f13 = color.getBlue() / 255F; + f3 = color.getRed() / 255F; + f4 = color.getGreen() / 255F; + f5 = color.getBlue() / 255F; - f11 *= f6; f12 *= f6; f13 *= f6; + f3 *= f1; f4 *= f1; f5 *= f1; + + /* Botania - don't render other faces + if (te.shouldRenderFace(EnumFacing.SOUTH)) + { + vertexbuffer.pos(x, y, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x + 1.0D, y, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x + 1.0D, y + 1.0D, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x, y + 1.0D, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); + } + + if (te.shouldRenderFace(EnumFacing.NORTH)) + { + vertexbuffer.pos(x, y + 1.0D, z).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x + 1.0D, y + 1.0D, z).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x + 1.0D, y, z).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x, y, z).color(f3, f4, f5, 1.0F).endVertex(); + } + + if (te.shouldRenderFace(EnumFacing.EAST)) + { + vertexbuffer.pos(x + 1.0D, y + 1.0D, z).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x + 1.0D, y + 1.0D, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x + 1.0D, y, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x + 1.0D, y, z).color(f3, f4, f5, 1.0F).endVertex(); + } + + if (te.shouldRenderFace(EnumFacing.WEST)) + { + vertexbuffer.pos(x, y, z).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x, y, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x, y + 1.0D, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x, y + 1.0D, z).color(f3, f4, f5, 1.0F).endVertex(); + } + + if (te.shouldRenderFace(EnumFacing.DOWN)) + { + vertexbuffer.pos(x, y, z).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x + 1.0D, y, z).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x + 1.0D, y, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x, y, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); + }*/ + + // Botania - always render up face if (te.shouldRenderFace(EnumFacing.UP)) + { + vertexbuffer.pos(x, y + (double)f, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x + 1.0D, y + (double)f, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x + 1.0D, y + (double)f, z).color(f3, f4, f5, 1.0F).endVertex(); + vertexbuffer.pos(x, y + (double)f, z).color(f3, f4, f5, 1.0F).endVertex(); + } - worldrenderer.pos(x, y + f3, z).color(f11, f12, f13, 1.0F).endVertex(); - worldrenderer.pos(x, y + f3, z + 1.0D).color(f11, f12, f13, 1.0F).endVertex(); - worldrenderer.pos(x + 1.0D, y + f3, z + 1.0D).color(f11, f12, f13, 1.0F).endVertex(); - worldrenderer.pos(x + 1.0D, y + f3, z).color(f11, f12, f13, 1.0F).endVertex(); tessellator.draw(); GlStateManager.popMatrix(); GlStateManager.matrixMode(5888); - bindTexture(END_SKY_TEXTURE); + this.bindTexture(END_SKY_TEXTURE); } GlStateManager.disableBlend(); GlStateManager.disableTexGenCoord(GlStateManager.TexGen.S); GlStateManager.disableTexGenCoord(GlStateManager.TexGen.T); GlStateManager.disableTexGenCoord(GlStateManager.TexGen.R); - GlStateManager.disableTexGenCoord(GlStateManager.TexGen.Q); GlStateManager.enableLighting(); + + if (flag) + { + Minecraft.getMinecraft().entityRenderer.func_191514_d(false); + } } - private FloatBuffer func_147525_a(float p_147525_1_, float p_147525_2_, float p_147525_3_, float p_147525_4_) + private int getPasses(double p_191286_1_) { - field_147528_b.clear(); - field_147528_b.put(p_147525_1_).put(p_147525_2_).put(p_147525_3_).put(p_147525_4_); - field_147528_b.flip(); - return field_147528_b; + int i; + + if (p_191286_1_ > 36864.0D) + { + i = 1; + } + else if (p_191286_1_ > 25600.0D) + { + i = 3; + } + else if (p_191286_1_ > 16384.0D) + { + i = 5; + } + else if (p_191286_1_ > 9216.0D) + { + i = 7; + } + else if (p_191286_1_ > 4096.0D) + { + i = 9; + } + else if (p_191286_1_ > 1024.0D) + { + i = 11; + } + else if (p_191286_1_ > 576.0D) + { + i = 13; + } + else if (p_191286_1_ > 256.0D) + { + i = 14; + } + else + { + i = 15; + } + + return i; + } + + private float getOffset() + { + return 0.24F; // Botania: move to bottom of block space + } + + private FloatBuffer getBuffer(float p_147525_1_, float p_147525_2_, float p_147525_3_, float p_147525_4_) + { + this.buffer.clear(); + this.buffer.put(p_147525_1_).put(p_147525_2_).put(p_147525_3_).put(p_147525_4_); + this.buffer.flip(); + return this.buffer; } } diff --git a/src/main/java/vazkii/botania/common/block/BlockFloatingSpecialFlower.java b/src/main/java/vazkii/botania/common/block/BlockFloatingSpecialFlower.java index fee9ee864..2496fdd9a 100644 --- a/src/main/java/vazkii/botania/common/block/BlockFloatingSpecialFlower.java +++ b/src/main/java/vazkii/botania/common/block/BlockFloatingSpecialFlower.java @@ -195,8 +195,8 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) { - return ((TileSpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, stack, side, hitX, hitY, hitZ) || super.onBlockActivated(world, pos, state, player, hand, stack, side, hitX, hitY, hitZ); + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { + return ((TileSpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, side, hitX, hitY, hitZ) || super.onBlockActivated(world, pos, state, player, hand, side, hitX, hitY, hitZ); } @Override diff --git a/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java b/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java index dc95651de..f0a69e711 100644 --- a/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java +++ b/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java @@ -335,7 +335,7 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I return true; } - return ((TileSpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, stack, side, hitX, hitY, hitZ); + return ((TileSpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, side, hitX, hitY, hitZ); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/vazkii/botania/common/block/tile/TileSpecialFlower.java b/src/main/java/vazkii/botania/common/block/tile/TileSpecialFlower.java index bd99e2726..4774dee89 100644 --- a/src/main/java/vazkii/botania/common/block/tile/TileSpecialFlower.java +++ b/src/main/java/vazkii/botania/common/block/tile/TileSpecialFlower.java @@ -146,8 +146,8 @@ public class TileSpecialFlower extends TileMod implements IWandBindable, ISubTil subTile.onBlockPlacedBy(world, pos, state, entity, stack); } - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) { - return subTile == null ? false : subTile.onBlockActivated(world, pos, state, player, hand, stack, side, hitX, hitY, hitZ); + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { + return subTile == null ? false : subTile.onBlockActivated(world, pos, state, player, hand, side, hitX, hitY, hitZ); } public void onBlockAdded(World world, BlockPos pos, IBlockState state) { diff --git a/src/main/java/vazkii/botania/common/lib/LibObfuscation.java b/src/main/java/vazkii/botania/common/lib/LibObfuscation.java index 9ce31e075..f6d2adb93 100644 --- a/src/main/java/vazkii/botania/common/lib/LibObfuscation.java +++ b/src/main/java/vazkii/botania/common/lib/LibObfuscation.java @@ -12,9 +12,6 @@ package vazkii.botania.common.lib; public final class LibObfuscation { - // EntityHorse - public static final String[] INIT_HORSE_CHEST = { "initHorseChest", "func_110226_cD", "dJ" }; - // RenderManager public static final String[] RENDERPOSX = { "renderPosX", "field_78725_b", "o" }; public static final String[] RENDERPOSY = { "renderPosY", "field_78726_c", "p" }; @@ -47,7 +44,7 @@ public final class LibObfuscation { public static final String[] ITEM_IN_USE_COUNT = { "activeItemStackUseCount", "field_184628_bn", "bn" }; // EntityHorse - public static final String[] HORSE_JUMP_STRENGTH = { "JUMP_STRENGTH", "field_110271_bv", "bC" }; + public static final String[] HORSE_JUMP_STRENGTH = { "JUMP_STRENGTH", "field_110271_bv", "bw" }; // PlayerControllerMP public static final String[] NET_CLIENT_HANDLER = { "connection", "field_78774_b", "b" };