diff --git a/src/main/java/appeng/client/ClientHelper.java b/src/main/java/appeng/client/ClientHelper.java index d3dde905..b6d924d7 100644 --- a/src/main/java/appeng/client/ClientHelper.java +++ b/src/main/java/appeng/client/ClientHelper.java @@ -48,12 +48,14 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.event.MouseEvent; import net.minecraftforge.client.event.RenderLivingEvent; +import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import appeng.api.parts.CableRenderMode; import appeng.api.util.AEColor; import appeng.block.AEBaseBlock; +import appeng.client.render.textures.ParticleTextures; import appeng.client.render.effects.AssemblerFX; import appeng.client.render.effects.CraftingFx; import appeng.client.render.effects.EnergyFx; @@ -115,7 +117,7 @@ public class ClientHelper extends ServerHelper { if( feature instanceof AEBaseBlock ) { - Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler( new AEBaseBlockColor(), ( Block ) feature ); + Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler( new AEBaseBlockColor(), (Block) feature ); } } @@ -138,7 +140,7 @@ public class ClientHelper extends ServerHelper @Override public void bindTileEntitySpecialRenderer( final Class tile, final AEBaseBlock blk ) { - + } @Override @@ -404,6 +406,12 @@ public class ClientHelper extends ServerHelper } } + @SubscribeEvent + public void onTextureStitch( final TextureStitchEvent.Pre event ) + { + ParticleTextures.registerSprite( event ); + } + private static class IconReg { public final String name; @@ -428,6 +436,7 @@ public class ClientHelper extends ServerHelper } } + public static class AEBaseBlockColor implements IBlockColor { @@ -436,16 +445,16 @@ public class ClientHelper extends ServerHelper { return tintIndex; } - } + public class ItemPaintBallColor implements IItemColor { @Override public int getColorFromItemstack( ItemStack stack, int tintIndex ) { - final AEColor col = ( ( ItemPaintBall ) stack.getItem() ).getColor( stack ); + final AEColor col = ( (ItemPaintBall) stack.getItem() ).getColor( stack ); final int colorValue = stack.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant; final int r = ( colorValue >> 16 ) & 0xff; @@ -463,6 +472,5 @@ public class ClientHelper extends ServerHelper return r << 16 | g << 8 | b | 0xff << 24; } } - } } \ No newline at end of file diff --git a/src/main/java/appeng/client/render/effects/CraftingFx.java b/src/main/java/appeng/client/render/effects/CraftingFx.java index 4126c907..1df37528 100644 --- a/src/main/java/appeng/client/render/effects/CraftingFx.java +++ b/src/main/java/appeng/client/render/effects/CraftingFx.java @@ -30,6 +30,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import appeng.api.util.AEPartLocation; +import appeng.client.render.textures.ParticleTextures; @SideOnly( Side.CLIENT ) @@ -51,8 +52,7 @@ public class CraftingFx extends ParticleBreaking this.particleRed = 1; this.particleAlpha = 1.3f; this.particleScale = 1.5f; - //TODO 1.10-R - Find exact atlas it was holding and replace this broken code with the atlas. - this.particleTextureIndex = ExtraBlockTextures.BlockEnergyParticle.getIcon().getAtlas(); + this.particleTextureIndex = ParticleTextures.BlockEnergyParticle; this.particleMaxAge /= 1.2; this.startBlkX = MathHelper.floor_double( this.posX ); @@ -114,19 +114,19 @@ public class CraftingFx extends ParticleBreaking public void onUpdate() { this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; - if (this.particleAge++ >= this.particleMaxAge) - { - this.setExpired(); - } + if( this.particleAge++ >= this.particleMaxAge ) + { + this.setExpired(); + } - this.motionY -= 0.04D * (double)this.particleGravity; - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.9800000190734863D; - this.motionY *= 0.9800000190734863D; - this.motionZ *= 0.9800000190734863D; + this.motionY -= 0.04D * (double) this.particleGravity; + this.moveEntity( this.motionX, this.motionY, this.motionZ ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; this.particleScale *= 0.51f; this.particleAlpha *= 0.51f; } diff --git a/src/main/java/appeng/client/render/effects/EnergyFx.java b/src/main/java/appeng/client/render/effects/EnergyFx.java index 645d5028..a2a54f2e 100644 --- a/src/main/java/appeng/client/render/effects/EnergyFx.java +++ b/src/main/java/appeng/client/render/effects/EnergyFx.java @@ -30,6 +30,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import appeng.api.util.AEPartLocation; +import appeng.client.render.textures.ParticleTextures; @SideOnly( Side.CLIENT ) @@ -51,8 +52,7 @@ public class EnergyFx extends ParticleBreaking this.particleRed = 255; this.particleAlpha = 1.4f; this.particleScale = 3.5f; - //TODO 1.10-R - Find exact atlas it was holding and replace this broken code with the atlas. - this.particleTextureIndex = ExtraBlockTextures.BlockEnergyParticle.getIcon().getAtlas(); + this.particleTextureIndex = ParticleTextures.BlockEnergyParticle; this.startBlkX = MathHelper.floor_double( this.posX ); this.startBlkY = MathHelper.floor_double( this.posY ); @@ -104,22 +104,22 @@ public class EnergyFx extends ParticleBreaking public void onUpdate() { this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; - if (this.particleAge++ >= this.particleMaxAge) - { - this.setExpired(); - } + if( this.particleAge++ >= this.particleMaxAge ) + { + this.setExpired(); + } - this.motionY -= 0.04D * (double)this.particleGravity; - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.9800000190734863D; - this.motionY *= 0.9800000190734863D; - this.motionZ *= 0.9800000190734863D; + this.motionY -= 0.04D * (double) this.particleGravity; + this.moveEntity( this.motionX, this.motionY, this.motionZ ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; - this.particleScale *= 0.89f; - this.particleAlpha *= 0.89f; + this.particleScale *= 0.89f; + this.particleAlpha *= 0.89f; } public void setMotionX( float motionX ) diff --git a/src/main/java/appeng/client/render/effects/MatterCannonFX.java b/src/main/java/appeng/client/render/effects/MatterCannonFX.java index eed0e035..aaea7c88 100644 --- a/src/main/java/appeng/client/render/effects/MatterCannonFX.java +++ b/src/main/java/appeng/client/render/effects/MatterCannonFX.java @@ -27,6 +27,7 @@ import net.minecraft.item.Item; import net.minecraft.world.World; import appeng.api.util.AEPartLocation; +import appeng.client.render.textures.ParticleTextures; public class MatterCannonFX extends ParticleBreaking @@ -46,8 +47,7 @@ public class MatterCannonFX extends ParticleBreaking this.motionX = 0.0f; this.motionY = 0.0f; this.motionZ = 0.0f; - //TODO 1.10-R - Find exact atlas it was holding and replace this broken code with the atlas. - this.particleTextureIndex = ExtraBlockTextures.BlockMatterCannonParticle.getIcon().getAtlas(); + this.particleTextureIndex = ParticleTextures.BlockMatterCannonParticle; } public void fromItem( final AEPartLocation d ) @@ -62,13 +62,13 @@ public class MatterCannonFX extends ParticleBreaking this.prevPosY = this.posY; this.prevPosZ = this.posZ; - if (this.particleAge++ >= this.particleMaxAge) + if( this.particleAge++ >= this.particleMaxAge ) { this.setExpired(); } - this.motionY -= 0.04D * (double)this.particleGravity; - this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionY -= 0.04D * (double) this.particleGravity; + this.moveEntity( this.motionX, this.motionY, this.motionZ ); this.motionX *= 0.9800000190734863D; this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; diff --git a/src/main/java/appeng/client/render/textures/ParticleTextures.java b/src/main/java/appeng/client/render/textures/ParticleTextures.java new file mode 100644 index 00000000..99073655 --- /dev/null +++ b/src/main/java/appeng/client/render/textures/ParticleTextures.java @@ -0,0 +1,19 @@ +package appeng.client.render.textures; + + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.event.TextureStitchEvent; + + +public class ParticleTextures +{ + public static TextureAtlasSprite BlockEnergyParticle; + public static TextureAtlasSprite BlockMatterCannonParticle; + + public static void registerSprite( TextureStitchEvent.Pre event ) + { + BlockEnergyParticle = event.getMap().registerSprite( new ResourceLocation( "appliedenergistics2:blocks/BlockEnergyParticle" ) ); + BlockMatterCannonParticle = event.getMap().registerSprite( new ResourceLocation( "appliedenergistics2:blocks/BlockMatterCannonParticle" ) ); + } +}