Advertisement
Guest User

Model error

a guest
Oct 7th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.63 KB | None | 0 0
  1. import net.minecraftforge.fml.relauncher.SideOnly;
  2. import net.minecraftforge.fml.relauncher.Side;
  3. import net.minecraftforge.fml.common.registry.EntityRegistry;
  4. import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
  5. import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
  6. import net.minecraftforge.fml.common.event.FMLInitializationEvent;
  7. import net.minecraftforge.fml.client.registry.RenderingRegistry;
  8.  
  9. import net.minecraft.world.biome.Biome;
  10. import net.minecraft.world.World;
  11. import net.minecraft.util.math.MathHelper;
  12. import net.minecraft.util.ResourceLocation;
  13. import net.minecraft.util.EnumHand;
  14. import net.minecraft.util.DamageSource;
  15. import net.minecraft.item.ItemStack;
  16. import net.minecraft.item.Item;
  17. import net.minecraft.init.Blocks;
  18. import net.minecraft.entity.player.EntityPlayer;
  19. import net.minecraft.entity.monster.EntityMob;
  20. import net.minecraft.entity.effect.EntityLightningBolt;
  21. import net.minecraft.entity.SharedMonsterAttributes;
  22. import net.minecraft.entity.EnumCreatureType;
  23. import net.minecraft.entity.Entity;
  24. import net.minecraft.client.renderer.entity.RenderLiving;
  25. import net.minecraft.client.model.ModelRenderer;
  26. import net.minecraft.client.model.ModelBase;
  27. import net.minecraft.client.Minecraft;
  28.  
  29. import java.util.Random;
  30. import java.util.Iterator;
  31. import java.util.ArrayList;
  32.  
  33. @SuppressWarnings("unchecked")
  34. public class mcreator_testmodel {
  35.  
  36. public int mobid = 0;
  37. public static Object instance;
  38.  
  39. public void load(FMLInitializationEvent event) {
  40. }
  41.  
  42. public void generateNether(World world, Random random, int chunkX, int chunkZ) {
  43. }
  44.  
  45. public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
  46. }
  47.  
  48. public int addFuel(ItemStack fuel) {
  49. return 0;
  50. }
  51.  
  52. @SideOnly(Side.CLIENT)
  53. public void registerRenderers() {
  54. RenderLiving customRender = new RenderLiving(Minecraft.getMinecraft().getRenderManager(), new mcreator_testmodel.ModelNew(), 0) {
  55. protected ResourceLocation getEntityTexture(Entity par1Entity) {
  56. return new ResourceLocation("texture.png");
  57. }
  58. };
  59. RenderingRegistry.registerEntityRenderingHandler(mcreator_testmodel.Entitytestmodel.class, customRender);
  60. }
  61.  
  62. public void serverLoad(FMLServerStartingEvent event) {
  63. }
  64.  
  65. public void preInit(FMLPreInitializationEvent event) {
  66. int entityID = MathHelper.getRandomUUID().hashCode();
  67. mobid = entityID;
  68. EntityRegistry.registerModEntity(mcreator_testmodel.Entitytestmodel.class, "testmodel", entityID, instance, 64, 1, true, (102 << 16)
  69. + (102 << 8) + 0, (255 << 16) + (51 << 8) + 51);
  70. EntityRegistry.addSpawn(mcreator_testmodel.Entitytestmodel.class, 20, 3, 30, EnumCreatureType.MONSTER, clean(Biome.REGISTRY));
  71.  
  72. }
  73.  
  74. public static Biome[] clean(net.minecraft.util.registry.RegistryNamespaced<ResourceLocation, Biome> in) {
  75. Iterator<Biome> itr = in.iterator();
  76. ArrayList<Biome> ls = new ArrayList<Biome>();
  77. while (itr.hasNext()) {
  78. ls.add(itr.next());
  79. }
  80. return ls.toArray(new Biome[ls.size()]);
  81. }
  82.  
  83. /*
  84. * public Entity spawnEntity(int var1, World var2, double var3, double var5,
  85. * double var7) { if(var1==mobid) return new
  86. * mcreator_testmodel.Entitytestmodel(var2); else return null; }
  87. */
  88.  
  89. public static class Entitytestmodel extends EntityMob {
  90. World world = null;
  91.  
  92. public Entitytestmodel(World var1) {
  93. super(var1);
  94. world = var1;
  95. experienceValue = 5;
  96. this.isImmuneToFire = false;
  97. addRandomArmor();
  98. setNoAI(!false);
  99.  
  100. }
  101.  
  102. protected void applyEntityAttributes() {
  103. super.applyEntityAttributes();
  104. this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D);
  105. this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(10D);
  106. if (this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE) != null)
  107. this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(3D);
  108. }
  109.  
  110. protected void addRandomArmor() {
  111.  
  112. }
  113.  
  114. @Override
  115. protected Item getDropItem() {
  116. return new ItemStack(Blocks.DROPPER).getItem();
  117. }
  118.  
  119. @Override
  120. protected net.minecraft.util.SoundEvent getAmbientSound() {
  121. return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation(""));
  122. }
  123.  
  124. @Override
  125. protected net.minecraft.util.SoundEvent getHurtSound() {
  126. return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("game.neutral.hurt"));
  127. }
  128.  
  129. @Override
  130. protected net.minecraft.util.SoundEvent getDeathSound() {
  131. return (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("game.neutral.die"));
  132. }
  133.  
  134. @Override
  135. public void onStruckByLightning(EntityLightningBolt entityLightningBolt) {
  136. super.onStruckByLightning(entityLightningBolt);
  137. int i = (int) this.posX;
  138. int j = (int) this.posY;
  139. int k = (int) this.posZ;
  140. Entity entity = this;
  141.  
  142. }
  143.  
  144. @Override
  145. public void fall(float l, float d) {
  146. super.fall(l, d);
  147. int i = (int) this.posX;
  148. int j = (int) this.posY;
  149. int k = (int) this.posZ;
  150. super.fall(l, d);
  151. Entity entity = this;
  152.  
  153. }
  154.  
  155. @Override
  156. public void onDeath(DamageSource source) {
  157. super.onDeath(source);
  158. int i = (int) this.posX;
  159. int j = (int) this.posY;
  160. int k = (int) this.posZ;
  161. Entity entity = this;
  162.  
  163. }
  164.  
  165. @Override
  166. public boolean processInteract(EntityPlayer entity, EnumHand hand, ItemStack stack) {
  167. super.processInteract(entity, hand, stack);
  168. int i = (int) this.posX;
  169. int j = (int) this.posY;
  170. int k = (int) this.posZ;
  171.  
  172. return true;
  173. }
  174.  
  175. @Override
  176. protected float getSoundVolume() {
  177. return 1.0F;
  178. }
  179.  
  180. }
  181.  
  182. // Date: 25/09/2016 23:02:44
  183. // Template version 1.1
  184. // Java generated by Techne
  185. // Keep in mind that you still need to fill in some blanks
  186. // - ZeuX
  187.  
  188. public static class ModelNew extends ModelBase {
  189. // fields
  190. ModelRenderer Shape1;
  191. ModelRenderer Shape2;
  192. ModelRenderer Shape3;
  193. ModelRenderer Shape4;
  194. ModelRenderer Shape5;
  195. ModelRenderer Shape6;
  196. ModelRenderer Shape7;
  197. ModelRenderer Shape8;
  198. ModelRenderer Shape9;
  199. ModelRenderer Shape10;
  200. ModelRenderer Shape11;
  201. ModelRenderer Shape12;
  202. ModelRenderer Shape13;
  203. ModelRenderer Shape14;
  204. ModelRenderer Shape15;
  205. ModelRenderer Shape16;
  206. ModelRenderer Shape17;
  207. ModelRenderer Shape18;
  208. ModelRenderer Shape19;
  209. ModelRenderer Shape20;
  210. ModelRenderer Shape21;
  211. ModelRenderer Shape22;
  212. ModelRenderer Shape23;
  213. ModelRenderer Shape24;
  214. ModelRenderer Shape25;
  215. ModelRenderer Shape26;
  216. ModelRenderer Shape27;
  217.  
  218. public ModelNew()
  219. {
  220. textureWidth = 128;
  221. textureHeight = 128;
  222.  
  223. Shape1
  224. Shape1 = new ModelRenderer(this, 34, 0);
  225. Shape1.addBox(0F, 0F, 0F, 3, 3, 3);
  226. Shape1.setRotationPoint(-2F, 16F, -6F);
  227. Shape1.setTextureSize(128, 128);
  228. Shape1
  229. setRotation(Shape1, 0F, 0F, 0F);
  230. Shape1.mirror = false;
  231. Shape2
  232. Shape2.addBox(0F, 0F, 0F, 9, 7, 5);
  233. Shape2.setRotationPoint(-5F, 14F, -3F);
  234. Shape2.setTextureSize(128, 128);
  235. Shape2
  236. setRotation(Shape2, 0F, 0F, 0F);
  237. Shape3 = new ModelRenderer(this, 49, 0);
  238. Shape3.addBox(0F, 0F, 0F, 3, 3, 3);
  239. Shape3.setRotationPoint(-2F, 20F, 2F);
  240. Shape3.setTextureSize(128, 128);
  241. Shape3
  242. setRotation(Shape3, 0F, 0F, 0F);
  243. Shape4 = new ModelRenderer(this, 62, 0);
  244. Shape4.addBox(0F, 0F, 0F, 1, 1, 1);
  245. Shape4.setRotationPoint(-1F, 21F, 5F);
  246. Shape4.setTextureSize(128, 128);
  247. Shape4
  248. setRotation(Shape4, 0F, 0F, 0F);
  249. Shape5 = new ModelRenderer(this, 67, 0);
  250. Shape5.addBox(0F, 0F, 0F, 3, 3, 3);
  251. Shape5.setRotationPoint(-2F, 20F, 6F);
  252. Shape5.setTextureSize(128, 128);
  253. Shape5
  254. setRotation(Shape5, 0F, 0F, 0F);
  255. Shape6 = new ModelRenderer(this, 0, 13);
  256. Shape6.addBox(0F, 0F, 0F, 3, 1, 6);
  257. Shape6.setRotationPoint(-2F, 15F, -11F);
  258. Shape6.setTextureSize(128, 128);
  259. Shape6
  260. setRotation(Shape6, 0F, 0F, 0F);
  261. Shape7 = new ModelRenderer(this, 19, 13);
  262. Shape7.addBox(0F, 0F, 0F, 3, 1, 6);
  263. Shape7.setRotationPoint(-2F, 19F, -11F);
  264. Shape7.setTextureSize(128, 128);
  265. Shape7
  266. setRotation(Shape7, 0F, 0F, 0F);
  267. Shape8 = new ModelRenderer(this, 43, 13);
  268. Shape8.addBox(0F, 0F, 0F, 1, 1, 1);
  269. Shape8.setRotationPoint(0F, 16F, -10F);
  270. Shape8.setTextureSize(128, 128);
  271. Shape8
  272. setRotation(Shape8, 0F, 0F, 0F);
  273. Shape9 = new ModelRenderer(this, 48, 13);
  274. Shape9.addBox(0F, 0F, 0F, 1, 1, 1);
  275. Shape9.setRotationPoint(0F, 16F, -8F);
  276. Shape9.setTextureSize(128, 128);
  277. Shape9
  278. setRotation(Shape9, 0F, 0F, 0F);
  279. Shape10 = new ModelRenderer(this, 38, 13);
  280. Shape10.addBox(0F, 0F, 0F, 1, 1, 1);
  281. Shape10.setRotationPoint(-1F, 16F, -11F);
  282. Shape10.setTextureSize(128, 128);
  283. Shape10
  284. setRotation(Shape10, 0F, 0F, 0F);
  285. Shape11 = new ModelRenderer(this, 58, 13);
  286. Shape11.addBox(0F, 0F, 0F, 1, 1, 1);
  287. Shape11.setRotationPoint(-2F, 16F, -8F);
  288. Shape11.setTextureSize(128, 128);
  289. Shape11
  290. setRotation(Shape11, 0F, 0F, 0F);
  291. Shape12 = new ModelRenderer(this, 53, 13);
  292. Shape12.addBox(0F, 0F, 0F, 1, 1, 1);
  293. Shape12.setRotationPoint(-2F, 16F, -10F);
  294. Shape12.setTextureSize(128, 128);
  295. Shape12
  296. setRotation(Shape12, 0F, 0F, 0F);
  297. Shape13 = new ModelRenderer(this, 68, 13);
  298. Shape13.addBox(0F, 0F, 0F, 1, 1, 1);
  299. Shape13.setRotationPoint(0F, 18F, -10F);
  300. Shape13.setTextureSize(128, 128);
  301. Shape13
  302. setRotation(Shape13, 0F, 0F, 0F);
  303. Shape14 = new ModelRenderer(this, 63, 13);
  304. Shape14.addBox(0F, 0F, 0F, 1, 1, 1);
  305. Shape14.setRotationPoint(0F, 18F, -8F);
  306. Shape14.setTextureSize(128, 128);
  307. Shape14
  308. setRotation(Shape14, 0F, 0F, 0F);
  309. Shape15 = new ModelRenderer(this, 73, 13);
  310. Shape15.addBox(0F, 0F, 0F, 1, 1, 1);
  311. Shape15.setRotationPoint(-1F, 18F, -11F);
  312. Shape15.setTextureSize(128, 128);
  313. Shape15
  314. setRotation(Shape15, 0F, 0F, 0F);
  315. Shape16 = new ModelRenderer(this, 78, 13);
  316. Shape16.addBox(0F, 0F, 0F, 1, 1, 1);
  317. Shape16.setRotationPoint(-2F, 18F, -8F);
  318. Shape16.setTextureSize(128, 128);
  319. Shape16
  320. setRotation(Shape16, 0F, 0F, 0F);
  321. Shape17 = new ModelRenderer(this, 83, 13);
  322. Shape17.addBox(0F, 0F, 0F, 1, 1, 1);
  323. Shape17.setRotationPoint(-2F, 18F, -10F);
  324. Shape17.setTextureSize(128, 128);
  325. Shape17
  326. setRotation(Shape17, 0F, 0F, 0F);
  327. Shape18
  328. Shape18.addBox(0F, 0F, 0F, 5, 5, 3);
  329. Shape18.setRotationPoint(-3F, 10F, 2F);
  330. Shape18.setTextureSize(128, 128);
  331. Shape18
  332. setRotation(Shape18, -0.5585054F, 0F, 0F);
  333. Shape19
  334. Shape19.addBox(0F, 0F, 0F, 3, 3, 2);
  335. Shape19.setRotationPoint(-2F, 9F, 3F);
  336. Shape19.setTextureSize(128, 128);
  337. Shape19
  338. setRotation(Shape19, -0.5585054F, 0F, 0F);
  339. Shape20 = new ModelRenderer(this, 12, 21);
  340. Shape20.addBox(0F, 0F, 0F, 1, 2, 1);
  341. Shape20.setRotationPoint(1F, 22F, 3F);
  342. Shape20.setTextureSize(128, 128);
  343. Shape20
  344. setRotation(Shape20, 0F, 0F, 0F);
  345. Shape21 = new ModelRenderer(this, 2, 21);
  346. Shape21.addBox(0F, 0F, 0F, 1, 2, 1);
  347. Shape21.setRotationPoint(1F, 22F, 7F);
  348. Shape21.setTextureSize(128, 128);
  349. Shape21
  350. setRotation(Shape21, 0F, 0F, 0F);
  351. Shape22 = new ModelRenderer(this, 7, 21);
  352. Shape22.addBox(0F, 0F, 0F, 1, 2, 1);
  353. Shape22.setRotationPoint(-3F, 22F, 3F);
  354. Shape22.setTextureSize(128, 128);
  355. Shape22
  356. setRotation(Shape22, 0F, 0F, 0F);
  357. Shape23 = new ModelRenderer(this, 7, 21);
  358. Shape23.addBox(0F, 0F, 0F, 1, 2, 1);
  359. Shape23.setRotationPoint(-3F, 22F, 7F);
  360. Shape23.setTextureSize(128, 128);
  361. Shape23
  362. setRotation(Shape23, 0F, 0F, 0F);
  363. Shape24 = new ModelRenderer(this, 0, 25);
  364. Shape24.addBox(0F, 0F, 0F, 3, 1, 3);
  365. Shape24.setRotationPoint(-2F, 19F, 2F);
  366. Shape24.setTextureSize(128, 128);
  367. Shape24
  368. setRotation(Shape24, 0F, 0F, 0F);
  369. Shape25 = new ModelRenderer(this, 0, 25);
  370. Shape25.addBox(0F, 0F, 0F, 3, 1, 3);
  371. Shape25.setRotationPoint(-2F, 19F, 6F);
  372. Shape25.setTextureSize(128, 128);
  373. Shape25
  374. setRotation(Shape25, 0F, 0F, 0F);
  375. Shape26 = new ModelRenderer(this, 0, 30);
  376. Shape26.addBox(0F, 0F, 0F, 1, 1, 3);
  377. Shape26.setRotationPoint(-1F, 20F, 9F);
  378. Shape26.setTextureSize(128, 128);
  379. Shape26
  380. setRotation(Shape26, 0.3316126F, 0.4886922F, 0F);
  381. Shape27 = new ModelRenderer(this, 0, 30);
  382. Shape27.addBox(0F, 0F, 0F, 1, 1, 3);
  383. Shape27.setRotationPoint(-1F, 20F, 9F);
  384. Shape27.setTextureSize(128, 128);
  385. Shape27
  386. setRotation(Shape27, 0.3490659F, -0.4886922F, 0F);
  387. }
  388.  
  389. public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
  390. {
  391. super.render(entity, f, f1, f2, f3, f4, f5);
  392. setRotationAngles(f, f1, f2, f3, f4, f5, entity);
  393.  
  394. Shape1
  395. Shape2
  396. Shape3
  397. Shape4
  398. Shape5
  399. Shape6
  400. Shape7
  401. Shape8
  402. Shape9
  403. Shape10
  404. Shape11
  405. Shape12
  406. Shape13
  407. Shape14
  408. Shape15
  409. Shape16
  410. Shape17
  411. Shape18
  412. Shape19
  413. Shape20
  414. Shape21
  415. Shape22
  416. Shape23
  417. Shape24
  418. Shape25
  419. Shape26
  420. Shape27
  421. }
  422.  
  423. private void setRotation(ModelRenderer model, float x, float y, float z) {
  424. model.rotateAngleX = x;
  425. model.rotateAngleY = y;
  426. model.rotateAngleZ = z;
  427. }
  428.  
  429. public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity e)
  430.  
  431. {
  432. super.setRotationAngles(f, f1, f2, f3, f4, f5, e);
  433.  
  434. }
  435.  
  436. }
  437.  
  438. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement