Jump to content

DietmarKracht

Members
  • Posts

    43
  • Joined

  • Last visited

Everything posted by DietmarKracht

  1. There is a player#teleport method. Try to use this one instead.
  2. You need to set the shape, render shape and collision shape of the block.
  3. I have a block that has a working tile entity. If i place it in a world it works fine. However during the chunk generation inside a custom dimension the block is placed without the tile entity. It seems like the ChunkPrimer.setBlockState(...) does not add the TileEntity and thus it has to be added manually. I believe even the inital ticking behaviour has to be scheduled manually (no testing yet). Maybe i am missing something. Any help is appreciated. EDIT: Ticks do not have to be scheduled manually
  4. So i want to know if there is a way to change the rendering of a block to invisible and its collision shape accordingly to VoxelShape.empty() when certain conditions are met? The Block should be rendered as solid and have a collision shape by default. Can this be done inside the custom Block class? Or does RenderTypeLookup control this behaviour?
  5. This is basic java knowledge. Don't modify collections while iterating...
  6. So i have a custom dimension. It can be entered by activating an item. However if i exit the game while inside this dimension and then restart the game, i will spawn on the overworld at the coordinates i left my custom dimension. I think the custom dimension is not properly saved inside the ServerPlayer. Any changes made to the dimension are changed. Like placing or removing blocks. I use ServerPlayerEntity.teleport(...) to enter my dimension. This should actually set the reference to the new world(dimension) and thus it should be saved somewhere even if i restart the game. Am i missing something? SOLVED: I forgot to register the Chunkgenerator CODEC to the Registry
  7. Post your stacktrace. Also how do you register your event?
  8. If you want to do this for an item you can just make a layered model. Look into spawneggs json files.
  9. https://minecraft.fandom.com/wiki/Commands/team
  10. So i added a synchronization package. However it has to be noticed, that on the serverside the default stepheight is 1.0 but on the clientside it is 0.6. Is there a reason for this difference?
  11. So i tried to reset the stepheight of the player during the LivingEquipmentChangeEvent. However it seems like one side, either the client or the server doesn't seem to notice the change. Here is my Code: @SubscribeEvent public void armorUnEquip(LivingEquipmentChangeEvent event) { EquipmentSlotType slot = event.getSlot(); if (slot == EquipmentSlotType.FEET) { ItemStack stackFrom = event.getFrom(); ItemStack stackTo = event.getTo(); if (stackTo == ItemStack.EMPTY) { if (stackFrom.getItem() instanceof IUnEquip) { ((IUnEquip) stackFrom.getItem()).onUnEquip(event.getEntityLiving(), stackFrom); } } } } and in the armor item: @Override public void onArmorTick(ItemStack stack, World world, PlayerEntity player) { player.stepHeight = 1.25f; } @Override public void onUnEquip(LivingEntity entity, ItemStack stack) { if (entity instanceof PlayerEntity && stack.getItem() == this) { entity.stepHeight = 1.0f; } }
  12. Can someone tell me what class can read nbt and create a new entity from the tag? I just found this post, but the corresponding class does no longer exist or has been renamed so i can't find it
  13. I think you can subscribe to the GuiOpenEvent and check if the event.getGui is an InventoryScreen. Then just replace with you own gui and load the custom container
  14. You still did not understand what diesieben07 said. You need to change your private final SoundEvent to a RegistryObject<SoundEvent>. After that you call the RegistryObject.get() function everytime you need the SoundEvent.
  15. So the problem is inside your chocolate.java class you register the items including spawn eggs for the entities before the entities are registered. swap both inits and you should be good
  16. You need to paste your stacktrace when you get NPEs. The NPE might be due to calling the entity type before it was registered.
  17. I think what you are missing is the actual function to build your entity type. Just add .build() and it should be fine. Also dont use static initializers as @diesieben07 already said. Use RegistryObjects instead. Here is an example of how i register entity types: public static RegistryObject<EntityType<EntityItemUpgradable>> ENTITY_UPGRADABLE = ALL.register("upgradable_type", () -> EntityType.Builder.<EntityItemUpgradable>create(EntityItemUpgradable::new, EntityClassification.MISC) .build(new ResourceLocation(Main.MODID, "upgradable_type").toString()));
×
×
  • Create New...

Important Information

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