diff options
author | Alkalus <draknyte1@hotmail.com> | 2021-05-20 23:07:24 +0000 |
---|---|---|
committer | Alkalus <draknyte1@hotmail.com> | 2021-05-20 23:07:24 +0000 |
commit | 7881c840421c191e8c4249fc303e184fa1cbf9a8 (patch) | |
tree | 0e1f8d8d19ca14e14dfb16c1ed49750935612dfa /src/Java/gtPlusPlus/core/client | |
parent | de40c882cb16535deae1c29b22f1a535747db536 (diff) | |
parent | 5316a0ffcbc403e17a06d4c9e28d57e202f0aafe (diff) | |
download | GT5-Unofficial-7881c840421c191e8c4249fc303e184fa1cbf9a8.tar.gz GT5-Unofficial-7881c840421c191e8c4249fc303e184fa1cbf9a8.tar.bz2 GT5-Unofficial-7881c840421c191e8c4249fc303e184fa1cbf9a8.zip |
Merged in MultiFixes (pull request #11)
MultiFixes
Diffstat (limited to 'src/Java/gtPlusPlus/core/client')
4 files changed, 245 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/client/model/ModelEggBox.java b/src/Java/gtPlusPlus/core/client/model/ModelEggBox.java new file mode 100644 index 0000000000..0aef4eb7b0 --- /dev/null +++ b/src/Java/gtPlusPlus/core/client/model/ModelEggBox.java @@ -0,0 +1,65 @@ +package gtPlusPlus.core.client.model; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.data.Pair; +import gtPlusPlus.core.client.model.tabula.ModelTabulaBase; +import gtPlusPlus.core.client.renderer.tabula.RenderTabulaBase; +import gtPlusPlus.core.tileentities.general.TileEntityEggBox; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +/** + * ModelEggBox - Alkalus + * Created using Tabula 4.1.1 + */ +public class ModelEggBox extends ModelTabulaBase { + + private final AutoMap<Pair<ModelRenderer, Float>> mParts = new AutoMap<Pair<ModelRenderer, Float>>(); + + private static RenderTabulaBase mRendererInstance; + + public ModelRenderer bottom; + //EggBox_full.png + + public ModelEggBox() { + super(64, 64); + this.textureWidth = 64; + this.textureHeight = 64; + + this.bottom = new ModelRenderer(this, 0, 19); + this.bottom.setRotationPoint(1.0F, 6.0F, 1.0F); + this.bottom.addBox(0.0F, 0.0F, 0.0F, 14, 10, 14, 0.0F); + mParts.add(new Pair<ModelRenderer, Float>(bottom, 0f)); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + //Logger.INFO("Rendering EggBox"); + this.bottom.render(f5); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } + + @Override + protected AutoMap<Pair<ModelRenderer, Float>> getModelParts() { + AutoMap<Pair<ModelRenderer, Float>> aParts = new AutoMap<Pair<ModelRenderer, Float>>(); + aParts.add(new Pair<ModelRenderer, Float>(bottom, 0.0625F)); + return aParts; + //return mParts; + } + + public static RenderTabulaBase getRenderer() { + if (mRendererInstance == null) { + mRendererInstance = new RenderTabulaBase(new ModelEggBox(), "textures/blocks/TileEntities/EggBox_full.png", TileEntityEggBox.class); + } + return mRendererInstance; + } +} diff --git a/src/Java/gtPlusPlus/core/client/model/tabula/ModelTabulaBase.java b/src/Java/gtPlusPlus/core/client/model/tabula/ModelTabulaBase.java new file mode 100644 index 0000000000..3a0cbb636b --- /dev/null +++ b/src/Java/gtPlusPlus/core/client/model/tabula/ModelTabulaBase.java @@ -0,0 +1,38 @@ +package gtPlusPlus.core.client.model.tabula; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.data.Pair; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +/** + * ModelEggBox - Alkalus + * Created using Tabula 4.1.1 + */ +public abstract class ModelTabulaBase extends ModelBase { + + + public ModelTabulaBase(int aTexWidth, int aTexHeight) { + this.textureWidth = aTexWidth; + this.textureHeight = aTexHeight; + } + + protected abstract AutoMap<Pair<ModelRenderer, Float>> getModelParts(); + + public void renderAll() { + for (Pair<ModelRenderer, Float> part : getModelParts()) { + //Logger.INFO("Rendering EggBox"); + part.getKey().render(part.getValue()); + } + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } +} diff --git a/src/Java/gtPlusPlus/core/client/renderer/particle/EntityDropParticleFX.java b/src/Java/gtPlusPlus/core/client/renderer/particle/EntityDropParticleFX.java new file mode 100644 index 0000000000..ed2fdff272 --- /dev/null +++ b/src/Java/gtPlusPlus/core/client/renderer/particle/EntityDropParticleFX.java @@ -0,0 +1,96 @@ +package gtPlusPlus.core.client.renderer.particle; + +import cofh.lib.util.helpers.MathHelper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.material.Material; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.world.World; + +@SideOnly(Side.CLIENT) +public class EntityDropParticleFX extends EntityFX { + + private int bobTimer; + + public EntityDropParticleFX(World world, double x, double y, double z, float particleRed, float particleGreen, float particleBlue) { + + this(world, x, y, z, particleRed, particleGreen, particleBlue, -1); + } + + public EntityDropParticleFX(World world, double x, double y, double z, float particleRed, float particleGreen, float particleBlue, int gravityMod) { + + super(world, x, y, z, 0.0D, 0.0D, 0.0D); + this.motionX = this.motionY = this.motionZ = 0.0D; + + this.particleRed = particleRed; + this.particleGreen = particleGreen; + this.particleBlue = particleBlue; + + this.setParticleTextureIndex(113); + this.setSize(0.01F, 0.01F); + this.particleGravity = -0.06F * gravityMod; + this.bobTimer = 40; + this.particleMaxAge = (int) (48.0D / (Math.random() * 0.8D + 0.2D)); + this.motionX = this.motionY = this.motionZ = 0.0D; + } + + @Override + public void onUpdate() { + + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + this.motionY -= this.particleGravity; + + if (this.bobTimer-- > 0) { + this.motionX *= 0.02D; + this.motionY *= 0.02D; + this.motionZ *= 0.02D; + this.setParticleTextureIndex(113); + } else { + this.setParticleTextureIndex(112); + } + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; + + if (this.particleMaxAge-- <= 0) { + this.setDead(); + } + if (this.onGround) { + this.setParticleTextureIndex(114); + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + if (this.particleGravity > 0) { + Material material = this.worldObj.getBlock(MathHelper.floor(this.posX), MathHelper.floor(this.posY), MathHelper.floor(this.posZ)).getMaterial(); + + if (material.isLiquid() || material.isSolid()) { + double d0 = MathHelper.floor(this.posY) + + 1 + - BlockLiquid.getLiquidHeightPercent(this.worldObj.getBlockMetadata(MathHelper.floor(this.posX), MathHelper.floor(this.posY), + MathHelper.floor(this.posZ))); + if (this.posY < d0) { + this.setDead(); + } + } + } else { + Material material = this.worldObj.getBlock(MathHelper.ceil(this.posX), MathHelper.ceil(this.posY), MathHelper.ceil(this.posZ)).getMaterial(); + + if (material.isLiquid() || material.isSolid()) { + double d0 = MathHelper.ceil(this.posY) + + 1 + - BlockLiquid.getLiquidHeightPercent(this.worldObj.getBlockMetadata(MathHelper.ceil(this.posX), MathHelper.ceil(this.posY), + MathHelper.ceil(this.posZ))); + if (this.posY > d0) { + this.setDead(); + } + } + } + } + +} diff --git a/src/Java/gtPlusPlus/core/client/renderer/tabula/RenderTabulaBase.java b/src/Java/gtPlusPlus/core/client/renderer/tabula/RenderTabulaBase.java new file mode 100644 index 0000000000..b4f64f9b35 --- /dev/null +++ b/src/Java/gtPlusPlus/core/client/renderer/tabula/RenderTabulaBase.java @@ -0,0 +1,46 @@ +package gtPlusPlus.core.client.renderer.tabula; + +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.client.model.tabula.ModelTabulaBase; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; + +@SideOnly(Side.CLIENT) +public class RenderTabulaBase extends TileEntitySpecialRenderer { + + private final ModelTabulaBase mModel; + private final ResourceLocation mTexture; + private final Class mTileClass; + + public final int mRenderID; + public final RenderTabulaBase mInstance; + + public RenderTabulaBase(ModelTabulaBase aModel, String aTexturePath, Class aTileClass) { + mModel = aModel; + mTexture = new ResourceLocation(CORE.MODID, aTexturePath); + mTileClass = aTileClass; + this.mRenderID = RenderingRegistry.getNextAvailableRenderId(); + mInstance = this; + } + + public void renderTileEntityAt(Object aTile, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_) { + if (mTileClass.isInstance(aTile)) { + //Logger.INFO("Rendering EggBox"); + this.bindTexture(mTexture); + mModel.renderAll(); + } + } + + public void renderTileEntityAt(TileEntity aTile, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_) { + if (mTileClass != null && aTile != null) { + if (mTileClass.isInstance(aTile)) { + this.renderTileEntityAt((Object) aTile, p_147500_2_, p_147500_4_, p_147500_6_, p_147500_8_); + } + } + } +}
\ No newline at end of file |