Jump to content

hiotewdew

Members
  • Posts

    101
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by hiotewdew

  1. Thank you. I did know that they were old I wasn't really sure of the event I should be using. I have a question. Does the EntityEntry set have to be immutable? I converted my init function into a function that adds all the entity entries for all of my mobs to the set (non-final hashset) that is called before the registry set loop. Will that work? Also, for the resource location in the EntryBuilder, the number after is supposed to be modEntities++ (different number for each mob), right?
  2. So my users have been experiencing a bug while using personal modpacks with my mod. For some reason, my animals spawn exceptionally fast (50+ per 4 chunks). But only sometimes. I have tested this with both my users trying to recreate a world seed with only BOP or traverse and remove all their other mods, and the bug seems to go away. I compared the modlists of 4 users experiencing the bug and found they share: - Biomes O Plenty/Traverse (either) - LLibrary - DynamicSurroundings - Bibliocraft I had one user remove DynamicSurroundings and nothing changed. Have not tested Bibliocraft, but there's no reason why it would mess with mob spawning. This is my mob registry. https://github.com/itsmeow/betteranimalsplus/blob/master/src/main/java/its_meow/betteranimalsplus/init/MobRegistry.java I register as EnumCreatureType.MONSTER because if I set them to creature they don't seem to spawn. Any ideas? (Ignore the BiomeType code, it's messy, but essentially you put a set of biome sets and it has to convert to an array with all of them) Users mostly discover high spawns of the Deer and the Lammergeier. I have tried setting getMaxSpawnedInChunk but it doesn't seem to do anything.
  3. I don't know the problem, but in the future, to avoid issues like this, please use version control. For example, use Git and use GitHub to store your code online and view past code in a more organized way.
  4. Yeah, I just figured out it was the syncing that was the issue. That seems to have fixed it. Thanks! I read somewhere that those two were only nessecary for stuff related to capabilities.
  5. https://github.com/itsmeow/betteranimalsplus/blob/master/src/main/java/its_meow/betteranimalsplus/block/TileEntityHandOfFate.java After doing all the suggested the problem still persists.
  6. I'm aware at least 50000 threads exist with this exact topic. And trust me, I have read them. But my tile entity just refuses to save/sync data. Here's my code. package its_meow.betteranimalsplus.block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class TileEntityHandOfFate extends TileEntity { private boolean onFire = false; public TileEntityHandOfFate() { } public void setOnFire(boolean b) { this.onFire = b; this.markDirty(); } public boolean isOnFire() { return onFire; } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); this.onFire = compound.getBoolean("OnFire"); } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); compound.setBoolean("OnFire", this.onFire); return compound; } @Override public SPacketUpdateTileEntity getUpdatePacket() { NBTTagCompound tag = new NBTTagCompound(); this.writeToNBT(tag); return new SPacketUpdateTileEntity(pos, 1, tag); } @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) { readFromNBT(packet.getNbtCompound()); world.scheduleUpdate(this.pos, this.blockType, 100); } @Override @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { return new AxisAlignedBB(getPos().add(-2, -4, -2), getPos().add(2, 4, 2)); } } Yes, the tile entity is registered and exists. It has a TESR that renders fire (the render method uses the isOnFire() method and creates fire particles). When I exit the world and reload it (not even leave game) the fire disappears. Nothing external to this touches the NBT.
  7. I could, but the Block Registry requires it to extend ItemBlock.
  8. I made a seperate wearable item and a seperate placeable item instead of an ItemBlock with armor attributes. Apparently minecraft requires it to extend ItemArmor for getArmorModel() to work. A shame.
  9. Bump Here's my code: http://github.com/itsmeow/betteranimalsplus
  10. I have an ItemBlock connected that's tied to a block and I want it to be wearable as a helmet (it's a mob skull) and I have the block fully working but when I put it on as a helmet it just uses the JSON model for the Item (a flat texture) instead of the armor model that I define in the ItemBlock class. //In the itemblock class: @Override public boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity) { return armorType == EntityEquipmentSlot.HEAD; } @Override public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { return Ref.MOD_ID + ":textures/entites/hirschgeist.png"; } @Override @SideOnly(Side.CLIENT) public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped defaultModel) { return ClientProxy.helmetModel; } //Client Proxy public static final ModelHirschgeistSkullArmorPiece helmetModel = new ModelHirschgeistSkullArmorPiece(0.0625F); //Block registry events /** * Register this mod's {@link Block}s. * * @param event The event */ @SubscribeEvent public static void registerBlocks(final RegistryEvent.Register<Block> event) { final IForgeRegistry<Block> registry = event.getRegistry(); final Block[] blocks = { trillium, hirschgeistskull, }; registry.registerAll(blocks); GameRegistry.registerTileEntity(TileEntityTrillium.class, new ResourceLocation(Ref.MOD_ID + ":" + trillium.getRegistryName())); GameRegistry.registerTileEntity(TileEntityHirschgeistSkull.class, Ref.MOD_ID + ":" + hirschgeistskull.getRegistryName()); } /** * Register this mod's {@link ItemBlock}s. * * @param event The event */ @SubscribeEvent public static void registerItemBlocks(final RegistryEvent.Register<Item> event) { final ItemBlock[] items = { new ItemBlock(trillium), hirschgeistskull.getItemBlock(), }; final IForgeRegistry<Item> registry = event.getRegistry(); for (final ItemBlock item : items) { final Block block = item.getBlock(); final ResourceLocation registryName = Preconditions.checkNotNull(block.getRegistryName(), "Block %s has null registry name", block); registry.register(item.setRegistryName(registryName)); ITEM_BLOCKS.add(item); } } How should I be registering the model? The Block is a TE with a TESR and that's registered, but I'm not sure how I should register my model. If I use ModelLoader.setCustomModelResourceLocation it's just the item texture on my head, not the java model. I put a print statement in getArmorModel and it doesn't seem like it's running. By the way, getItemBlock(); returns a new instance of my ItemBlock class.
  11. So I have an advanced rendering problem here. I understand that in order to add transparency you call GlStateManager.enableAlpha() and use GlStateManager(1,1,1,alpha) to change transparency. However, I have a ghost deer with bones inside that I want to be opaque. How would I go about making only some of these transparent while they are still children of each other? Even better: is there a way I can keep the skeleton and the outer ghost layer seperate but have the rotations match (keep them attached without having their rendering attached?) Here's what I want it to look like. I also seem to have this bug only the front ribs are visibile. The rest seemed to have disappeared as well as the hip area/leg attachment bones. On the side, if anyone knows how I can keep a particle at a specific position (relative to the entity's heading)/attached to piece, I also need to know how to do that without using translates and some trig. I'm not expecting for every part of this to be answered, as it is definitely an advanced question. I'm almost certain I'll have to figure out the invisible bones on my own, but if anyone has anything that could help with any of the above problems it would be great! Thanks!
  12. Sorry, this won't work for me. However, I found a solution. Instead of riding the attacked entity, it sets the attacked to ride IT and then overrides the updatePassenger method and sets the position of the attacked to below it. @Override public void updatePassenger(Entity passenger) { if (this.isPassenger(passenger)) { float f1 = (float)((this.isDead ? 0.009999999776482582D : this.getMountedYOffset()) + passenger.getYOffset()); passenger.setPosition(this.posX, this.posY - passenger.height - 0.05, this.posZ); this.applyOrientationToEntity(passenger); } }
  13. The velocity won't change on the grabber if it's riding something, so I can't apply its velocity
  14. I have a flying mob that is supposed to grab on to an entity (ride the entity) and lift it upwards and drop it. I have the drop/lift fully set up but the only problem is the bird can't actually control movement while riding something. Is there something I can override to allow it to move while a passenger (and take the ridden entity with it)?
  15. For the life of me I cannot understand HOW MapSavedData works. I know it's NBT but it's not traditional in any way whatsoever. I am trying to store many String values (or if possible custom Enums) into NBT with different keys. normally, I would call compound.setString("mykey", "data") but MapSavedData does not do this. Instead I am left with MapStorage.getWorldData() and some need-to-be implemented readFromNBT and writeFromNBT. It has something to do with MapStorage.getOrLoadData(); and MapStorage.setData(); which I think writes the class into the world? Do the classes only store ONE value? I want a compound that saves into the map. I feel very stupid, but I've searched all I can and read the documentation and STILL I cannot understand.
  16. use if(world.isRemote) { player.sendMessage(new TextComponentString("Message Here")); } EDIT: Nevermind. You want the player to send messages into the chat box? WHY?!? Just run the command's execute function directly.
  17. I'm creating a mod that has ore chunks remember where they were mined at. This works fine when a player is the one mining, but I plan to add mining vehicles with storage. I'm currently using onUpdate to store the chunk location it was mined at in NBT, but onUpdate only executes when the item is held by a player. If I make the item and it goes directly into a container, it will not store where it was created. Is there a method in the Item class I can somehow use to store data into the ItemStack NBT when it is created? onCreated is for the item instance. @Override public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { BlockPos playerPos = entityIn.getPosition(); Chunk creationChunk = worldIn.getChunkFromBlockCoords(playerPos); if(stack.getTagCompound() == null) { stack.setTagCompound(new NBTTagCompound()); } NBTTagCompound tagcompound = stack.getTagCompound(); int[] chunk = tagcompound.getIntArray("chunk"); if(chunk.length == 0) { int[] array = { creationChunk.x, creationChunk.z }; tagcompound.setIntArray("chunk", array); stack.setTagCompound(tagcompound); } super.onUpdate(stack, worldIn, entityIn, itemSlot, isSelected); }
  18. Also, I would heavily suggest embedding an InitModel function within your block classes. @SideOnly(Side.CLIENT) public void initModel() { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory")); } That way when you run onRegsiterModels, you can just call Items.STARRECORD.initModel(); Also, blockstates aren't used for items! Only models are nessecary. Don't worry about a blockstate json.
  19. @SideOnly(Side.CLIENT) @SubscribeEvent public static void onRegisterModels(ModelRegistryEvent event) { ModelLoader.setCustomModelResourceLocation(Items.STARRECORD, 0, new ModelResourceLocation("starrecord", "inventory")); System.out.println("record registry name is = " + Items.STARRECORD.getRegistryName()); System.out.println("record unlocalized name is = " + Items.STARRECORD.getUnlocalizedName()); } This needs to be new ModelResourceLocation("record.starrecord", "inventory").
  20. I would make a new project in a little better of a folder. Hidden appdata folders are not a good place to have configuration heavy IDE projects.
  21. Also try running attrib -R -H /D /S C:\Users\Reece\AppData\Roaming\.minecraft This will remove both the hidden and read-only attributes from .minecraft and all of its subfolders and files.
×
×
  • Create New...

Important Information

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