Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.67 KB | None | 0 0
  1. package mod.mcreator;
  2.  
  3. import net.minecraftforge.fml.relauncher.SideOnly;
  4. import net.minecraftforge.fml.relauncher.Side;
  5. import net.minecraftforge.fml.common.registry.EntityRegistry;
  6. import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
  7. import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
  8. import net.minecraftforge.fml.common.event.FMLInitializationEvent;
  9. import net.minecraftforge.fml.client.registry.RenderingRegistry;
  10.  
  11. import net.minecraft.world.biome.Biome;
  12. import net.minecraft.world.World;
  13. import net.minecraft.util.math.MathHelper;
  14. import net.minecraft.util.ResourceLocation;
  15. import net.minecraft.util.EnumParticleTypes;
  16. import net.minecraft.util.EnumHand;
  17. import net.minecraft.util.DamageSource;
  18. import net.minecraft.item.ItemStack;
  19. import net.minecraft.item.Item;
  20. import net.minecraft.entity.projectile.EntityTippedArrow;
  21. import net.minecraft.entity.player.EntityPlayer;
  22. import net.minecraft.entity.monster.EntityWitch;
  23. import net.minecraft.entity.effect.EntityLightningBolt;
  24. import net.minecraft.entity.ai.EntityAIWander;
  25. import net.minecraft.entity.ai.EntityAISwimming;
  26. import net.minecraft.entity.ai.EntityAILookIdle;
  27. import net.minecraft.entity.ai.EntityAILeapAtTarget;
  28. import net.minecraft.entity.ai.EntityAIAttackRanged;
  29. import net.minecraft.entity.ai.EntityAIAttackMelee;
  30. import net.minecraft.entity.IRangedAttackMob;
  31. import net.minecraft.entity.EnumCreatureType;
  32. import net.minecraft.entity.EntityLivingBase;
  33. import net.minecraft.entity.Entity;
  34. import net.minecraft.client.renderer.entity.RenderSnowball;
  35. import net.minecraft.client.renderer.entity.RenderLiving;
  36. import net.minecraft.client.renderer.GlStateManager;
  37. import net.minecraft.client.model.ModelRenderer;
  38. import net.minecraft.client.model.ModelPlayer;
  39. import net.minecraft.client.model.ModelBase;
  40. import net.minecraft.client.Minecraft;
  41.  
  42. import java.util.Random;
  43. import java.util.Iterator;
  44. import java.util.ArrayList;
  45.  
  46. @SuppressWarnings("unchecked")
  47. public class mcreator_apurpleMage {
  48.  
  49. public int mobid = 0;
  50. public static Object instance;
  51.  
  52. public void load(FMLInitializationEvent event) {
  53. }
  54.  
  55. public void generateNether(World world, Random random, int chunkX, int chunkZ) {
  56. }
  57.  
  58. public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
  59. }
  60.  
  61. public int addFuel(ItemStack fuel) {
  62. return 0;
  63. }
  64.  
  65. @SideOnly(Side.CLIENT)
  66. public void registerRenderers() {
  67. RenderLiving customRender = new RenderLiving(Minecraft.getMinecraft().getRenderManager(), new mcreator_apurpleMage.ModelPlayer(), 0) {
  68. protected ResourceLocation getEntityTexture(Entity par1Entity) {
  69. return new ResourceLocation("sss.png");
  70. }
  71. };
  72. RenderingRegistry.registerEntityRenderingHandler(mcreator_apurpleMage.EntityapurpleMage.class, customRender);
  73. RenderingRegistry.registerEntityRenderingHandler(EntityArrowCustom.class, new RenderSnowball(Minecraft.getMinecraft().getRenderManager(),
  74. new ItemStack(mcreator_ashootingskull.block).getItem(), Minecraft.getMinecraft().getRenderItem()));
  75.  
  76. }
  77.  
  78. public void serverLoad(FMLServerStartingEvent event) {
  79. }
  80.  
  81. public void preInit(FMLPreInitializationEvent event) {
  82. int entityID = MathHelper.getRandomUUID().hashCode();
  83. mobid = entityID;
  84. EntityRegistry.registerModEntity(new ResourceLocation("testenvironmentmod:apurpleMage"), mcreator_apurpleMage.EntityapurpleMage.class,
  85. "apurpleMage", entityID, instance, 64, 1, true, (102 << 16) + (0 << 8) + 102, (0 << 16) + (0 << 8) + 0);
  86. EntityRegistry.addSpawn(mcreator_apurpleMage.EntityapurpleMage.class, 0, 0, 0, EnumCreatureType.MONSTER, clean(Biome.REGISTRY));
  87.  
  88. int entityID2 = MathHelper.getRandomUUID().hashCode();
  89. EntityRegistry.registerModEntity(new ResourceLocation("testenvironmentmod:entitybulletapurplemage"), EntityArrowCustom.class,
  90. "entitybulletapurplemage", entityID2, instance, 64, 1, true);
  91.  
  92. }
  93.  
  94. public static Biome[] clean(net.minecraft.util.registry.RegistryNamespaced<ResourceLocation, Biome> in) {
  95. Iterator<Biome> itr = in.iterator();
  96. ArrayList<Biome> ls = new ArrayList<Biome>();
  97. while (itr.hasNext()) {
  98. ls.add(itr.next());
  99. }
  100. return ls.toArray(new Biome[ls.size()]);
  101. }
  102.  
  103. public static class EntityArrowCustom extends EntityTippedArrow {
  104. public EntityArrowCustom(World a) {
  105. super(a);
  106. }
  107.  
  108. public EntityArrowCustom(World worldIn, double x, double y, double z) {
  109. super(worldIn, x, y, z);
  110. }
  111.  
  112. public EntityArrowCustom(World worldIn, EntityLivingBase shooter) {
  113. super(worldIn, shooter);
  114. }
  115. }
  116.  
  117. public static class EntityapurpleMage extends EntityWitch implements IRangedAttackMob {
  118. World world = null;
  119.  
  120. public EntityapurpleMage(World var1) {
  121. super(var1);
  122. world = var1;
  123. experienceValue = 8;
  124. this.isImmuneToFire = false;
  125. addRandomArmor();
  126. setNoAI(!true);
  127. this.tasks.addTask(0, new EntityAISwimming(this));
  128. this.tasks.addTask(6, new EntityAIWander(this, 1.0D));
  129. this.tasks.addTask(8, new EntityAILookIdle(this));
  130. this.tasks.addTask(10, new EntityAIWander(this, 0.8D));
  131. this.tasks.addTask(5, new EntityAILookIdle(this));
  132. this.tasks.addTask(10, new EntityAILeapAtTarget(this, 0.8F));
  133. this.tasks.addTask(20, new EntityAIAttackMelee(this, 1.0D, false));
  134. this.tasks.addTask(1, new EntityAIAttackRanged(this, 1.25D, 20, 10.0F));
  135.  
  136. }
  137.  
  138. protected void addRandomArmor() {
  139.  
  140. }
  141.  
  142. public void onLivingUpdate() {
  143.  
  144. super.onLivingUpdate();
  145. World par1World = this.world;
  146. int par2 = (int) this.posX;
  147. int par3 = (int) this.posY;
  148. int par4 = (int) this.posZ;
  149. Random par5Random = this.rand;
  150. if (true)
  151. for (int l = 0; l < 2; ++l) {
  152. double d0 = (double) ((float) par2 + par5Random.nextFloat());
  153. double d1 = (double) ((float) par3 + par5Random.nextFloat());
  154. double d2 = (double) ((float) par4 + par5Random.nextFloat());
  155. double d3 = 0.0D;
  156. double d4 = 0.0D;
  157. double d5 = 0.0D;
  158. int i1 = par5Random.nextInt(2) * 2 - 1;
  159. d3 = ((double) par5Random.nextFloat() - 0.5D) * 0.2999999985098839D;
  160. d4 = ((double) par5Random.nextFloat() - 0.5D) * 0.2999999985098839D;
  161. d5 = ((double) par5Random.nextFloat() - 0.5D) * 0.2999999985098839D;
  162. par1World.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5);
  163. }
  164. }
  165.  
  166. public void attackEntityWithRangedAttack(EntityLivingBase target, float flval) {
  167. EntityArrowCustom entityarrow = new EntityArrowCustom(this.world, this);
  168. double d0 = target.posY + (double) target.getEyeHeight() - 1.1;
  169. double d1 = target.posX - this.posX;
  170. double d2 = d0 - entityarrow.posY;
  171. double d3 = target.posZ - this.posZ;
  172. float f = MathHelper.sqrt(d1 * d1 + d3 * d3) * 0.2F;
  173. entityarrow.setThrowableHeading(d1, d2 + (double) f, d3, 1.6F, 12.0F);
  174. this.world.spawnEntity(entityarrow);
  175. }
  176.  
  177. @Override
  178. protected Item getDropItem() {
  179. return null;
  180. }
  181.  
  182. @Override
  183. protected net.minecraft.util.SoundEvent getAmbientSound() {
  184. return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation(""));
  185. }
  186.  
  187. @Override
  188. protected net.minecraft.util.SoundEvent getHurtSound() {
  189. return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("game.neutral.hurt"));
  190. }
  191.  
  192. @Override
  193. protected net.minecraft.util.SoundEvent getDeathSound() {
  194. return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("game.neutral.die"));
  195. }
  196.  
  197. @Override
  198. public void onStruckByLightning(EntityLightningBolt entityLightningBolt) {
  199. super.onStruckByLightning(entityLightningBolt);
  200. int i = (int) this.posX;
  201. int j = (int) this.posY;
  202. int k = (int) this.posZ;
  203. Entity entity = this;
  204.  
  205. }
  206.  
  207. @Override
  208. public void fall(float l, float d) {
  209. super.fall(l, d);
  210. int i = (int) this.posX;
  211. int j = (int) this.posY;
  212. int k = (int) this.posZ;
  213. super.fall(l, d);
  214. Entity entity = this;
  215.  
  216. }
  217.  
  218. @Override
  219. public void onDeath(DamageSource source) {
  220. super.onDeath(source);
  221. int i = (int) this.posX;
  222. int j = (int) this.posY;
  223. int k = (int) this.posZ;
  224. Entity entity = this;
  225.  
  226. }
  227.  
  228. @Override
  229. public boolean processInteract(EntityPlayer entity, EnumHand hand) {
  230. super.processInteract(entity, hand);
  231. int i = (int) this.posX;
  232. int j = (int) this.posY;
  233. int k = (int) this.posZ;
  234.  
  235. return true;
  236. }
  237.  
  238. @Override
  239. protected float getSoundVolume() {
  240. return 1.0F;
  241. }
  242.  
  243. }
  244.  
  245. /**
  246. * ModelPlayer - Either Mojang or a mod author Created using Tabula 5.1.0
  247. */
  248. public static class ModelPlayer extends ModelBase {
  249. public ModelRenderer leftleg;
  250. public ModelRenderer rightleg;
  251. public ModelRenderer leftarm;
  252. public ModelRenderer head;
  253. public ModelRenderer rightarm;
  254. public ModelRenderer torso;
  255. public ModelRenderer circle;
  256. public ModelRenderer leftarmcape;
  257. public ModelRenderer headtop;
  258. public ModelRenderer headsideright;
  259. public ModelRenderer headsideleft;
  260. public ModelRenderer headsideback;
  261. public ModelRenderer shadeleft;
  262. public ModelRenderer shaderight;
  263. public ModelRenderer shaderL2;
  264. public ModelRenderer shaderR2;
  265. public ModelRenderer undershader;
  266. public ModelRenderer bachshade1;
  267. public ModelRenderer bachshade2;
  268. public ModelRenderer bachshade3;
  269. public ModelRenderer rightarmcape;
  270. public ModelRenderer capefront;
  271. public ModelRenderer capefrontnder;
  272. public ModelRenderer capeback;
  273. public ModelRenderer capebackunder;
  274.  
  275. public ModelPlayer() {
  276. this.textureWidth = 64;
  277. this.textureHeight = 64;
  278. this.torso = new ModelRenderer(this, 16, 32);
  279. this.torso.setRotationPoint(0.0F, 0.0F, 0.0F);
  280. this.torso.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.25F);
  281. this.rightarm = new ModelRenderer(this, 32, 48);
  282. this.rightarm.setRotationPoint(5.0F, 2.5F, -0.0F);
  283. this.rightarm.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, 0.0F);
  284. this.setRotateAngle(rightarm, -1.1838568316277536F, 0.40980330836826856F, -0.10000736613927509F);
  285. this.shaderL2 = new ModelRenderer(this, 10, 0);
  286. this.shaderL2.setRotationPoint(2.0F, -5.0F, -5.1F);
  287. this.shaderL2.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F);
  288. this.rightleg = new ModelRenderer(this, 0, 48);
  289. this.rightleg.setRotationPoint(1.9F, 12.0F, 0.1F);
  290. this.rightleg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.25F);
  291. this.shaderR2 = new ModelRenderer(this, 10, 0);
  292. this.shaderR2.setRotationPoint(-3.0F, -4.9F, -5.1F);
  293. this.shaderR2.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F);
  294. this.rightarmcape = new ModelRenderer(this, 3, 0);
  295. this.rightarmcape.setRotationPoint(-1.5F, -2.1F, -2.4F);
  296. this.rightarmcape.addBox(0.0F, 0.0F, 0.0F, 4, 11, 6, 0.0F);
  297. this.bachshade3 = new ModelRenderer(this, 6, 2);
  298. this.bachshade3.setRotationPoint(-2.0F, -5.0F, 8.0F);
  299. this.bachshade3.addBox(0.0F, 0.0F, 0.0F, 4, 5, 3, 0.0F);
  300. this.setRotateAngle(bachshade3, -0.40980330836826856F, 0.0F, 0.0F);
  301. this.shaderight = new ModelRenderer(this, 10, 0);
  302. this.shaderight.setRotationPoint(-2.0F, -4.9F, -5.1F);
  303. this.shaderight.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F);
  304. this.capeback = new ModelRenderer(this, 44, 31);
  305. this.capeback.setRotationPoint(-4.0F, 1.0F, 2.3F);
  306. this.capeback.addBox(0.0F, 0.0F, 0.0F, 9, 16, 1, 0.0F);
  307. this.setRotateAngle(capeback, 0.045553093477052F, 0.0F, 0.0F);
  308. this.undershader = new ModelRenderer(this, 4, 9);
  309. this.undershader.setRotationPoint(-5.0F, 1.0F, -5.0F);
  310. this.undershader.addBox(0.0F, 0.0F, 0.0F, 9, 1, 2, 0.0F);
  311. this.bachshade1 = new ModelRenderer(this, 4, 0);
  312. this.bachshade1.setRotationPoint(-4.0F, -8.8F, 3.0F);
  313. this.bachshade1.addBox(0.0F, 0.0F, 0.0F, 8, 9, 4, 0.0F);
  314. this.setRotateAngle(bachshade1, -0.091106186954104F, 0.0F, 0.0F);
  315. this.capefront = new ModelRenderer(this, 46, 31);
  316. this.capefront.setRotationPoint(-4.0F, 2.0F, -3.3F);
  317. this.capefront.addBox(0.0F, 0.0F, 0.0F, 8, 15, 1, 0.0F);
  318. this.setRotateAngle(capefront, -0.045553093477052F, 0.0F, 0.0F);
  319. this.headsideright = new ModelRenderer(this, 5, -3);
  320. this.headsideright.setRotationPoint(3.0F, -8.0F, -5.1F);
  321. this.headsideright.addBox(0.0F, 0.0F, 0.0F, 2, 9, 10, 0.0F);
  322. this.bachshade2 = new ModelRenderer(this, 6, 2);
  323. this.bachshade2.setRotationPoint(-3.0F, -7.0F, 6.0F);
  324. this.bachshade2.addBox(0.0F, 0.0F, 0.0F, 6, 7, 3, 0.0F);
  325. this.setRotateAngle(bachshade2, -0.27314402793711257F, 0.0F, 0.0F);
  326. this.head = new ModelRenderer(this, 32, 12);
  327. this.head.setRotationPoint(0.0F, 0.0F, 0.0F);
  328. this.head.addBox(-4.0F, -8.0F, -4.0F, 8, 9, 8, 0.0F);
  329. this.leftarm = new ModelRenderer(this, 50, 48);
  330. this.leftarm.setRotationPoint(-5.0F, 2.5F, 0.0F);
  331. this.leftarm.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, 0.0F);
  332. this.setRotateAngle(leftarm, -1.4067353771074294F, -0.3068288825006031F, 0.3722787294503905F);
  333. this.capebackunder = new ModelRenderer(this, 44, 41);
  334. this.capebackunder.setRotationPoint(-4.0F, 16.5F, 3.0F);
  335. this.capebackunder.addBox(0.0F, 0.0F, 0.0F, 9, 4, 1, 0.0F);
  336. this.setRotateAngle(capebackunder, 0.22759093446006054F, 0.0F, 0.0F);
  337. this.shadeleft = new ModelRenderer(this, 10, 0);
  338. this.shadeleft.setRotationPoint(1.0F, -4.9F, -5.1F);
  339. this.shadeleft.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F);
  340. this.headsideleft = new ModelRenderer(this, 4, -3);
  341. this.headsideleft.setRotationPoint(-5.1F, -8.0F, -5.1F);
  342. this.headsideleft.addBox(0.0F, 0.0F, 0.0F, 2, 9, 10, 0.0F);
  343. this.capefrontnder = new ModelRenderer(this, 46, 42);
  344. this.capefrontnder.setRotationPoint(-4.0F, 16.5F, -4.0F);
  345. this.capefrontnder.addBox(0.0F, 0.0F, 0.0F, 8, 4, 1, 0.0F);
  346. this.setRotateAngle(capefrontnder, -0.22759093446006054F, 0.0F, 0.0F);
  347. this.leftleg = new ModelRenderer(this, 0, 32);
  348. this.leftleg.setRotationPoint(-1.9F, 12.0F, 0.1F);
  349. this.leftleg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.25F);
  350. this.headtop = new ModelRenderer(this, -7, 9);
  351. this.headtop.setRotationPoint(-5.0F, -8.8F, -5.1F);
  352. this.headtop.addBox(0.0F, 0.0F, 0.0F, 10, 4, 10, 0.0F);
  353. this.circle = new ModelRenderer(this, 36, 0);
  354. this.circle.setRotationPoint(-6.3F, -1.3F, -12.7F);
  355. this.circle.addBox(0.0F, 0.0F, 0.0F, 14, 14, 0, 0.0F);
  356. this.leftarmcape = new ModelRenderer(this, 7, 0);
  357. this.leftarmcape.setRotationPoint(-2.2F, -2.2F, -2.8F);
  358. this.leftarmcape.addBox(0.0F, 0.0F, 0.0F, 4, 11, 6, 0.0F);
  359. this.headsideback = new ModelRenderer(this, -6, 0);
  360. this.headsideback.setRotationPoint(-4.0F, -8.8F, 1.8F);
  361. this.headsideback.addBox(0.0F, 0.0F, 0.0F, 9, 10, 3, 0.0F);
  362. this.head.addChild(this.shaderL2);
  363. this.head.addChild(this.shaderR2);
  364. this.rightarm.addChild(this.rightarmcape);
  365. this.head.addChild(this.bachshade3);
  366. this.head.addChild(this.shaderight);
  367. this.torso.addChild(this.capeback);
  368. this.head.addChild(this.undershader);
  369. this.head.addChild(this.bachshade1);
  370. this.torso.addChild(this.capefront);
  371. this.head.addChild(this.headsideright);
  372. this.head.addChild(this.bachshade2);
  373. this.torso.addChild(this.capebackunder);
  374. this.head.addChild(this.shadeleft);
  375. this.head.addChild(this.headsideleft);
  376. this.torso.addChild(this.capefrontnder);
  377. this.head.addChild(this.headtop);
  378. this.leftarm.addChild(this.leftarmcape);
  379. this.head.addChild(this.headsideback);
  380. }
  381.  
  382. @Override
  383. public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
  384. this.torso.render(f5);
  385. this.rightarm.render(f5);
  386. this.rightleg.render(f5);
  387. GlStateManager.pushMatrix();
  388. GlStateManager.translate(this.head.offsetX, this.head.offsetY, this.head.offsetZ);
  389. GlStateManager.translate(this.head.rotationPointX * f5, this.head.rotationPointY * f5, this.head.rotationPointZ * f5);
  390. GlStateManager.scale(0.9D, 0.9D, 0.9D);
  391. GlStateManager.translate(-this.head.offsetX, -this.head.offsetY, -this.head.offsetZ);
  392. GlStateManager.translate(-this.head.rotationPointX * f5, -this.head.rotationPointY * f5, -this.head.rotationPointZ * f5);
  393. this.head.render(f5);
  394. GlStateManager.popMatrix();
  395. this.leftarm.render(f5);
  396. this.leftleg.render(f5);
  397. this.circle.render(f5);
  398. }
  399.  
  400. /**
  401. * This is a helper function from Tabula to set the rotation of model
  402. * parts
  403. */
  404. public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
  405. modelRenderer.rotateAngleX = x;
  406. modelRenderer.rotateAngleY = y;
  407. modelRenderer.rotateAngleZ = z;
  408. }
  409.  
  410. public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity e)
  411.  
  412. {
  413. super.setRotationAngles(f, f1, f2, f3, f4, f5, e);
  414. this.head.rotateAngleY = f3 / (180F / (float) Math.PI);
  415. this.head.rotateAngleX = f4 / (180F / (float) Math.PI);
  416. this.leftleg.rotateAngleX = MathHelper.cos(f * 1.0F) * -1.0F * f1;
  417. this.rightleg.rotateAngleX = MathHelper.cos(f * 1.0F) * 1.0F * f1;
  418.  
  419. }
  420. }
  421.  
  422. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement