Skip to content

Instantly share code, notes, and snippets.

@Daomephsta
Last active January 26, 2017 20:23
Show Gist options
  • Save Daomephsta/26347d34a26760417ed9548b4e77fdcc to your computer and use it in GitHub Desktop.
Save Daomephsta/26347d34a26760417ed9548b4e77fdcc to your computer and use it in GitHub Desktop.
public class EntityRainbowShield extends Entity
{
private static final AxisAlignedBB SHIELD_BB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 3.0D, 2.0D, 0.2D);
public EntityRainbowShield(World worldIn)
{
super(worldIn);
this.setSize(3.0F, 2.0F);
System.out.println("HAI");
}
@Override
public AxisAlignedBB getEntityBoundingBox()
{
return super.getEntityBoundingBox();
}
public AxisAlignedBB getCollisionBox(Entity entityIn)
{
return entityIn.getEntityBoundingBox();
}
public AxisAlignedBB getCollisionBoundingBox()
{
return this.getEntityBoundingBox();
}
@Override
protected void entityInit()
{}
@Override
protected void readEntityFromNBT(NBTTagCompound compound)
{}
@Override
protected void writeEntityToNBT(NBTTagCompound compound)
{}
}
package com.teamwizardry.wizardry.client.render.entity;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
/**
* ModelUnicorn - Either Mojang or a mod author
* Created using Tabula 5.1.0
*/
public class ModelRainbowShield extends ModelBase {
public ModelRenderer shield;
public ModelRainbowShield() {
this.textureWidth = 24;
this.textureHeight = 16;
this.shield = new ModelRenderer(this, 0, 0);
this.shield.setRotationPoint(12.0F, 8.0F, 1.0F);
this.shield.addBox(0.0F, 0.0F, 0.0F, 24, 16, 2);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
this.shield.render(f5);
}
}
package com.teamwizardry.wizardry.client.render.entity;
import com.teamwizardry.wizardry.Wizardry;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.util.ResourceLocation;
public class RenderRainbowShield extends Render<EntityRainbowShield> {
private static final ResourceLocation SHIELD_TEX_PATH = new ResourceLocation(Wizardry.MODID, "textures/entity/rainbow_shield.png");
private ModelBase model;
public RenderRainbowShield(RenderManager renderManager, ModelBase modelBase)
{
super(renderManager);
this.model = modelBase;
}
@Override
public void doRender(EntityRainbowShield entity, double x, double y, double z, float entityYaw, float partialTicks)
{
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
this.bindEntityTexture(entity);
model.render(entity, partialTicks, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.popMatrix();
}
@Override
protected ResourceLocation getEntityTexture(EntityRainbowShield entity) {
return SHIELD_TEX_PATH;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment