Jump to content

Sikino

Members
  • Posts

    3
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Sikino's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I know Java but I'm not the only one in this project and the others don't know and just want to make little mods without spending hours of development. I think that nobody will answer so thanks to all of you and goodbye.
  2. Yes your right for MCreator but I want to prevent a player to open an inventory of an other mod and we can't do that with MCreator so it generate the code but I modify it.
  3. I want to check is the block that the player see is a specific modded block and I don't find answers, can you help me ? This is the code : @Mod.EventBusSubscriber public class CookerCraftingModdedRestrictionsProcedure { @SubscribeEvent public static void onPlayerTick(TickEvent.PlayerTickEvent event) { if (event.phase == TickEvent.Phase.END) { execute(event, event.player.level, event.player); } } public static void execute(LevelAccessor world, Entity entity) { execute(null, world, entity); } private static void execute(@Nullable Event event, LevelAccessor world, Entity entity) { if (entity == null) return; if ((world.getBlockState(new BlockPos( entity.level.clip(new ClipContext(entity.getEyePosition(1f), entity.getEyePosition(1f).add(entity.getViewVector(1f).scale(5)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity)).getBlockPos().getX(), entity.level.clip(new ClipContext(entity.getEyePosition(1f), entity.getEyePosition(1f).add(entity.getViewVector(1f).scale(5)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity)).getBlockPos().getY(), entity.level.clip(new ClipContext(entity.getEyePosition(1f), entity.getEyePosition(1f).add(entity.getViewVector(1f).scale(5)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity)).getBlockPos().getZ()))) .getBlock().getRegistryName().equals(new ResourceLocation("minecraft", "diamond_ore"))) { if (entity instanceof Player _player) _player.closeContainer(); } } } I know it don't work but I don't find anything better. The imports aren't here but the error is not that. I want to prevent players from opening the inventory of a specific modded block (here it is vanilla and it is the diamond block but it will be modified) Hope you can help me.
×
×
  • Create New...

Important Information

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