Jump to content

Demonly

Members
  • Posts

    18
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Demonly's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Can you post us the following file: build.gradle com.zeher.trzcore , is this class inside of your workspace, or is it inside an included jar?
  2. Actually I am personally starting to notice that as well with a variety of things, like how to set NBT to an entity and save it/read it later.
  3. Thank you! I didn't even think of looking at the horses location. I've got it working now. For future reference of those who want to see working code, enjoy: @Override protected void entityInit() { super.entityInit(); this.dataManager.register(int_Type, Integer.valueOf(0)); } @Override public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) { livingdata = super.onInitialSpawn(difficulty, livingdata); BlockPos pos = this.getPosition(); if (this.world.getBiome(pos).equals(Biomes.FOREST)) { System.out.println("Forest!"); setType(1); } if (this.world.getBiome(pos).equals(Biomes.SWAMPLAND)) { System.out.println("Swampland!"); setType(2); } if (this.world.getBiome(pos).equals(Biomes.TAIGA)) { System.out.println("Taiga!"); setType(3); } else { setType(1); } return livingdata; } public int getType() { return this.dataManager.get(int_Type).intValue(); } public void setType(int variant) { this.dataManager.set(int_Type, variant); }
  4. I'll post a bit of code to explain what's going on. Essentially, inside the Entity class I am attempting to use the DataManager to set it's type based on the Biome in which it spawns in. So: public class EntityDeer extends EntityMob { private static final DataParameter<Integer> int_Type = EntityDataManager.createKey(EntityDeer.class, DataSerializers.VARINT); public EntityDeer(World worldIn) { super(worldIn); this.setSize(1F, 1F); // DataManager // if (this.world.getBiome(getPosition()).equals(Biomes.FOREST)) { // System.out.println("FOREST!"); // System.out.println(getPosition()); // this.getDataManager().register(int_Type, 1); // } Upon setting that information based on which Biome it spawns in, I create a function to pull that data out so the Render can see which is set. public int getType() { if (int_Type != null) { return this.dataManager.get(int_Type); } return 1; } And finally rendering the actual deer. public final ResourceLocation WhiteTail = new ResourceLocation("deerly:animals/deer/deer_whitetail.png"); public final ResourceLocation Elk = new ResourceLocation("deerly:animals/deer/deer_elk.png"); public final ResourceLocation Reindeer = new ResourceLocation("deerly:animals/deer/deer_reindeer.png"); public RenderDeer(RenderManager renderManager) throws IOException { super(renderManager, new TabulaModel(new ModelManager().getContainer("assets/deerly/animals/Deer/Deer.tbl"), new AnimatorDeer()), 1.5F); } @Override protected ResourceLocation getEntityTexture(EntityDeer entity) { EntityDeer deer = (EntityDeer) entity; switch (deer.getType()) { case 1: return WhiteTail; case 2: return Elk; case 3: return Reindeer; } return WhiteTail; } My issue: How can I set the DataParameter inside the Entity class for that spawned entity BEFORE it spawns, whilst knowing the biome it is going to be spawning in. Or, Am I going about this the wrong way, and is there something similar I could be doing?
  5. Hello, Trying to work on getting my Deer model to have a specific texture upon spawn. I've worked out how to add into the DataManager, and how to render those multiple textures. However, I am having an issue trying to find out "where" the entity is going to spawn before it spawns. Any direction would be helpful. I've tried getting the Entity's position inside the Entity class, however that always turns out 0. The only time I am able to get the entity's position would be outside entityclass code, meaning the entity had already spawned, and at that point I can't register a DataParamater int to the entity I don't believe. As I said, any help/direction would be appreciated thanks,
  6. I have been able to load the models/textures through the Library. Thank you anyone / everyone for the help
  7. Honestly, was old code that I was trying to clean up.
  8. No worries, something from LLibrary (https://github.com/iLexiconn/LLibrary/wiki/Tabula-model-loader) that had caught my eye, I am checking something else out real quick going to see if it fixes it.
  9. What do you mean? I am sorry, a tad bit confused. Nvmd u retracted this.
  10. Hey, Few things before I post some code, I am using the following Library to assist in model imports: - LLibrary I was unsure if I should post this directly to the Library author, but I decided to come here first instead, maybe I misread something or am doing something stupid and someone else can point it out to me rather than me bugging someone who could be extremely busy. The code: EntityDeer package com.Demonly.animals.entity; import net.minecraft.entity.ai.EntityAIRunAroundLikeCrazy; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; public class EntityDeer extends EntityMob { public EntityDeer(World worldIn) { super(worldIn); this.setSize(1.5F, 1.5F); // AI Tasks this.tasks.addTask(1, new EntityAIWander(this, 5.0D)); this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); } public boolean isAIEnabled() { return true; } } RenderDeer package com.Demonly.animals.render; import java.io.IOException; import com.Demonly.animals.entity.EntityDeer; import net.ilexiconn.llibrary.client.model.tabula.TabulaModel; import net.ilexiconn.llibrary.client.model.tabula.TabulaModelHandler; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; public class RenderDeer extends RenderLiving<EntityDeer> { public RenderDeer(RenderManager renderManager) throws IOException { super(renderManager, new TabulaModel(TabulaModelHandler.INSTANCE.loadTabulaModel("assets/deerly/Deer1.tbl")), 2F); } @Override protected ResourceLocation getEntityTexture(EntityDeer entity) { // TODO Auto-generated method stub return null; } } ClientProxy package com.Demonly.proxy; import java.io.IOException; import com.Demonly.animals.entity.EntityDeer; import com.Demonly.animals.render.RenderDeer; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.client.registry.RenderingRegistry; public class ClientProxy implements CommonProxy { public void RegisterRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityDeer.class,new IRenderFactory<EntityDeer>(){ @Override public Render<? super EntityDeer> createRenderFor(RenderManager manager) { try { return new RenderDeer(manager); } catch (IOException e) { e.printStackTrace(); } return null; } }); } } AnimalRegistry package com.Demonly.animals; import com.Demonly.animals.entity.EntityDeer; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Biomes; import net.minecraftforge.fml.common.registry.EntityRegistry; public class AnimalRegistry { public void initCommon() { EntityRegistry.addSpawn(EntityDeer.class, 150, 15, 20, EnumCreatureType.AMBIENT, Biomes.FOREST); } } Main Class (Please ignore debugs) package com.Demonly; import java.io.IOException; import com.Demonly.animals.AnimalRegistry; import com.Demonly.animals.entity.EntityDeer; import com.Demonly.proxy.ClientProxy; import com.Demonly.proxy.CommonProxy; import net.ilexiconn.llibrary.client.model.tabula.TabulaModel; import net.ilexiconn.llibrary.client.model.tabula.TabulaModelHandler; import net.ilexiconn.llibrary.client.model.tabula.container.TabulaModelContainer; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.EntityRegistry; @Mod(dependencies = "required-after:llibrary@[1.7.7,)", modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_VERSIONS) public class Deerly { AnimalRegistry animals = new AnimalRegistry(); @Instance public static Deerly instance; @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS) public static CommonProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) throws IOException { TabulaModelContainer container = TabulaModelHandler.INSTANCE.loadTabulaModel("assets/deerly/Deer1.tbl"); System.out.println("TEST123: " + container.getAuthor()); int redColor = (255 << 16); int orangeColor = (255 << 16)+ (200 << 8); System.out.println("Deerly Starting"); EntityRegistry.registerModEntity(new ResourceLocation(Reference.MOD_ID, "Deer1"), EntityDeer.class, "Deer", 1, this, 50, 1, true, redColor, orangeColor); animals.initCommon(); } @EventHandler public void init(FMLInitializationEvent event) { animals.initCommon(); ClientProxy cproxy = new ClientProxy(); cproxy.RegisterRenders(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { animals.initCommon(); } } I feel as if I am doing something wrong inside of the ClientProxy class for how you register the entity, as I am not used to the new format, I am used to the old format. As of right now, the Entity spawns where it should, it has all the correct properties, however it's not getting the actual "Model Shape" that it should. The main class as a bit of testing, and it does indeed call the correct .getAuthor() inside of logs. Any and all help would be nice, thanks
  11. Thank you, Got it working. Much appreciation, can't believe I was missing the ItemBlock.
  12. Hey Everyone, Got some help last week, was great help, was able to do 90% of the things the guy told me to do, besides the new Registry System, and I am entirely not sure what I am doing wrong. I read through some other threads, and even have my custom Biome working perfectly fine with the new Registry System, however it seems I can't get this simple block to register correctly, I've tried multiple rendering techniques, all failing with a NPE on the "RENDER" part. If anyone can give me a slight push, I am not entirely sure what I am not getting. package com.demonly.netherexpansion.blocks; import com.demonly.netherexpansion.blocks.Molten_Obsidian.Molten_Obsidian; import com.demonly.netherexpansion.blocks.Skull_Block.Skull_block; import com.demonly.netherexpansion.util.Reference; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.b3d.B3DLoader; import net.minecraftforge.fml.common.registry.GameRegistry; public class BlocksRegistry { public static Skull_block testBlock; public static Molten_Obsidian MoltenObsidian; public static void preInitCommon() { //Registering Test_block - Old Method //testBlock = (Skull_block) (new Skull_block().setUnlocalizedName("test_block")); //GameRegistry.registerBlock(testBlock, "test_block").getUnlocalizedName().substring(5); //Registering MoltenObsidian - Old Method //MoltenObsidian = (Molten_Obsidian) (new Molten_Obsidian().setUnlocalizedName("Molten_Obsidian")); //GameRegistry.registerBlock(MoltenObsidian, "Molten_Obsidian").getUnlocalizedName().substring(5); //Testing new Method MoltenObsidian = new Molten_Obsidian(); MoltenObsidian.setUnlocalizedName("Molten_Obsidian"); MoltenObsidian.setRegistryName(MoltenObsidian.getUnlocalizedName()); GameRegistry.register(MoltenObsidian); } public static void initCommon() { } public static void postInitCommon() { } public static void registerRenders() { //Registering the Render of the Item of testBlock registerBlockRender(MoltenObsidian); //registerBlockRender(testBlock); } public static void registerBlockRender(Block block) { MoltenObsidian = new Molten_Obsidian(); Item render = Item.getItemFromBlock(block); //New Model Loader ModelLoader.setCustomModelResourceLocation(render, 0, (ModelResourceLocation) render.getRegistryName()); //Old Model Loader //Minecraft.getMinecraft().getRenderItem().getItemModelMesher() //.register(render, 0, new ModelResourceLocation(Reference.MOD_ID //+ ":" + render.getUnlocalizedName().substring(5), "inventory")); } }
  13. I'd actually like to know how to do this as well, I'm able to add new Biomes to the Overworld, but how do you add them to the Nether?
  14. Hey, This is such a great thing you've done. Much appreciation, hopefully everything can get updated to 1.9 eventually! Thanks!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.