Jump to content

harison513

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by harison513

  1. Thanks, am I supposed to override Entity#createSpawnPacket with it? Like... @Override public IPacket<?> createSpawnPacket() { return NetworkHooks.getEntitySpawningPacket(this); }
  2. I've implemented IEntityAdditionalSpawnData in my entity class but neither writeSpawnData nor readSpawnData ever seemed to be called? @Override public void writeSpawnData(PacketBuffer buf) { buf.writeInt(test); } @Override public void readSpawnData(PacketBuffer buf) { test = buf.readInt(); No breakpoints are ever hit, nor is anything logged in the console if I try. Am I missing something?
  3. I'm trying to override CreatureEntity:canSpawn in my custom entity to prevent certain spawns, however even when I just return false the entities still spawn. I could be wrong but to me this line in WorldEntitySpawner::performNaturalSpawning doesn't make much sense (line 126): if (canSpawn == -1 || (canSpawn == 0 && d0 > 16384.0D && (mobentity.canDespawn(d0) || !mobentity.canSpawn(p_222263_1_, SpawnReason.NATURAL) || !mobentity.isNotColliding(p_222263_1_)))) { break label115; } About a 1/4 of the way in where it says d0 > 16384.0D. I believe d0 is the distance squared from the player to the attempted spawn location, so in this case it means if the distance isn't greater than 16384 CreatureEntity:canSpawn won't be called and it will just keep going about spawning the entity. Please let me know if I've missed anything.
  4. @SubscribeEvent @SideOnly(Side.CLIENT) public static void registerRenders(ModelRegistryEvent event) { ModelBakery.registerItemVariants(ModItems.EXAMPLE_ITEM, new ModelResourceLocation(ModItems.EXAMPLE_ITEM.getRegistryName(), "inventory")); for (ItemType itemType : ItemType.itemTypes) { ModelBakery.registerItemVariants(ModItems.EXAMPLE_ITEM, itemType.itemModel); } ModelLoader.setCustomMeshDefinition(ModItems.EXAMPLE_ITEM, new ItemMeshDefinition() { @Override public ModelResourceLocation getModelLocation(ItemStack stack) { if (stack.getTagCompound() != null) { return new ModelResourceLocation(Mod.MODID + ":" + stack.getTagCompound().getString("ItemType"), "inventory"); } else { return new ModelResourceLocation(Mod.MODID + ":" + defaultTexture, "inventory"); } } }); } Here's an example of what I mean. You would register all the model variants for your item, then use the getModelLocation method to return a different model depending on itemstack properties. Apologies if that was unclear. This was for 1.12.2, not even sure if this was the correct way to do it, but I can't work out the way to do it for 1.13.2.
  5. Minecraft#player is client only, you should be getting the player from the event argument.
  6. Didn't know PlayerEvent.StartTracking existed so thanks, that has solved my problem.
  7. I have a capability attached to an entity. It's saved to nbt when you exit the world. When I next load the world I want that capability to be synced to the client (after it has loaded the data back from the serialised nbt). I have tried sending a packet to the client using the EntityJoinWorldEvent, however, at this point the capability hasn't been attached to the entity on client, so the packet is useless. At what point can I send a packet to sync the client and server? Is this the correct way to sync the two on the world load?
  8. I am getting this error when trying to run the test server: java.lang.RuntimeException: Attempted to load class net/minecraft/client/renderer/entity/Render for invalid dist DEDICATED_SERVER It is because of: private void registerRenders(ModelRegistryEvent e) { RenderingRegistry.registerEntityRenderingHandler(EntityTest.class, (RenderManager manager) -> new RenderTestEntity(manager)); } I thought using this might prevent that from happening but it does not: DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { MinecraftForge.EVENT_BUS.addListener(this::registerRenders); }); What can I do to prevent the server from trying to load client side classes?
  9. Thanks. I was thinking along the lines of sending a packet from server to client to then perform whatever action I needed.
  10. Is there a proper way to set up client side commands like there was in 1.12.2 with IClientCommand and ClientCommandHandler (something like that, can't remember off the top of my head) or do I need to just use packets to do it all? Thanks.
  11. Yeah sorry about the bump, won't do it again. But thanks nonetheless.
  12. I am testing out templates and am trying to write one to NBT to see the structure of the NBT tag, however, even though I am just loading a vanilla file, it always throws an out of range exception. Template template = server.getStructureTemplateManager().getTemplate(new ResourceLocation("minecraft:shipwreck/sideways_fronthalf_degraded")); NBTTagCompound c = template.writeToNBT(new NBTTagCompound()); Looking at the actual Template::writeToNBT method, it looks like here the first j is supposed to be an l, as in this case 'blocks' has only 8 items, but each of those items has 250+ plus inside them and looking at the surrounding for loops this seems to make sense. for(int l = 1; l < this.blocks.size(); ++l) { Template.BasicPalette template$basicpalette1 = list.get(l); template$basicpalette1.addMapping((this.blocks.get(j).get(j)).blockState, k); } Am I missing something here? I am just trying to write a vanilla template to NBT and it fails?
  13. Ok, yeah. I saw that there was an EnumCreatureType.create() method but all it does is throw an exception, so I am assuming it just hasn't been implemented yet?
  14. Is there a way in 1.13.2 to create a custom EnumCreatureType? Previously there was EnumHelper but that no longer exists I don't believe.
  15. https://github.com/sinkillerj/ProjectE/tree/mc1.13.x/src/main/java/moze_intel/projecte/network Try that.
  16. Wait, nope I am an idiot again. I wasn't looking at the 1.13 branch...
  17. ... oh. Errr yeah, I knew that was there... On another note, the packets inside that repo all implement IMessage but that interface doesn't appear to exist anymore (like it did in 1.12.2) nor can I find it anywhere else in the repo. Am I missing something else really obvious?
  18. How has packet handling changed in 1.13.2, I cannot find any information on it. Previously you had to implement the IMessage interface and so on, but now that doesn't exist. Cheers.
  19. So I was wondering if there was a way to check that a path to a block for an entity would still exist after removing that block. E.g in my AI class: world.setBlockToAir(pos); // Check for path to block world.setBlockState(pos, originalState); I've tried this approach but it doesn't seem to work. Does the block not actually get updated until the next tick? And so still exists when I'm checking for a path? Or have I overlooked something and maybe this isn't really feasible? Thanks!
×
×
  • Create New...

Important Information

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