• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hello, I wanted to know, is it possible to add a condition at the level of the result tag? Basically I would like to make sure that some craft is only accessible from a certain level of profession (I already have the capa system).
    • Hi, i'm updating my mod and i have some problems with networking. When i use my packet in a command to give points to the players it only changes in the client     public class Handler { private static final String PROTOCOL_VERSION = Integer.toString(1); public static SimpleChannel INSTANCE; public static void register() { INSTANCE = NetworkRegistry.ChannelBuilder .named(new ResourceLocation(Main.MODID, "main")) .clientAcceptedVersions(PROTOCOL_VERSION::equals) .serverAcceptedVersions(PROTOCOL_VERSION::equals) .networkProtocolVersion(() -> PROTOCOL_VERSION) .simpleChannel(); int id = 0; INSTANCE.messageBuilder(PacketPoints.class, id++) .decoder(PacketPoints::new) .encoder(PacketPoints::encode) .consumer(PacketPoints::handle) .add(); } } PacketPoints message: public class PacketPoints { private int quantity; private UUID playerUuid; public PacketPoints(){} public PacketPoints(PacketBuffer buf) { this.quantity = buf.readInt(); this.player = buf.readUniqueId(); } public PacketPoints(int pQuantity, UUID pPlayerUuid) { this.quantity = pQuantity; this.playerUuid = pPlayerUuid; } public void encode(PacketBuffer buf) { buf.writeInt(quantity); buf.writeUniqueId(playerUuid); } public void handle(Supplier<NetworkEvent.Context> context) { context.get().enqueueWork(() -> { PlayerEntity player = Minecraft.getInstance().player.world.getPlayerByUuid(playerUuid); if(player != null) { IPlayerData cap = PlayerData.getPlayerData(player); cap.setPoints(quantity); } }); context.get().setPacketHandled(true); } } Main class: private void setup(final FMLCommonSetupEvent event) { registerCapabilities(); Handler.register(); }  
    • Never mind. I just realized that it's not an actual loot table but it's actually just a Resource Location... Sorry...
    • Don't you have to register it? I want to assign the loot table to a chest in my structure generation code, it's not for a block or entity.   I want to do something like this: protected void handleDataMarker(String function, BlockPos pos, IWorld worldIn, Random rand, MutableBoundingBox sbb) { if ("chest".equals(function)) { worldIn.setBlockState(pos, Blocks.CHEST.getDefaultState().with(ChestBlock.WATERLOGGED, Boolean.valueOf(worldIn.getFluidState(pos).isTagged(FluidTags.WATER))), 2); TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof ChestTileEntity) { ((ChestTileEntity)tileentity).setLootTable(this.isLarge ? LootTables.CHESTS_UNDERWATER_RUIN_BIG : LootTables.CHESTS_UNDERWATER_RUIN_SMALL, rand.nextLong()); } } } That code is taken from the Ocean Ruin Structure, as you can see they load a loot table, register it and then access it from the Ocean Ruin Structure.
  • Topics

  • Who's Online (See full list)