Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mod.mcreator;
- import net.minecraftforge.fml.relauncher.SideOnly;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.common.registry.EntityRegistry;
- import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
- import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
- import net.minecraftforge.fml.common.event.FMLInitializationEvent;
- import net.minecraftforge.fml.client.registry.RenderingRegistry;
- import net.minecraft.world.biome.Biome;
- import net.minecraft.world.World;
- import net.minecraft.util.math.MathHelper;
- import net.minecraft.util.ResourceLocation;
- import net.minecraft.util.EnumHand;
- import net.minecraft.util.DamageSource;
- import net.minecraft.item.ItemStack;
- import net.minecraft.item.Item;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.passive.EntityDonkey;
- import net.minecraft.entity.effect.EntityLightningBolt;
- import net.minecraft.entity.ai.EntityAIWander;
- import net.minecraft.entity.ai.EntityAISwimming;
- import net.minecraft.entity.ai.EntityAILookIdle;
- import net.minecraft.entity.SharedMonsterAttributes;
- import net.minecraft.entity.EnumCreatureType;
- import net.minecraft.entity.Entity;
- import net.minecraft.client.renderer.entity.RenderLiving;
- import net.minecraft.client.model.ModelRenderer;
- import net.minecraft.client.model.ModelHorse;
- import net.minecraft.client.model.ModelBase;
- import net.minecraft.client.Minecraft;
- import java.util.Random;
- import java.util.Iterator;
- import java.util.ArrayList;
- @SuppressWarnings("unchecked")
- public class mcreator_arideableTortoise {
- public int mobid = 0;
- public static Object instance;
- public void load(FMLInitializationEvent event) {
- }
- public void generateNether(World world, Random random, int chunkX, int chunkZ) {
- }
- public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
- }
- public int addFuel(ItemStack fuel) {
- return 0;
- }
- @SideOnly(Side.CLIENT)
- public void registerRenderers() {
- RenderLiving customRender = new RenderLiving(Minecraft.getMinecraft().getRenderManager(), new mcreator_arideableTortoise.ModelHorse(), 0) {
- protected ResourceLocation getEntityTexture(Entity par1Entity) {
- return new ResourceLocation("tortoise.png");
- }
- };
- RenderingRegistry.registerEntityRenderingHandler(mcreator_arideableTortoise.EntityarideableTortoise.class, customRender);
- }
- public void serverLoad(FMLServerStartingEvent event) {
- }
- public void preInit(FMLPreInitializationEvent event) {
- int entityID = MathHelper.getRandomUUID().hashCode();
- mobid = entityID;
- EntityRegistry.registerModEntity(new ResourceLocation("testenvironmentmod:arideableTortoise"),
- mcreator_arideableTortoise.EntityarideableTortoise.class, "arideableTortoise", entityID, instance, 64, 1, true, (0 << 16)
- + (153 << 8) + 0, (255 << 16) + (255 << 8) + 255);
- EntityRegistry.addSpawn(mcreator_arideableTortoise.EntityarideableTortoise.class, 0, 0, 0, EnumCreatureType.CREATURE, clean(Biome.REGISTRY));
- }
- public static Biome[] clean(net.minecraft.util.registry.RegistryNamespaced<ResourceLocation, Biome> in) {
- Iterator<Biome> itr = in.iterator();
- ArrayList<Biome> ls = new ArrayList<Biome>();
- while (itr.hasNext()) {
- ls.add(itr.next());
- }
- return ls.toArray(new Biome[ls.size()]);
- }
- public static class EntityarideableTortoise extends EntityDonkey {
- World world = null;
- public EntityarideableTortoise(World var1) {
- super(var1);
- world = var1;
- experienceValue = 0;
- this.isImmuneToFire = false;
- addRandomArmor();
- setNoAI(!true);
- this.tasks.addTask(0, new EntityAISwimming(this));
- this.tasks.addTask(6, new EntityAIWander(this, 1.0D));
- this.tasks.addTask(8, new EntityAILookIdle(this));
- }
- protected void addRandomArmor() {
- }
- public void moveEntityWithHeading(float strafe, float forward) {
- Entity entity = this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0);
- if (this.isBeingRidden() && this.canBeSteered()) {
- this.rotationYaw = entity.rotationYaw;
- this.prevRotationYaw = this.rotationYaw;
- this.rotationPitch = entity.rotationPitch * 0.5F;
- this.setRotation(this.rotationYaw, this.rotationPitch);
- this.renderYawOffset = this.rotationYaw;
- this.rotationYawHead = this.rotationYaw;
- this.stepHeight = 1.0F;
- this.jumpMovementFactor = this.getAIMoveSpeed() * 0.1F;
- if (this.canPassengerSteer()) {
- float f = (float) this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue() * 0.1F;
- this.setAIMoveSpeed(f);
- super.moveEntityWithHeading(0.0F, 1.0F);
- } else {
- this.motionX = 0.0D;
- this.motionY = 0.0D;
- this.motionZ = 0.0D;
- }
- this.prevLimbSwingAmount = this.limbSwingAmount;
- double d1 = this.posX - this.prevPosX;
- double d0 = this.posZ - this.prevPosZ;
- float f1 = MathHelper.sqrt(d1 * d1 + d0 * d0) * 4.0F;
- if (f1 > 1.0F) {
- f1 = 1.0F;
- }
- this.limbSwingAmount += (f1 - this.limbSwingAmount) * 0.4F;
- this.limbSwing += this.limbSwingAmount;
- } else {
- this.stepHeight = 0.5F;
- this.jumpMovementFactor = 0.02F;
- super.moveEntityWithHeading(strafe, forward);
- }
- }
- @Override
- protected Item getDropItem() {
- return null;
- }
- @Override
- protected net.minecraft.util.SoundEvent getAmbientSound() {
- return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation(""));
- }
- @Override
- protected net.minecraft.util.SoundEvent getHurtSound() {
- return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("game.neutral.hurt"));
- }
- @Override
- protected net.minecraft.util.SoundEvent getDeathSound() {
- return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("game.neutral.die"));
- }
- @Override
- public void onStruckByLightning(EntityLightningBolt entityLightningBolt) {
- super.onStruckByLightning(entityLightningBolt);
- int i = (int) this.posX;
- int j = (int) this.posY;
- int k = (int) this.posZ;
- Entity entity = this;
- }
- @Override
- public void fall(float l, float d) {
- super.fall(l, d);
- int i = (int) this.posX;
- int j = (int) this.posY;
- int k = (int) this.posZ;
- super.fall(l, d);
- Entity entity = this;
- }
- @Override
- public void onDeath(DamageSource source) {
- super.onDeath(source);
- int i = (int) this.posX;
- int j = (int) this.posY;
- int k = (int) this.posZ;
- Entity entity = this;
- }
- @Override
- public boolean processInteract(EntityPlayer entity, EnumHand hand) {
- super.processInteract(entity, hand);
- int i = (int) this.posX;
- int j = (int) this.posY;
- int k = (int) this.posZ;
- entity.startRiding(this);
- return true;
- }
- @Override
- protected float getSoundVolume() {
- return 1.0F;
- }
- }
- /**
- * ModelHorse - Either Mojang or a mod author Created using Tabula 5.1.0
- */
- public static class ModelHorse extends ModelBase {
- public ModelRenderer shelltop;
- public ModelRenderer shellundertop;
- public ModelRenderer undershell;
- public ModelRenderer sideleft;
- public ModelRenderer sideright;
- public ModelRenderer sideback;
- public ModelRenderer sidefront;
- public ModelRenderer head;
- public ModelRenderer tail;
- public ModelRenderer leftfrontleg;
- public ModelRenderer rightfrontleg;
- public ModelRenderer rightbackleg;
- public ModelRenderer leftbackleg;
- public ModelRenderer chest;
- public ModelRenderer crafting;
- public ModelRenderer tinybox;
- public ModelRenderer tiny;
- public ModelRenderer headtop;
- public ModelRenderer snouth;
- public ModelRenderer mouth;
- public ModelRenderer horn1;
- public ModelRenderer horn2;
- public ModelRenderer horn3;
- public ModelRenderer horn4;
- public ModelRenderer horn5;
- public ModelRenderer leftfrontfoot;
- public ModelRenderer rightfrontfoot;
- public ModelRenderer rightbackfoot;
- public ModelRenderer leftbackfoot;
- public ModelHorse() {
- this.textureWidth = 128;
- this.textureHeight = 128;
- this.sidefront = new ModelRenderer(this, 99, 16);
- this.sidefront.setRotationPoint(-6.0F, 6.0F, -11.6F);
- this.sidefront.addBox(0.0F, 0.0F, 0.0F, 13, 8, 1, 0.0F);
- this.leftfrontfoot = new ModelRenderer(this, 0, 0);
- this.leftfrontfoot.setRotationPoint(0.0F, 5.0F, 0.0F);
- this.leftfrontfoot.addBox(0.0F, 0.0F, 0.0F, 4, 4, 4, 0.0F);
- this.setRotateAngle(leftfrontfoot, 0.27314402793711257F, 0.0F, 0.0F);
- this.headtop = new ModelRenderer(this, 0, 0);
- this.headtop.setRotationPoint(0.0F, 2.0F, -4.6F);
- this.headtop.addBox(0.0F, 0.0F, 0.0F, 5, 5, 5, 0.0F);
- this.setRotateAngle(headtop, 0.40980330836826856F, 0.0F, 0.0F);
- this.sideright = new ModelRenderer(this, 29, 1);
- this.sideright.setRotationPoint(8.1F, 5.9F, -10.1F);
- this.sideright.addBox(0.0F, 0.0F, 0.0F, 1, 8, 17, 0.0F);
- this.rightbackleg = new ModelRenderer(this, 0, 0);
- this.rightbackleg.setRotationPoint(4.0F, 15.2F, 2.6F);
- this.rightbackleg.addBox(0.0F, 0.0F, 0.0F, 4, 5, 4, 0.0F);
- this.setRotateAngle(rightbackleg, -0.27314402793711257F, 0.0F, 0.0F);
- this.tinybox = new ModelRenderer(this, 0, 0);
- this.tinybox.setRotationPoint(-5.2F, 2.0F, 3.7F);
- this.tinybox.addBox(0.0F, 0.0F, 0.0F, 3, 3, 3, 0.0F);
- this.leftbackfoot = new ModelRenderer(this, 0, 0);
- this.leftbackfoot.setRotationPoint(0.0F, 5.0F, 0.0F);
- this.leftbackfoot.addBox(0.0F, 0.0F, 0.0F, 4, 4, 4, 0.0F);
- this.setRotateAngle(leftbackfoot, 0.27314402793711257F, 0.0F, 0.0F);
- this.snouth = new ModelRenderer(this, 0, 16);
- this.snouth.setRotationPoint(0.0F, 4.6F, -7.7F);
- this.snouth.addBox(0.0F, 0.0F, 0.0F, 5, 3, 4, 0.0F);
- this.setRotateAngle(snouth, 0.6951646410693414F, 0.0F, 0.0F);
- this.rightbackfoot = new ModelRenderer(this, 0, 0);
- this.rightbackfoot.setRotationPoint(0.0F, 5.0F, 0.0F);
- this.rightbackfoot.addBox(0.0F, 0.0F, 0.0F, 4, 4, 4, 0.0F);
- this.setRotateAngle(rightbackfoot, 0.27314402793711257F, 0.0F, 0.0F);
- this.tiny = new ModelRenderer(this, 0, 0);
- this.tiny.setRotationPoint(0.0F, -0.5F, 6.2F);
- this.tiny.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F);
- this.shellundertop = new ModelRenderer(this, -1, 58);
- this.shellundertop.setRotationPoint(-7.5F, 5.0F, -11.1F);
- this.shellundertop.addBox(0.0F, 0.0F, 0.0F, 16, 12, 19, 0.0F);
- this.crafting = new ModelRenderer(this, 0, 0);
- this.crafting.setRotationPoint(2.8F, 0.0F, 2.6F);
- this.crafting.addBox(0.0F, 0.0F, 0.0F, 4, 4, 4, 0.0F);
- this.head = new ModelRenderer(this, 64, 1);
- this.head.setRotationPoint(-2.4F, 8.5F, -14.4F);
- this.head.addBox(0.0F, -0.5F, -0.4F, 5, 6, 8, -0.4F);
- this.setRotateAngle(head, -0.36075955638722795F, -0.022689280275926284F, 0.0F);
- this.leftbackleg = new ModelRenderer(this, 0, 0);
- this.leftbackleg.setRotationPoint(-7.0F, 15.2F, 2.6F);
- this.leftbackleg.addBox(0.0F, 0.0F, 0.0F, 4, 5, 4, 0.0F);
- this.setRotateAngle(leftbackleg, -0.27314402793711257F, 0.0F, 0.0F);
- this.sideleft = new ModelRenderer(this, 69, 26);
- this.sideleft.setRotationPoint(-8.0F, 5.8F, -10.1F);
- this.sideleft.addBox(0.0F, 0.0F, 0.0F, 1, 8, 17, 0.0F);
- this.rightfrontleg = new ModelRenderer(this, 0, 0);
- this.rightfrontleg.setRotationPoint(4.0F, 15.2F, -10.0F);
- this.rightfrontleg.addBox(0.0F, 0.0F, 0.0F, 4, 5, 4, 0.0F);
- this.setRotateAngle(rightfrontleg, -0.27314402793711257F, 0.0F, 0.0F);
- this.mouth = new ModelRenderer(this, 0, 0);
- this.mouth.setRotationPoint(1.9F, 5.9F, -5.6F);
- this.mouth.addBox(-1.5F, 0.0F, -0.3F, 4, 2, 4, 0.0F);
- this.setRotateAngle(mouth, 0.5462880558742251F, 0.0F, 0.0F);
- this.sideback = new ModelRenderer(this, 100, 0);
- this.sideback.setRotationPoint(-5.9F, 6.0F, 7.3F);
- this.sideback.addBox(0.0F, 0.0F, 0.0F, 13, 8, 1, 0.0F);
- this.leftfrontleg = new ModelRenderer(this, 0, 0);
- this.leftfrontleg.setRotationPoint(-7.0F, 15.2F, -10.0F);
- this.leftfrontleg.addBox(0.0F, 0.0F, 0.0F, 4, 5, 4, 0.0F);
- this.setRotateAngle(leftfrontleg, -0.27314402793711257F, 0.0F, 0.0F);
- this.horn1 = new ModelRenderer(this, 0, 0);
- this.horn1.setRotationPoint(1.7F, 1.8F, -6.2F);
- this.horn1.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F);
- this.horn3 = new ModelRenderer(this, 0, 0);
- this.horn3.setRotationPoint(1.8F, -1.4F, -1.1F);
- this.horn3.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F);
- this.rightfrontfoot = new ModelRenderer(this, 0, 0);
- this.rightfrontfoot.setRotationPoint(0.0F, 5.0F, 0.0F);
- this.rightfrontfoot.addBox(0.0F, 0.0F, 0.0F, 4, 4, 4, 0.0F);
- this.setRotateAngle(rightfrontfoot, 0.27314402793711257F, 0.0F, 0.0F);
- this.chest = new ModelRenderer(this, 0, 0);
- this.chest.setRotationPoint(-2.2F, 1.1F, 3.0F);
- this.chest.addBox(0.0F, 0.0F, 0.0F, 5, 5, 5, 0.0F);
- this.horn5 = new ModelRenderer(this, 0, 0);
- this.horn5.setRotationPoint(0.0F, -1.3F, 4.8F);
- this.horn5.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F);
- this.setRotateAngle(horn5, -0.36425021489121656F, 0.0F, 0.0F);
- this.horn4 = new ModelRenderer(this, 0, 0);
- this.horn4.setRotationPoint(0.5F, -1.3F, 2.7F);
- this.horn4.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F);
- this.setRotateAngle(horn4, -0.36425021489121656F, 0.0F, 0.0F);
- this.shelltop = new ModelRenderer(this, 0, 34);
- this.shelltop.setRotationPoint(-1.6F, 11.6F, 9.0F);
- this.shelltop.addBox(-5.0F, -8.0F, -19.0F, 14, 2, 17, 0.0F);
- this.horn2 = new ModelRenderer(this, 0, 0);
- this.horn2.setRotationPoint(1.8F, -0.1F, -3.7F);
- this.horn2.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F);
- this.undershell = new ModelRenderer(this, 0, 96);
- this.undershell.setRotationPoint(-8.4F, 13.6F, -12.3F);
- this.undershell.addBox(0.0F, 0.0F, 0.0F, 18, 2, 21, 0.0F);
- this.tail = new ModelRenderer(this, 28, 0);
- this.tail.setRotationPoint(0.0F, 15.0F, 7.3F);
- this.tail.addBox(0.0F, 0.0F, 0.0F, 2, 2, 6, 0.0F);
- this.setRotateAngle(tail, -0.22759093446006054F, 0.0F, 0.0F);
- this.leftfrontleg.addChild(this.leftfrontfoot);
- this.head.addChild(this.headtop);
- this.leftbackleg.addChild(this.leftbackfoot);
- this.head.addChild(this.snouth);
- this.rightbackleg.addChild(this.rightbackfoot);
- this.head.addChild(this.mouth);
- this.head.addChild(this.horn1);
- this.head.addChild(this.horn3);
- this.rightfrontleg.addChild(this.rightfrontfoot);
- this.tail.addChild(this.horn5);
- this.tail.addChild(this.horn4);
- this.head.addChild(this.horn2);
- }
- @Override
- public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
- this.sidefront.render(f5);
- this.sideright.render(f5);
- this.rightbackleg.render(f5);
- this.tinybox.render(f5);
- this.tiny.render(f5);
- this.shellundertop.render(f5);
- this.crafting.render(f5);
- this.head.render(f5);
- this.leftbackleg.render(f5);
- this.sideleft.render(f5);
- this.rightfrontleg.render(f5);
- this.sideback.render(f5);
- this.leftfrontleg.render(f5);
- this.chest.render(f5);
- this.shelltop.render(f5);
- this.undershell.render(f5);
- this.tail.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;
- }
- public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity e)
- {
- super.setRotationAngles(f, f1, f2, f3, f4, f5, e);
- this.head.rotateAngleY = f3 / (360F / (float) Math.PI) + -0.36075955638722795F;
- this.head.rotateAngleX = f4 / (360F / (float) Math.PI) + -0.36075955638722795F;
- this.leftfrontleg.rotateAngleX = MathHelper.cos(f * 1.0F) * -1.0F * f1 + -0.27314402793711257F;
- this.rightfrontleg.rotateAngleX = MathHelper.cos(f * 1.0F) * 1.0F * f1 + -0.27314402793711257F;
- this.leftbackleg.rotateAngleX = MathHelper.cos(f * 1.0F) * -1.0F * f1 + -0.27314402793711257F;
- this.rightbackleg.rotateAngleX = MathHelper.cos(f * 1.0F) * 1.0F * f1 + -0.27314402793711257F;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement