Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

TheTrueSCP

Members
  • Posts

    60
  • Joined

  • Last visited

Posts posted by TheTrueSCP

  1. Hello,

    Sorry for writing back again but despite several attempts I did not manage to change/create the tags. They always have the value 0.0
    here's my code:

    package net.the_goldbeards.lootdebugs.Items.Weapons.Drills;
    
    import net.minecraft.core.BlockPos;
    import net.minecraft.nbt.CompoundTag;
    import net.minecraft.network.chat.Component;
    import net.minecraft.network.chat.TextComponent;
    import net.minecraft.network.chat.TranslatableComponent;
    import net.minecraft.sounds.SoundSource;
    import net.minecraft.tags.BlockTags;
    import net.minecraft.tags.Tag;
    import net.minecraft.util.Mth;
    import net.minecraft.world.InteractionHand;
    import net.minecraft.world.InteractionResult;
    import net.minecraft.world.InteractionResultHolder;
    import net.minecraft.world.entity.EquipmentSlot;
    import net.minecraft.world.entity.LivingEntity;
    import net.minecraft.world.entity.player.Player;
    import net.minecraft.world.item.*;
    import net.minecraft.world.item.context.UseOnContext;
    import net.minecraft.world.item.enchantment.Enchantment;
    import net.minecraft.world.level.ItemLike;
    import net.minecraft.world.level.Level;
    import net.minecraft.world.level.block.Block;
    import net.minecraft.world.level.block.Blocks;
    import net.minecraft.world.level.block.TorchBlock;
    import net.minecraft.world.level.block.state.BlockState;
    import net.minecraftforge.api.distmarker.Dist;
    import net.minecraftforge.api.distmarker.OnlyIn;
    import net.minecraftforge.common.Tags;
    import net.the_goldbeards.lootdebugs.util.ModSounds;
    import net.the_goldbeards.lootdebugs.util.ModTags;
    import org.jetbrains.annotations.Nullable;
    
    
    import java.util.List;
    
    public class DrillsItem extends Item
    {
    
    
    
    
        @Override
        public int getItemStackLimit(ItemStack stack) {
            return 1;
        }
    
        public DrillsItem(Properties pProperties, float FUELAMMOUNT) {
            super(pProperties);
    
            ItemStack pStack = new ItemStack(this);
            pStack.getOrCreateTag().putFloat("lootdebugs.drillfuel", FUELAMMOUNT);
    
        }
    
    
    
        @Override
        public InteractionResult useOn(UseOnContext pContext) {
    
            ItemStack pStack = new ItemStack(pContext.getPlayer().getItemInHand(pContext.getHand()).getItem());
            pStack.getOrCreateTag().putFloat("lootdebugs.drillfuel", 12f);//Debug
    
    
    
    
    
    
            return InteractionResult.PASS;
        }
    
    
    
        @Override
        public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List<Component> pTooltipComponents, TooltipFlag pIsAdvanced) {
    
    
    
                Float val = pStack.getOrCreateTag().getFloat("lootdebugs.drillfuel");
                pTooltipComponents.add(new TextComponent(val.toString()));
    
    
        }
    }

     

    Thanks

  2. Hello everyone,

    I need help with my code. I want to make drills that consume fuel. At first I wanted to use the damage bar, but then I decided to use tooltips to show the amount of fuel. And here is my problem: I created a variable that is the amount of fuel. But when I use a drill, ALL the drills consume fuel instead of just the one. I know that this happens because I reduce the fuel for all drills with "fuel--;"(static context). How could I relate the consumption to the one that actually uses the fuel?

    The DrillsClass:

    package net.the_goldbeards.lootdebugs.Items.Weapons.Drills;
    
    import net.minecraft.core.BlockPos;
    import net.minecraft.network.chat.Component;
    import net.minecraft.network.chat.TextComponent;
    import net.minecraft.network.chat.TranslatableComponent;
    import net.minecraft.sounds.SoundSource;
    import net.minecraft.tags.BlockTags;
    import net.minecraft.tags.Tag;
    import net.minecraft.util.Mth;
    import net.minecraft.world.InteractionHand;
    import net.minecraft.world.InteractionResult;
    import net.minecraft.world.InteractionResultHolder;
    import net.minecraft.world.entity.EquipmentSlot;
    import net.minecraft.world.entity.LivingEntity;
    import net.minecraft.world.entity.player.Player;
    import net.minecraft.world.item.*;
    import net.minecraft.world.item.context.UseOnContext;
    import net.minecraft.world.level.ItemLike;
    import net.minecraft.world.level.Level;
    import net.minecraft.world.level.block.Block;
    import net.minecraft.world.level.block.Blocks;
    import net.minecraft.world.level.block.TorchBlock;
    import net.minecraft.world.level.block.state.BlockState;
    import net.minecraftforge.common.Tags;
    import net.the_goldbeards.lootdebugs.util.ModSounds;
    import net.the_goldbeards.lootdebugs.util.ModTags;
    
    
    import javax.annotation.Nullable;
    import java.util.List;
    
    public class DrillsItem extends Item
    {
    //All fuel sync
    public int MAXFUEL = 320 * 2;//320 Blöcke Max * height drills
    public int FUEL = 120;//Default Fuel
    
    public float MAXFUELDISPLAY = 44; // 44L
    public float FUELDISPLAY = this.MAXFUELDISPLAY/this.MAXFUEL * this.FUEL;
    
    
        public DrillsItem(Properties pProperties) {
            super(pProperties);
        }
    
        @Override
        public boolean isDamageable(ItemStack stack) {
            return true;
        }
    
    
        @Override
        public InteractionResult useOn(UseOnContext pContext) {
    
            System.out.println(this.FUEL);
    
            Player player = pContext.getPlayer();
    
            BlockPos posBlock = pContext.getClickedPos();
            BlockPos posBlockDown = pContext.getClickedPos().above();
    
            Level level = pContext.getLevel();
    
            Block block = level.getBlockState(posBlock).getBlock();
            Block blockDown = level.getBlockState(posBlockDown).getBlock();
    
    
            if(!isFuelEmpty() && !ModTags.Blocks.MC_ORES.contains(block) &&  !ModTags.Blocks.MC_ORES.contains(blockDown) && !isFuel(block))//The Block isnt a MC Ore, the FUel is not empty and the taget block isnt a Coal BLock
            {
    
                //Break Block
                if (block != Blocks.OBSIDIAN && block != Blocks.BEDROCK) {//and the block isnt a Unbreakable block like obsidian and BedrocK
                    level.destroyBlock(posBlock, true);
    
    
                    if (blockDown != Blocks.OBSIDIAN && blockDown != Blocks.BEDROCK) {//block above
                        level.destroyBlock(posBlockDown, true);
                    }
                }
                level.playSound(player, posBlock, ModSounds.LLOYD_INTERACTION.get(), SoundSource.BLOCKS, 1, 1);
                if (!player.isCreative())//If the player is in creative mode, the drills should not loose fuel
                {
    
                    this.FUEL--;
                }
            }
    
            //Refuel
            else if (isFuel(block) && CanRefuel())//If the block is an Coal Block/Ore,and the Drills can Refuel,  the drills refuel and destroy the block
            {
    
    
                if(block == Blocks.COAL_ORE)
                {
    
                  this.FUEL = this.FUEL + 10;//+10
                    level.destroyBlock(posBlock, false);
                    level.destroyBlock(posBlock, false);
                    level.destroyBlock(posBlock, false);
    
                }
                else
                { this.FUEL = this.FUEL+40;//+40
                    level.destroyBlock(posBlock, false);
                    level.destroyBlock(posBlock, false);
                    level.destroyBlock(posBlock, false);
    
    
                }
                level.destroyBlock(posBlock, false);
    
                if(this.FUEL > this.MAXFUEL)
                {
                    this.FUEL = this.MAXFUEL;
                }
    
            }
    
            return super.useOn(pContext);
        }
    
    
        public boolean isFuelEmpty()
        {
            return  this.FUEL <= 0;
        }
    
        public boolean CanRefuel()
        {
            return this.FUEL < this.MAXFUEL;
        }
    
    
        public boolean isFuel(Block block)
        {
            return block == Blocks.COAL_ORE || block == Blocks.COAL_BLOCK;
        }
    
        @Override
        public void appendHoverText(ItemStack stack, @Nullable Level pLevel, List<Component> tooltip, TooltipFlag flagIn) {
    
            this.FUELDISPLAY = this.MAXFUELDISPLAY/this.MAXFUEL * this.FUEL;
            tooltip.add(new TextComponent(Math.round(this.FUELDISPLAY) + "L" +"/" + Math.round(this.MAXFUELDISPLAY) + "L"));
            super.appendHoverText(stack, pLevel, tooltip, flagIn);
        }
    
        @Override
        public void onUseTick(Level pLevel, LivingEntity pLivingEntity, ItemStack pStack, int pRemainingUseDuration) {
            this.FUELDISPLAY = this.MAXFUELDISPLAY/this.MAXFUEL * this.FUEL;
        }
    }



    Thanks in advance

  3. Hi, the Coder here,

    we have an block, that should only be placed, when the Player is crouching. I've extended the Class with BushBlock, because i need the mayPlaceOn method.

    An example Class:
     

    package net.the_goldbeards.lootdebugs.Block.Drinks;
    
    import net.minecraft.core.BlockPos;
    import net.minecraft.world.item.context.BlockPlaceContext;
    import net.minecraft.world.level.BlockGetter;
    import net.minecraft.world.level.LevelAccessor;
    import net.minecraft.world.level.block.*;
    import net.minecraft.world.level.block.state.BlockState;
    import net.minecraft.world.level.block.state.StateDefinition;
    import net.minecraft.world.level.block.state.properties.DirectionProperty;
    import net.minecraft.world.phys.shapes.CollisionContext;
    import net.minecraft.world.phys.shapes.Shapes;
    import net.minecraft.world.phys.shapes.VoxelShape;
    import net.the_goldbeards.lootdebugs.util.ModTags;
    import org.jetbrains.annotations.Nullable;
    
    public class GlyphidSlammerBlock extends BushBlock {
    
        public GlyphidSlammerBlock(Properties properties) {
            super(properties);
        }
        private static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
    
        private static final VoxelShape SHAPE_N = Shapes.or(
                Block.box(2.226120000000001, 4.9, 6.999999999999998, 4.97612, 6, 8.999999999999998),
                Block.box(2.726120000000001, 5.75, 7.499999999999998, 3.726120000000001, 6.75, 8.499999999999998),
                Block.box(2.476120000000001, 5.551115123125783e-17, 7.499999999999998, 3.476120000000001, 1, 8.499999999999998),
                Block.box(2.476120000000001, 3.1500000000000004, 7.499999999999998, 3.976120000000001, 4.9, 8.499999999999998),
                Block.box(1.9761200000000012, 0.7500000000000004, 7.399999999999999, 3.976120000000001, 2.7500000000000004, 8.599999999999998),
                Block.box(1.8761200000000016, 1.5000000000000004, 7.299999999999999, 4.076120000000001, 2.8000000000000007, 8.699999999999998),
                Block.box(2.1261200000000016, 2.3, 7.399999999999999, 4.076120000000001, 3.3, 8.599999999999998),
                Block.box(4.97612, 0, 6.999999999999998, 5.97612, 7, 8.999999999999998),
                Block.box(9.97612, 0, 6.999999999999998, 10.97612, 7, 8.999999999999998),
                Block.box(6.87612, 5, 9.899999999999999, 9.076119999999998, 6.6, 11.499999999999998),
                Block.box(6.87612, 5, 9.899999999999999, 9.076119999999998, 6.6, 11.499999999999998),
                Block.box(4.47612, 5, 6.899999999999999, 6.0761199999999995, 6.6, 9.099999999999998),
                Block.box(6.87612, 5, 9.899999999999999, 9.076119999999998, 6.6, 11.499999999999998),
                Block.box(6.87612, 5, 4.499999999999998, 9.076119999999998, 6.6, 6.099999999999998),
                Block.box(6.87612, 5, 4.499999999999998, 9.076119999999998, 6.6, 6.099999999999998),
                Block.box(9.876120000000002, 5, 6.899999999999999, 11.47612, 6.6, 9.099999999999998),
                Block.box(4.47612, 5, 6.899999999999999, 6.0761199999999995, 6.6, 9.099999999999998),
                Block.box(4.72612, 6.1, 6.799999999999999, 6.0761199999999995, 7.1, 9.199999999999998),
                Block.box(6.776120000000001, 6.1, 9.899999999999999, 9.17612, 7.1, 11.249999999999998),
                Block.box(9.876120000000002, 6.1, 6.799999999999999, 11.22612, 7.1, 9.199999999999998),
                Block.box(6.776120000000001, 6.1, 9.899999999999999, 9.17612, 7.1, 11.249999999999998),
                Block.box(4.72612, 6.1, 6.799999999999999, 6.0761199999999995, 7.1, 9.199999999999998),
                Block.box(4.72612, 6.1, 6.799999999999999, 6.0761199999999995, 7.1, 9.199999999999998),
                Block.box(6.776120000000001, 6.1, 4.749999999999998, 9.17612, 7.1, 6.099999999999998),
                Block.box(6.776120000000001, 6.1, 4.749999999999998, 9.17612, 7.1, 6.099999999999998),
                Block.box(4.72612, -3.608224830031759e-16, 6.799999999999999, 6.0761199999999995, 0.9999999999999997, 9.199999999999998),
                Block.box(4.72612, -3.608224830031759e-16, 6.799999999999999, 6.0761199999999995, 0.9999999999999997, 9.199999999999998),
                Block.box(6.776120000000001, -3.608224830031759e-16, 4.749999999999998, 9.17612, 0.9999999999999997, 6.099999999999998),
                Block.box(6.776120000000001, -3.608224830031759e-16, 4.749999999999998, 9.17612, 0.9999999999999997, 6.099999999999998),
                Block.box(4.72612, -3.608224830031759e-16, 6.799999999999999, 6.0761199999999995, 0.9999999999999997, 9.199999999999998),
                Block.box(6.776120000000001, -3.608224830031759e-16, 9.899999999999999, 9.17612, 0.9999999999999997, 11.249999999999998),
                Block.box(6.776120000000001, -3.608224830031759e-16, 9.899999999999999, 9.17612, 0.9999999999999997, 11.249999999999998),
                Block.box(9.876120000000002, -3.608224830031759e-16, 6.799999999999999, 11.22612, 0.9999999999999997, 9.199999999999998),
                Block.box(6.87612, 0.25, 4.499999999999998, 9.076119999999998, 1.8499999999999996, 5.999999999999998),
                Block.box(6.87612, 0.25, 4.499999999999998, 9.076119999999998, 1.8499999999999996, 5.999999999999998),
                Block.box(9.97612, 0.25, 6.899999999999999, 11.47612, 1.8499999999999996, 9.099999999999998),
                Block.box(4.47612, 0.25, 6.899999999999999, 5.97612, 1.8499999999999996, 9.099999999999998),
                Block.box(6.87612, 0.25, 9.999999999999998, 9.076119999999998, 1.8499999999999996, 11.499999999999998),
                Block.box(6.87612, 0.25, 9.999999999999998, 9.076119999999998, 1.8499999999999996, 11.499999999999998),
                Block.box(7.47612, 3.9999999999999996, 10.399999999999999, 8.47612, 5, 11.399999999999999),
                Block.box(7.47612, 3.9999999999999996, 10.399999999999999, 8.47612, 5, 11.399999999999999),
                Block.box(10.376120000000002, 3.9999999999999996, 7.499999999999998, 11.376120000000002, 5, 8.499999999999998),
                Block.box(10.376120000000002, 3.9999999999999996, 7.499999999999998, 11.376120000000002, 5, 8.499999999999998),
                Block.box(4.5761199999999995, 3.9999999999999996, 7.499999999999998, 5.5761199999999995, 5, 8.499999999999998),
                Block.box(4.5761199999999995, 3.9999999999999996, 7.499999999999998, 5.5761199999999995, 5, 8.499999999999998),
                Block.box(7.47612, 3.9999999999999996, 4.599999999999998, 8.47612, 5, 5.599999999999998),
                Block.box(7.47612, 3.9999999999999996, 4.599999999999998, 8.47612, 5, 5.599999999999998),
                Block.box(7.47612, 1.8499999999999996, 10.399999999999999, 8.47612, 2.8499999999999996, 11.399999999999999),
                Block.box(7.47612, 1.8499999999999996, 10.399999999999999, 8.47612, 2.8499999999999996, 11.399999999999999),
                Block.box(10.376120000000002, 1.8499999999999996, 7.499999999999998, 11.376120000000002, 2.8499999999999996, 8.499999999999998),
                Block.box(10.376120000000002, 1.8499999999999996, 7.499999999999998, 11.376120000000002, 2.8499999999999996, 8.499999999999998),
                Block.box(7.47612, 1.8499999999999996, 10.399999999999999, 8.47612, 2.8499999999999996, 11.399999999999999),
                Block.box(4.5761199999999995, 1.8499999999999996, 7.499999999999998, 5.5761199999999995, 2.8499999999999996, 8.499999999999998),
                Block.box(7.47612, 1.8499999999999996, 4.599999999999998, 8.47612, 2.8499999999999996, 5.599999999999998),
                Block.box(6.87612, 0.25, 9.999999999999998, 9.076119999999998, 1.8499999999999996, 11.499999999999998),
                Block.box(4.47612, 0.25, 6.899999999999999, 5.97612, 1.8499999999999996, 9.099999999999998),
                Block.box(6.97612, 0, 9.999999999999998, 8.97612, 7, 10.999999999999998),
                Block.box(6.97612, 0, 4.999999999999998, 8.97612, 7, 5.999999999999998),
                Block.box(6.97612, 0, 9.999999999999998, 8.97612, 7, 10.999999999999998),
                Block.box(6.97612, 0, 4.999999999999998, 8.97612, 7, 5.999999999999998),
                Block.box(9.97612, 0, 6.999999999999998, 10.97612, 7, 8.999999999999998),
                Block.box(4.97612, 0, 6.999999999999998, 5.97612, 7, 8.999999999999998),
                Block.box(5.97612, 0.1, 5.999999999999998, 9.97612, 1.1, 9.999999999999998),
                Block.box(4.97612, 7, 5.999999999999998, 8.97612, 9, 8.999999999999998),
                Block.box(5.97612, 1, 5.999999999999998, 9.97612, 8, 9.999999999999998),
                Block.box(5.97612, 5.1, 4.999999999999998, 8.97612, 8, 10.999999999999998)
        );
    
        private static final VoxelShape SHAPE_E = Shapes.or(
                Block.box(7.03806, 4.9, 2.2880599999999998, 9.03806, 6, 5.038059999999998),
                Block.box(7.53806, 5.75, 2.7880599999999998, 8.53806, 6.75, 3.7880599999999998),
                Block.box(7.53806, 5.551115123125783e-17, 2.5380599999999998, 8.53806, 1, 3.5380599999999998),
                Block.box(7.53806, 3.1500000000000004, 2.5380599999999998, 8.53806, 4.9, 4.03806),
                Block.box(7.43806, 0.7500000000000004, 2.0380599999999998, 8.63806, 2.7500000000000004, 4.03806),
                Block.box(7.3380600000000005, 1.5000000000000004, 1.9380600000000001, 8.738059999999999, 2.8000000000000007, 4.1380599999999985),
                Block.box(7.43806, 2.3, 2.18806, 8.63806, 3.3, 4.1380599999999985),
                Block.box(7.03806, 0, 5.038059999999998, 9.03806, 7, 6.038059999999998),
                Block.box(7.03806, 0, 10.038059999999998, 9.03806, 7, 11.038059999999998),
                Block.box(4.53806, 5, 6.938059999999998, 6.138059999999999, 6.6, 9.138059999999996),
                Block.box(4.53806, 5, 6.938059999999998, 6.138059999999999, 6.6, 9.138059999999996),
                Block.box(6.93806, 5, 4.538059999999998, 9.13806, 6.6, 6.138059999999998),
                Block.box(4.53806, 5, 6.938059999999998, 6.138059999999999, 6.6, 9.138059999999996),
                Block.box(9.93806, 5, 6.938059999999998, 11.53806, 6.6, 9.138059999999996),
                Block.box(9.93806, 5, 6.938059999999998, 11.53806, 6.6, 9.138059999999996),
                Block.box(6.93806, 5, 9.93806, 9.13806, 6.6, 11.538059999999998),
                Block.box(6.93806, 5, 4.538059999999998, 9.13806, 6.6, 6.138059999999998),
                Block.box(6.8380600000000005, 6.1, 4.788059999999998, 9.238059999999999, 7.1, 6.138059999999998),
                Block.box(4.78806, 6.1, 6.838059999999999, 6.138059999999999, 7.1, 9.238059999999997),
                Block.box(6.8380600000000005, 6.1, 9.93806, 9.238059999999999, 7.1, 11.288059999999998),
                Block.box(4.78806, 6.1, 6.838059999999999, 6.138059999999999, 7.1, 9.238059999999997),
                Block.box(6.8380600000000005, 6.1, 4.788059999999998, 9.238059999999999, 7.1, 6.138059999999998),
                Block.box(6.8380600000000005, 6.1, 4.788059999999998, 9.238059999999999, 7.1, 6.138059999999998),
                Block.box(9.93806, 6.1, 6.838059999999999, 11.28806, 7.1, 9.238059999999997),
                Block.box(9.93806, 6.1, 6.838059999999999, 11.28806, 7.1, 9.238059999999997),
                Block.box(6.8380600000000005, -3.608224830031759e-16, 4.788059999999998, 9.238059999999999, 0.9999999999999997, 6.138059999999998),
                Block.box(6.8380600000000005, -3.608224830031759e-16, 4.788059999999998, 9.238059999999999, 0.9999999999999997, 6.138059999999998),
                Block.box(9.93806, -3.608224830031759e-16, 6.838059999999999, 11.28806, 0.9999999999999997, 9.238059999999997),
                Block.box(9.93806, -3.608224830031759e-16, 6.838059999999999, 11.28806, 0.9999999999999997, 9.238059999999997),
                Block.box(6.8380600000000005, -3.608224830031759e-16, 4.788059999999998, 9.238059999999999, 0.9999999999999997, 6.138059999999998),
                Block.box(4.78806, -3.608224830031759e-16, 6.838059999999999, 6.138059999999999, 0.9999999999999997, 9.238059999999997),
                Block.box(4.78806, -3.608224830031759e-16, 6.838059999999999, 6.138059999999999, 0.9999999999999997, 9.238059999999997),
                Block.box(6.8380600000000005, -3.608224830031759e-16, 9.93806, 9.238059999999999, 0.9999999999999997, 11.288059999999998),
                Block.box(10.03806, 0.25, 6.938059999999998, 11.53806, 1.8499999999999996, 9.138059999999996),
                Block.box(10.03806, 0.25, 6.938059999999998, 11.53806, 1.8499999999999996, 9.138059999999996),
                Block.box(6.93806, 0.25, 10.038059999999998, 9.13806, 1.8499999999999996, 11.538059999999998),
                Block.box(6.93806, 0.25, 4.538059999999998, 9.13806, 1.8499999999999996, 6.038059999999998),
                Block.box(4.53806, 0.25, 6.938059999999998, 6.03806, 1.8499999999999996, 9.138059999999996),
                Block.box(4.53806, 0.25, 6.938059999999998, 6.03806, 1.8499999999999996, 9.138059999999996),
                Block.box(4.638059999999999, 3.9999999999999996, 7.538059999999998, 5.638059999999999, 5, 8.538059999999998),
                Block.box(4.638059999999999, 3.9999999999999996, 7.538059999999998, 5.638059999999999, 5, 8.538059999999998),
                Block.box(7.53806, 3.9999999999999996, 10.43806, 8.53806, 5, 11.43806),
                Block.box(7.53806, 3.9999999999999996, 10.43806, 8.53806, 5, 11.43806),
                Block.box(7.53806, 3.9999999999999996, 4.638059999999998, 8.53806, 5, 5.638059999999998),
                Block.box(7.53806, 3.9999999999999996, 4.638059999999998, 8.53806, 5, 5.638059999999998),
                Block.box(10.43806, 3.9999999999999996, 7.538059999999998, 11.43806, 5, 8.538059999999998),
                Block.box(10.43806, 3.9999999999999996, 7.538059999999998, 11.43806, 5, 8.538059999999998),
                Block.box(4.638059999999999, 1.8499999999999996, 7.538059999999998, 5.638059999999999, 2.8499999999999996, 8.538059999999998),
                Block.box(4.638059999999999, 1.8499999999999996, 7.538059999999998, 5.638059999999999, 2.8499999999999996, 8.538059999999998),
                Block.box(7.53806, 1.8499999999999996, 10.43806, 8.53806, 2.8499999999999996, 11.43806),
                Block.box(7.53806, 1.8499999999999996, 10.43806, 8.53806, 2.8499999999999996, 11.43806),
                Block.box(4.638059999999999, 1.8499999999999996, 7.538059999999998, 5.638059999999999, 2.8499999999999996, 8.538059999999998),
                Block.box(7.53806, 1.8499999999999996, 4.638059999999998, 8.53806, 2.8499999999999996, 5.638059999999998),
                Block.box(10.43806, 1.8499999999999996, 7.538059999999998, 11.43806, 2.8499999999999996, 8.538059999999998),
                Block.box(4.53806, 0.25, 6.938059999999998, 6.03806, 1.8499999999999996, 9.138059999999996),
                Block.box(6.93806, 0.25, 4.538059999999998, 9.13806, 1.8499999999999996, 6.038059999999998),
                Block.box(5.03806, 0, 7.038059999999998, 6.03806, 7, 9.038059999999998),
                Block.box(10.03806, 0, 7.038059999999998, 11.03806, 7, 9.038059999999998),
                Block.box(5.03806, 0, 7.038059999999998, 6.03806, 7, 9.038059999999998),
                Block.box(10.03806, 0, 7.038059999999998, 11.03806, 7, 9.038059999999998),
                Block.box(7.03806, 0, 10.038059999999998, 9.03806, 7, 11.038059999999998),
                Block.box(7.03806, 0, 5.038059999999998, 9.03806, 7, 6.038059999999998),
                Block.box(6.03806, 0.1, 6.038059999999998, 10.03806, 1.1, 10.038059999999998),
                Block.box(7.03806, 7, 5.038059999999998, 10.03806, 9, 9.038059999999998),
                Block.box(6.03806, 1, 6.038059999999998, 10.03806, 8, 10.038059999999998),
                Block.box(5.03806, 5.1, 6.038059999999998, 11.03806, 8, 9.038059999999998)
        );
    
        private static final VoxelShape SHAPE_S = Shapes.or(
                Block.box(11, 4.9, 7, 13.75, 6, 9),
                Block.box(12.25, 5.75, 7.5, 13.25, 6.75, 8.5),
                Block.box(12.5, 5.551115123125783e-17, 7.5, 13.5, 1, 8.5),
                Block.box(12, 3.1500000000000004, 7.5, 13.5, 4.9, 8.5),
                Block.box(12, 0.7500000000000004, 7.4, 14, 2.7500000000000004, 8.6),
                Block.box(11.9, 1.5000000000000004, 7.300000000000001, 14.1, 2.8000000000000007, 8.7),
                Block.box(11.9, 2.3, 7.4, 13.85, 3.3, 8.6),
                Block.box(10, 0, 7, 11, 7, 9),
                Block.box(5, 0, 7, 6, 7, 9),
                Block.box(6.9, 5, 4.5, 9.1, 6.6, 6.1),
                Block.box(6.9, 5, 4.5, 9.1, 6.6, 6.1),
                Block.box(9.9, 5, 6.9, 11.5, 6.6, 9.1),
                Block.box(6.9, 5, 4.5, 9.1, 6.6, 6.1),
                Block.box(6.9, 5, 9.9, 9.1, 6.6, 11.5),
                Block.box(6.9, 5, 9.9, 9.1, 6.6, 11.5),
                Block.box(4.5, 5, 6.9, 6.1, 6.6, 9.1),
                Block.box(9.9, 5, 6.9, 11.5, 6.6, 9.1),
                Block.box(9.9, 6.1, 6.800000000000001, 11.25, 7.1, 9.2),
                Block.box(6.800000000000001, 6.1, 4.75, 9.2, 7.1, 6.1),
                Block.box(4.75, 6.1, 6.800000000000001, 6.1, 7.1, 9.2),
                Block.box(6.800000000000001, 6.1, 4.75, 9.2, 7.1, 6.1),
                Block.box(9.9, 6.1, 6.800000000000001, 11.25, 7.1, 9.2),
                Block.box(9.9, 6.1, 6.800000000000001, 11.25, 7.1, 9.2),
                Block.box(6.800000000000001, 6.1, 9.9, 9.2, 7.1, 11.25),
                Block.box(6.800000000000001, 6.1, 9.9, 9.2, 7.1, 11.25),
                Block.box(9.9, -3.608224830031759e-16, 6.800000000000001, 11.25, 0.9999999999999997, 9.2),
                Block.box(9.9, -3.608224830031759e-16, 6.800000000000001, 11.25, 0.9999999999999997, 9.2),
                Block.box(6.800000000000001, -3.608224830031759e-16, 9.9, 9.2, 0.9999999999999997, 11.25),
                Block.box(6.800000000000001, -3.608224830031759e-16, 9.9, 9.2, 0.9999999999999997, 11.25),
                Block.box(9.9, -3.608224830031759e-16, 6.800000000000001, 11.25, 0.9999999999999997, 9.2),
                Block.box(6.800000000000001, -3.608224830031759e-16, 4.75, 9.2, 0.9999999999999997, 6.1),
                Block.box(6.800000000000001, -3.608224830031759e-16, 4.75, 9.2, 0.9999999999999997, 6.1),
                Block.box(4.75, -3.608224830031759e-16, 6.800000000000001, 6.1, 0.9999999999999997, 9.2),
                Block.box(6.9, 0.25, 10, 9.1, 1.8499999999999996, 11.5),
                Block.box(6.9, 0.25, 10, 9.1, 1.8499999999999996, 11.5),
                Block.box(4.5, 0.25, 6.9, 6, 1.8499999999999996, 9.1),
                Block.box(10, 0.25, 6.9, 11.5, 1.8499999999999996, 9.1),
                Block.box(6.9, 0.25, 4.5, 9.1, 1.8499999999999996, 6),
                Block.box(6.9, 0.25, 4.5, 9.1, 1.8499999999999996, 6),
                Block.box(7.5, 3.9999999999999996, 4.6, 8.5, 5, 5.6),
                Block.box(7.5, 3.9999999999999996, 4.6, 8.5, 5, 5.6),
                Block.box(4.6, 3.9999999999999996, 7.5, 5.6, 5, 8.5),
                Block.box(4.6, 3.9999999999999996, 7.5, 5.6, 5, 8.5),
                Block.box(10.4, 3.9999999999999996, 7.5, 11.4, 5, 8.5),
                Block.box(10.4, 3.9999999999999996, 7.5, 11.4, 5, 8.5),
                Block.box(7.5, 3.9999999999999996, 10.4, 8.5, 5, 11.4),
                Block.box(7.5, 3.9999999999999996, 10.4, 8.5, 5, 11.4),
                Block.box(7.5, 1.8499999999999996, 4.6, 8.5, 2.8499999999999996, 5.6),
                Block.box(7.5, 1.8499999999999996, 4.6, 8.5, 2.8499999999999996, 5.6),
                Block.box(4.6, 1.8499999999999996, 7.5, 5.6, 2.8499999999999996, 8.5),
                Block.box(4.6, 1.8499999999999996, 7.5, 5.6, 2.8499999999999996, 8.5),
                Block.box(7.5, 1.8499999999999996, 4.6, 8.5, 2.8499999999999996, 5.6),
                Block.box(10.4, 1.8499999999999996, 7.5, 11.4, 2.8499999999999996, 8.5),
                Block.box(7.5, 1.8499999999999996, 10.4, 8.5, 2.8499999999999996, 11.4),
                Block.box(6.9, 0.25, 4.5, 9.1, 1.8499999999999996, 6),
                Block.box(10, 0.25, 6.9, 11.5, 1.8499999999999996, 9.1),
                Block.box(7, 0, 5, 9, 7, 6),
                Block.box(7, 0, 10, 9, 7, 11),
                Block.box(7, 0, 5, 9, 7, 6),
                Block.box(7, 0, 10, 9, 7, 11),
                Block.box(5, 0, 7, 6, 7, 9),
                Block.box(10, 0, 7, 11, 7, 9),
                Block.box(6, 0.1, 6, 10, 1.1, 10),
                Block.box(7, 7, 7, 11, 9, 10),
                Block.box(6, 1, 6, 10, 8, 10),
                Block.box(7, 5.1, 5, 10, 8, 11)
        );
    
    
        private static final VoxelShape SHAPE_W = Shapes.or(
                Block.box(7.03806, 4.9, 11.061939999999998, 9.03806, 6, 13.811939999999996),
                Block.box(7.53806, 5.75, 12.311939999999996, 8.53806, 6.75, 13.311939999999996),
                Block.box(7.53806, 5.551115123125783e-17, 12.561939999999996, 8.53806, 1, 13.561939999999996),
                Block.box(7.53806, 3.1500000000000004, 12.061939999999996, 8.53806, 4.9, 13.561939999999996),
                Block.box(7.43806, 0.7500000000000004, 12.061939999999996, 8.63806, 2.7500000000000004, 14.061939999999996),
                Block.box(7.3380600000000005, 1.5000000000000004, 11.961939999999997, 8.738059999999999, 2.8000000000000007, 14.161939999999996),
                Block.box(7.43806, 2.3, 11.961939999999997, 8.63806, 3.3, 13.911939999999996),
                Block.box(7.03806, 0, 10.061939999999998, 9.03806, 7, 11.061939999999998),
                Block.box(7.03806, 0, 5.061939999999998, 9.03806, 7, 6.061939999999998),
                Block.box(9.93806, 5, 6.96194, 11.53806, 6.6, 9.161939999999998),
                Block.box(9.93806, 5, 6.96194, 11.53806, 6.6, 9.161939999999998),
                Block.box(6.93806, 5, 9.961939999999998, 9.13806, 6.6, 11.561939999999998),
                Block.box(9.93806, 5, 6.96194, 11.53806, 6.6, 9.161939999999998),
                Block.box(4.53806, 5, 6.96194, 6.138059999999999, 6.6, 9.161939999999998),
                Block.box(4.53806, 5, 6.96194, 6.138059999999999, 6.6, 9.161939999999998),
                Block.box(6.93806, 5, 4.561939999999998, 9.13806, 6.6, 6.161939999999996),
                Block.box(6.93806, 5, 9.961939999999998, 9.13806, 6.6, 11.561939999999998),
                Block.box(6.8380600000000005, 6.1, 9.961939999999998, 9.238059999999999, 7.1, 11.311939999999998),
                Block.box(9.93806, 6.1, 6.861939999999999, 11.28806, 7.1, 9.261939999999997),
                Block.box(6.8380600000000005, 6.1, 4.811939999999998, 9.238059999999999, 7.1, 6.161939999999996),
                Block.box(9.93806, 6.1, 6.861939999999999, 11.28806, 7.1, 9.261939999999997),
                Block.box(6.8380600000000005, 6.1, 9.961939999999998, 9.238059999999999, 7.1, 11.311939999999998),
                Block.box(6.8380600000000005, 6.1, 9.961939999999998, 9.238059999999999, 7.1, 11.311939999999998),
                Block.box(4.78806, 6.1, 6.861939999999999, 6.138059999999999, 7.1, 9.261939999999997),
                Block.box(4.78806, 6.1, 6.861939999999999, 6.138059999999999, 7.1, 9.261939999999997),
                Block.box(6.8380600000000005, -3.608224830031759e-16, 9.961939999999998, 9.238059999999999, 0.9999999999999997, 11.311939999999998),
                Block.box(6.8380600000000005, -3.608224830031759e-16, 9.961939999999998, 9.238059999999999, 0.9999999999999997, 11.311939999999998),
                Block.box(4.78806, -3.608224830031759e-16, 6.861939999999999, 6.138059999999999, 0.9999999999999997, 9.261939999999997),
                Block.box(4.78806, -3.608224830031759e-16, 6.861939999999999, 6.138059999999999, 0.9999999999999997, 9.261939999999997),
                Block.box(6.8380600000000005, -3.608224830031759e-16, 9.961939999999998, 9.238059999999999, 0.9999999999999997, 11.311939999999998),
                Block.box(9.93806, -3.608224830031759e-16, 6.861939999999999, 11.28806, 0.9999999999999997, 9.261939999999997),
                Block.box(9.93806, -3.608224830031759e-16, 6.861939999999999, 11.28806, 0.9999999999999997, 9.261939999999997),
                Block.box(6.8380600000000005, -3.608224830031759e-16, 4.811939999999998, 9.238059999999999, 0.9999999999999997, 6.161939999999996),
                Block.box(4.53806, 0.25, 6.96194, 6.03806, 1.8499999999999996, 9.161939999999998),
                Block.box(4.53806, 0.25, 6.96194, 6.03806, 1.8499999999999996, 9.161939999999998),
                Block.box(6.93806, 0.25, 4.561939999999998, 9.13806, 1.8499999999999996, 6.061939999999998),
                Block.box(6.93806, 0.25, 10.061939999999998, 9.13806, 1.8499999999999996, 11.561939999999998),
                Block.box(10.03806, 0.25, 6.96194, 11.53806, 1.8499999999999996, 9.161939999999998),
                Block.box(10.03806, 0.25, 6.96194, 11.53806, 1.8499999999999996, 9.161939999999998),
                Block.box(10.43806, 3.9999999999999996, 7.561939999999998, 11.43806, 5, 8.561939999999998),
                Block.box(10.43806, 3.9999999999999996, 7.561939999999998, 11.43806, 5, 8.561939999999998),
                Block.box(7.53806, 3.9999999999999996, 4.661939999999996, 8.53806, 5, 5.661939999999996),
                Block.box(7.53806, 3.9999999999999996, 4.661939999999996, 8.53806, 5, 5.661939999999996),
                Block.box(7.53806, 3.9999999999999996, 10.461939999999998, 8.53806, 5, 11.461939999999998),
                Block.box(7.53806, 3.9999999999999996, 10.461939999999998, 8.53806, 5, 11.461939999999998),
                Block.box(4.638059999999999, 3.9999999999999996, 7.561939999999998, 5.638059999999999, 5, 8.561939999999998),
                Block.box(4.638059999999999, 3.9999999999999996, 7.561939999999998, 5.638059999999999, 5, 8.561939999999998),
                Block.box(10.43806, 1.8499999999999996, 7.561939999999998, 11.43806, 2.8499999999999996, 8.561939999999998),
                Block.box(10.43806, 1.8499999999999996, 7.561939999999998, 11.43806, 2.8499999999999996, 8.561939999999998),
                Block.box(7.53806, 1.8499999999999996, 4.661939999999996, 8.53806, 2.8499999999999996, 5.661939999999996),
                Block.box(7.53806, 1.8499999999999996, 4.661939999999996, 8.53806, 2.8499999999999996, 5.661939999999996),
                Block.box(10.43806, 1.8499999999999996, 7.561939999999998, 11.43806, 2.8499999999999996, 8.561939999999998),
                Block.box(7.53806, 1.8499999999999996, 10.461939999999998, 8.53806, 2.8499999999999996, 11.461939999999998),
                Block.box(4.638059999999999, 1.8499999999999996, 7.561939999999998, 5.638059999999999, 2.8499999999999996, 8.561939999999998),
                Block.box(10.03806, 0.25, 6.96194, 11.53806, 1.8499999999999996, 9.161939999999998),
                Block.box(6.93806, 0.25, 10.061939999999998, 9.13806, 1.8499999999999996, 11.561939999999998),
                Block.box(10.03806, 0, 7.061939999999998, 11.03806, 7, 9.061939999999998),
                Block.box(5.03806, 0, 7.061939999999998, 6.03806, 7, 9.061939999999998),
                Block.box(10.03806, 0, 7.061939999999998, 11.03806, 7, 9.061939999999998),
                Block.box(5.03806, 0, 7.061939999999998, 6.03806, 7, 9.061939999999998),
                Block.box(7.03806, 0, 5.061939999999998, 9.03806, 7, 6.061939999999998),
                Block.box(7.03806, 0, 10.061939999999998, 9.03806, 7, 11.061939999999998),
                Block.box(6.03806, 0.1, 6.061939999999998, 10.03806, 1.1, 10.061939999999998),
                Block.box(6.03806, 7, 7.061939999999998, 9.03806, 9, 11.061939999999998),
                Block.box(6.03806, 1, 6.061939999999998, 10.03806, 8, 10.061939999999998),
                Block.box(5.03806, 5.1, 7.061939999999998, 11.03806, 8, 10.061939999999998)
        );
    
        @Override
        public VoxelShape getShape(BlockState state, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
            switch (state.getValue(FACING))
            {
                case NORTH:
                    return SHAPE_N;
    
                case EAST:
                    return SHAPE_E;
    
                case WEST:
                    return SHAPE_W;
    
                case SOUTH:
                    return SHAPE_S;
    
                default:
                    return SHAPE_N;
            }
        }
    
    
        @Nullable
        @Override
        public BlockState getStateForPlacement(BlockPlaceContext context) {
            return this.defaultBlockState().setValue(FACING,context.getHorizontalDirection().getOpposite());
        }
    
        @Override
        public BlockState rotate(BlockState state, LevelAccessor world, BlockPos pos, Rotation rot) {
            return state.setValue(FACING, rot.rotate(state.getValue(FACING)));
        }
    
        @Override
        public BlockState mirror(BlockState state, Mirror mirrorIn) {
            return state.rotate(mirrorIn.getRotation(state.getValue(FACING)));
        }
    
        @Override
        protected boolean mayPlaceOn(BlockState pState, BlockGetter pLevel, BlockPos pPos) {
            return !pState.is(ModTags.Blocks.BEER_CAN_PLACE_ON);
        }
    
        @Override
        protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
            builder.add(FACING);
        }
    }

    Thanks

  4. What do you mean with screen Factory?
    Here is the Error:

    [17:27:16] [Render thread/FATAL] [minecraft/Minecraft]: Reported exception thrown!
    net.minecraft.crash.ReportedException: mouseClicked event handler
    	at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:434) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.MouseHelper.mouseButtonCallback(MouseHelper.java:90) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.MouseHelper.lambda$null$4(MouseHelper.java:191) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(ThreadTaskExecutor.java:86) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
    	at net.minecraft.client.MouseHelper.lambda$registerCallbacks$5(MouseHelper.java:190) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
    	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar:build 10] {}
    	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
    	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:89) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.MainWindow.flipFrame(MainWindow.java:305) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1022) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    	at net.minecraft.client.Minecraft.run(Minecraft.java:612) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    	at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_202] {}
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_202] {}
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_202] {}
    	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_202] {}
    	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {}
    	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
    	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
    	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
    	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
    	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}
    	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:108) [forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {}
    Caused by: java.lang.ExceptionInInitializerError
    	at net.the_goldbeards.lootdebugs.screen.PubScreen.lambda$init$0(PubScreen.java:44) ~[main/:?] {re:classloading}
    	at net.minecraft.client.gui.widget.button.Button.onPress(Button.java:26) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.gui.widget.button.AbstractButton.onClick(AbstractButton.java:18) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.gui.widget.Widget.mouseClicked(Widget.java:136) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.gui.INestedGuiEventHandler.mouseClicked(INestedGuiEventHandler.java:31) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.gui.screen.inventory.ContainerScreen.mouseClicked(ContainerScreen.java:299) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    	at net.minecraft.client.MouseHelper.lambda$mouseButtonCallback$0(MouseHelper.java:92) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:427) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	... 23 more
    Caused by: java.lang.IllegalArgumentException: Registration of network channels is locked
    	at net.minecraftforge.fml.network.NetworkRegistry.createInstance(NetworkRegistry.java:150) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
    	at net.minecraftforge.fml.network.NetworkRegistry.access$000(NetworkRegistry.java:49) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
    	at net.minecraftforge.fml.network.NetworkRegistry$ChannelBuilder.createNetworkInstance(NetworkRegistry.java:420) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
    	at net.minecraftforge.fml.network.NetworkRegistry$ChannelBuilder.simpleChannel(NetworkRegistry.java:429) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
    	at net.the_goldbeards.lootdebugs.Server.PacketHandler.<clinit>(PacketHandler.java:21) ~[main/:?] {re:classloading}
    	at net.the_goldbeards.lootdebugs.screen.PubScreen.lambda$init$0(PubScreen.java:44) ~[main/:?] {re:classloading}
    	at net.minecraft.client.gui.widget.button.Button.onPress(Button.java:26) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.gui.widget.button.AbstractButton.onClick(AbstractButton.java:18) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.gui.widget.Widget.mouseClicked(Widget.java:136) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.gui.INestedGuiEventHandler.mouseClicked(INestedGuiEventHandler.java:31) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.gui.screen.inventory.ContainerScreen.mouseClicked(ContainerScreen.java:299) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    	at net.minecraft.client.MouseHelper.lambda$mouseButtonCallback$0(MouseHelper.java:92) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:427) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	... 23 more
    [17:27:17] [Render thread/INFO] [STDOUT/]: [net.minecraft.util.registry.Bootstrap:printToSYSOUT:130]: ---- Minecraft Crash Report ----
    // Hi. I'm Minecraft, and I'm a crashaholic.

     

  5. ToServerCheck

    package net.the_goldbeards.lootdebugs.Server;
    
    import net.minecraft.network.PacketBuffer;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.math.BlockPos;
    import net.minecraftforge.fml.network.NetworkEvent;
    import net.the_goldbeards.lootdebugs.tileentity.PubTile;
    
    import java.util.function.Supplier;
    
    public final class ToServerCheck {
    
        private BlockPos pos;
    
    
    
    
        public ToServerCheck(BlockPos pos) {
    
            this.pos = pos;
    
    
        }
    
        public static void encode(ToServerCheck msg, PacketBuffer buf) {
    
            buf.writeInt(msg.pos.getX());
            buf.writeInt(msg.pos.getY());
            buf.writeInt(msg.pos.getZ());
    
        }
    
        public static ToServerCheck decode(PacketBuffer buf) {
    
            int posx = buf.readInt();
            int posy = buf.readInt();
            int posz = buf.readInt();
    
            BlockPos p = new BlockPos(posx,posy,posz);
    
            return new ToServerCheck(p);
        }
    
        public static class Handler {
            public static void handle(final ToServerCheck message, Supplier<NetworkEvent.Context> ctx) {
                ctx.get().enqueueWork(() -> {
                    TileEntity te = ctx.get().getSender().getServerWorld().getTileEntity(message.pos);
                    if(te instanceof PubTile) {
                        //System.out.println("TE updated");
                        ((PubTile)te).brewBlackout();
                    }
                    else {
                        //System.out.println("No TE!?");
                    }
                });
            }
        }
    }

    PacketHandler

    package net.the_goldbeards.lootdebugs.Server;
    
    import net.minecraft.entity.player.ServerPlayerEntity;
    import net.minecraft.util.ResourceLocation;
    import net.minecraftforge.common.util.FakePlayer;
    import net.minecraftforge.fml.network.NetworkDirection;
    import net.minecraftforge.fml.network.NetworkRegistry;
    import net.minecraftforge.fml.network.simple.SimpleChannel;
    import net.the_goldbeards.lootdebugs.LootDebugsMain;
    
    public class PacketHandler {
        public static class EffectsIDs {
            public static int PROSPECTING = 1;
        }
        private static final String PROTOCOL_VERSION = Integer.toString(1);
        private static final SimpleChannel HANDLER = NetworkRegistry.ChannelBuilder
                .named(new ResourceLocation(LootDebugsMain.MOD_ID, "main_channel"))
                .clientAcceptedVersions(PROTOCOL_VERSION::equals)
                .serverAcceptedVersions(PROTOCOL_VERSION::equals)
                .networkProtocolVersion(() -> PROTOCOL_VERSION)
                .simpleChannel();
    
    
    
    	/*
    	public static void sendNonLocal(IMessage msg, EntityPlayerMP player)
    	{
    		if (player.server.isDedicatedServer() || !player.getName().equals(player.server.getServerOwner()))
    		{
    			HANDLER.sendTo(msg, player.connection.netManager, NetworkDirection.PLAY_TO_CLIENT);
    		}
    	}*/
    
        /**
         * Sends a packet to the server.<br>
         * Must be called Client side.
         */
        public static <MSG> void sendToServer(MSG msg)
        {
            HANDLER.sendToServer(msg);
        }
    
        /**
         * Send a packet to a specific player.<br>
         * Must be called Server side.
         */
        public static <MSG> void sendTo(MSG msg, ServerPlayerEntity player)
        {
            if (!(player instanceof FakePlayer))
            {
                HANDLER.sendTo(msg, player.connection.netManager, NetworkDirection.PLAY_TO_CLIENT);
            }
        }
    }

    PubScreen

    package net.the_goldbeards.lootdebugs.screen;
    
    import com.mojang.blaze3d.matrix.MatrixStack;
    import com.mojang.blaze3d.systems.RenderSystem;
    import net.minecraft.client.gui.screen.inventory.ContainerScreen;
    import net.minecraft.client.gui.widget.button.ImageButton;
    import net.minecraft.entity.player.PlayerInventory;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.util.text.ITextComponent;
    import net.the_goldbeards.lootdebugs.LootDebugsMain;
    import net.the_goldbeards.lootdebugs.Server.PacketHandler;
    import net.the_goldbeards.lootdebugs.Server.ToServerCheck;
    import net.the_goldbeards.lootdebugs.container.PubContainer;
    import net.the_goldbeards.lootdebugs.tileentity.PubTile;
    
    
    public class PubScreen extends ContainerScreen<PubContainer>
    {
       PubTile pubTile;
        private MatrixStack matrixStack;
        private static int i;
        private static int j;
        private static final ResourceLocation GUI = new ResourceLocation(LootDebugsMain.MOD_ID, "textures/gui/pub_gui.png");
        private static final ResourceLocation CONTINUE_BUTTON = new ResourceLocation(LootDebugsMain.MOD_ID, "textures/gui/recipe_button.png");
    
    
    
        public PubScreen(PubContainer screenContainer, PlayerInventory inv, ITextComponent titleIn) {
            super(screenContainer, inv, titleIn);
            pubTile = (PubTile)screenContainer.tileEntity;
         //   pubTile = (PubTile)screenContainer.
        }
    
        @Override
        protected void init() {
            super.init();
            this.addButton(new ImageButton(this.guiLeft + 140, this.height / 2 - 30, 20, 18, 0, 0, 19, CONTINUE_BUTTON, (button) -> {
                System.out.println("BUtton PReeess" +
                        "ssd");
                //PacketHandler.CHANNEL.sendToServer();
    System.out.println("hi");
    
    
                    PacketHandler.sendToServer(new ToServerCheck(pubTile.getPos()));
    
               ((ImageButton)button).setPosition(this.guiLeft + 140, this.height / 2 - 30);
            }));
            this.titleX = (this.xSize - this.font.getStringPropertyWidth(this.title)) / 2;
        }
    
    
        @Override
        public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
            this.renderBackground(matrixStack);
            super.render(matrixStack, mouseX, mouseY, partialTicks);
            this.renderHoveredTooltip(matrixStack, mouseX, mouseY);
            for(int i = 0; i < this.buttons.size(); ++i)
            {
                this.buttons.get(i).render(matrixStack,mouseX,mouseY,partialTicks);
            }
    
    
        }
    
    
    
        @Override
        protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y)
        {
    
    
            RenderSystem.color4f(1f,1f,1f,1f);
            this.minecraft.getTextureManager().bindTexture(GUI);
            int i = this.guiLeft;
            int j = this.guiTop;
            this.matrixStack = matrixStack;
            this.j= j;
            this.i = i;
            this.blit(matrixStack, i,j,0,0,this.xSize, this.ySize);
    
            if(false)
            {
                /*this.blit(matrixStack, i+55,j+13,183,2,28,0);//Water-emty
                this.blit(matrixStack, i+55,j+13,183,2,28,3);//Water-1
                this.blit(matrixStack, i+55,j+13,183,2,38,5);//Water-2
                this.blit(matrixStack, i+55,j+13,183,2,48,5);//Water-3
                this.blit(matrixStack, i+55,j+13,183,2,64,12);//Water-4
                this.blit(matrixStack, i+55,j+13,183,2,66,21);//Water-Full*/
    
    
    
            }
    
    
    
    
    
        }
    
    
       /* protected void actionPerformed(Button button) {
            ExpandedIndustry.LOGGER.log(Level.DEBUG, "Button clicked");
            if(button instanceof ImageButton) {
                ImageButton lb = (ImageButton)button;
                EnumAcceptType t = lb.cycleType();
                tileEntity.setEnumType(t);
                PacketHandler.sendToServer(new ToServerFilterClick(0, tileEntity.getPos(), t.ordinal()));
            }
        }*/
    
    
    }

     

  6. Container Registration

    package net.the_goldbeards.lootdebugs.init;
    
    import net.minecraft.inventory.container.ContainerType;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.math.BlockPos;
    import net.minecraft.world.World;
    import net.minecraftforge.common.extensions.IForgeContainerType;
    import net.minecraftforge.eventbus.api.IEventBus;
    import net.minecraftforge.fml.RegistryObject;
    import net.minecraftforge.registries.DeferredRegister;
    import net.minecraftforge.registries.ForgeRegistries;
    import net.the_goldbeards.lootdebugs.LootDebugsMain;
    import net.the_goldbeards.lootdebugs.container.PubContainer;
    
    public class ModContainers
    {
        public static DeferredRegister<ContainerType<?>> CONTAINERS
                = DeferredRegister.create(ForgeRegistries.CONTAINERS, LootDebugsMain.MOD_ID);
    
        public static final RegistryObject<ContainerType<PubContainer>> PUB
                =CONTAINERS.register("pub",
                () -> IForgeContainerType.create(((windowId, inv, data) -> {
                    BlockPos pos = data.readBlockPos();
                    World world = inv.player.getEntityWorld();
    
                    return new PubContainer(windowId,world, pos, inv,inv.player);
                })));
    
    
        public static void register(IEventBus eventBus)
        {
            CONTAINERS.register(eventBus);
        }
    }

    PubContainer

    package net.the_goldbeards.lootdebugs.container;
    
    import net.minecraft.client.Minecraft;
    import net.minecraft.entity.player.PlayerEntity;
    import net.minecraft.entity.player.PlayerInventory;
    import net.minecraft.inventory.container.Container;
    import net.minecraft.inventory.container.Slot;
    import net.minecraft.item.ItemStack;
    import net.minecraft.network.PacketBuffer;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.IWorldPosCallable;
    import net.minecraft.util.math.BlockPos;
    import net.minecraft.world.World;
    import net.minecraftforge.api.distmarker.Dist;
    import net.minecraftforge.api.distmarker.OnlyIn;
    import net.minecraftforge.items.CapabilityItemHandler;
    import net.minecraftforge.items.IItemHandler;
    import net.minecraftforge.items.SlotItemHandler;
    import net.minecraftforge.items.wrapper.InvWrapper;
    import net.the_goldbeards.lootdebugs.init.ModBlocks;
    import net.the_goldbeards.lootdebugs.init.ModContainers;
    import net.the_goldbeards.lootdebugs.tileentity.PubTile;
    
    public class PubContainer extends Container
    {
    
    
        public final TileEntity tileEntity;
        private final PlayerEntity playerEntity;
        private final IItemHandler playerInventory;
        private int getBrewingState = 0;
    
    
    
        public PubContainer(int windowid, World world, BlockPos pos, PlayerInventory playerInventory, PlayerEntity player) {
            super(ModContainers.PUB.get(), windowid);
            this.tileEntity = world.getTileEntity(pos);
            playerEntity = player;
            this.playerInventory = new InvWrapper(playerInventory);
    
            layoutPlayerInventorySlots(8, 86);
    
            if(tileEntity != null)
            {
                tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(h ->
                {
                    addSlot(new SlotItemHandler(h, 0,80,8));
    
                    addSlot(new SlotItemHandler(h, 1,48,35));
    
                    addSlot(new SlotItemHandler(h, 2,69,35));
    
                    addSlot(new SlotItemHandler(h, 3,90,35));
    
                    addSlot(new SlotItemHandler(h, 4,111,35));
    
                    addSlot(new SlotItemHandler(h, 5,80,65));
                });
            }
    
    
        }
    
        @Override
        public boolean canInteractWith(PlayerEntity playerIn) {
            return isWithinUsableDistance(IWorldPosCallable.of(tileEntity.getWorld(), tileEntity.getPos()),
                    playerIn, ModBlocks.PUB.get());
        }
    
        public boolean point()
        {
            return true;
        }
    
        private int addSlotRange(IItemHandler handler, int index, int x, int y, int amount, int dx) {
            for (int i = 0; i < amount; i++) {
                addSlot(new SlotItemHandler(handler, index, x, y));
                x += dx;
                index++;
            }
    
            return index;
        }
    
        private int addSlotBox(IItemHandler handler, int index, int x, int y, int horAmount, int dx, int verAmount, int dy) {
            for (int j = 0; j < verAmount; j++) {
                index = addSlotRange(handler, index, x, y, horAmount, dx);
                y += dy;
            }
    
            return index;
        }
    
        private void layoutPlayerInventorySlots(int leftCol, int topRow) {
            addSlotBox(playerInventory, 9, leftCol, topRow, 9, 18, 3, 18);
    
            topRow += 58;
            addSlotRange(playerInventory, 0, leftCol, topRow, 9, 18);
        }
    
    
        private static final int HOTBAR_SLOT_COUNT = 9;
        private static final int PLAYER_INVENTORY_ROW_COUNT = 3;
        private static final int PLAYER_INVENTORY_COLUMN_COUNT = 9;
        private static final int PLAYER_INVENTORY_SLOT_COUNT = PLAYER_INVENTORY_COLUMN_COUNT * PLAYER_INVENTORY_ROW_COUNT;
        private static final int VANILLA_SLOT_COUNT = HOTBAR_SLOT_COUNT + PLAYER_INVENTORY_SLOT_COUNT;
        private static final int VANILLA_FIRST_SLOT_INDEX = 0;
        private static final int TE_INVENTORY_FIRST_SLOT_INDEX = VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT;
        private static final int TE_INVENTORY_SLOT_COUNT = 2;  // must match TileEntityInventoryBasic.NUMBER_OF_SLOTS
    
        @Override
        public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) {
            Slot sourceSlot = inventorySlots.get(index);
            if (sourceSlot == null || !sourceSlot.getHasStack()) return ItemStack.EMPTY;  //EMPTY_ITEM
            ItemStack sourceStack = sourceSlot.getStack();
            ItemStack copyOfSourceStack = sourceStack.copy();
            
            if (index < VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT) {
                if (!mergeItemStack(sourceStack, TE_INVENTORY_FIRST_SLOT_INDEX, TE_INVENTORY_FIRST_SLOT_INDEX
                        + TE_INVENTORY_SLOT_COUNT, false)) {
                    return ItemStack.EMPTY;  // EMPTY_ITEM
                }
            } else if (index < TE_INVENTORY_FIRST_SLOT_INDEX + TE_INVENTORY_SLOT_COUNT) {
                if (!mergeItemStack(sourceStack, VANILLA_FIRST_SLOT_INDEX, VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT, false)) {
                    return ItemStack.EMPTY;
                }
            } else {
                System.out.println("Invalid slotIndex:" + index);
                return ItemStack.EMPTY;
            }
            if (sourceStack.getCount() == 0) {
                sourceSlot.putStack(ItemStack.EMPTY);
            } else {
                sourceSlot.onSlotChanged();
            }
            sourceSlot.onTake(playerEntity, sourceStack);
            return copyOfSourceStack;
        }
    
    
    
    
    
    }

     

  7. public class PubScreen extends ContainerScreen<PubContainer>
    {
       PubTile pubTile;
        private MatrixStack matrixStack;
        private static int i;
        private static int j;
        private static final ResourceLocation GUI = new ResourceLocation(LootDebugsMain.MOD_ID, "textures/gui/pub_gui.png");
        private static final ResourceLocation CONTINUE_BUTTON = new ResourceLocation(LootDebugsMain.MOD_ID, "textures/gui/recipe_button.png");
    
    
    
        public PubScreen(PubContainer screenContainer, PlayerInventory inv, ITextComponent titleIn) {
            super(screenContainer, inv, titleIn);
            pubTile = (PubTile)screenContainer.tileEntity;
         //   pubTile = (PubTile)screenContainer.
        }
    
        @Override
        protected void init() {
            super.init();
            this.addButton(new ImageButton(this.guiLeft + 140, this.height / 2 - 30, 20, 18, 0, 0, 19, CONTINUE_BUTTON, (button) -> {
                System.out.println("BUtton PReeess" +
                        "ssd");
                //PacketHandler.CHANNEL.sendToServer();
    System.out.println("hi");
    
    
                    PacketHandler.sendToServer(new ToServerFilterCheck(pubTile.getPos()));
    
               ((ImageButton)button).setPosition(this.guiLeft + 140, this.height / 2 - 30);
            }));
            this.titleX = (this.xSize - this.font.getStringPropertyWidth(this.title)) / 2;
        }
    
    
        @Override
        public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
            this.renderBackground(matrixStack);
            super.render(matrixStack, mouseX, mouseY, partialTicks);
            this.renderHoveredTooltip(matrixStack, mouseX, mouseY);
            for(int i = 0; i < this.buttons.size(); ++i)
            {
                this.buttons.get(i).render(matrixStack,mouseX,mouseY,partialTicks);
            }
    
    
        }
    
    
    
        @Override
        protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y)
        {
    
    
            RenderSystem.color4f(1f,1f,1f,1f);
            this.minecraft.getTextureManager().bindTexture(GUI);
            int i = this.guiLeft;
            int j = this.guiTop;
            this.matrixStack = matrixStack;
            this.j= j;
            this.i = i;
            this.blit(matrixStack, i,j,0,0,this.xSize, this.ySize);
    
            if(false)
            {
                /*this.blit(matrixStack, i+55,j+13,183,2,28,0);//Water-emty
                this.blit(matrixStack, i+55,j+13,183,2,28,3);//Water-1
                this.blit(matrixStack, i+55,j+13,183,2,38,5);//Water-2
                this.blit(matrixStack, i+55,j+13,183,2,48,5);//Water-3
                this.blit(matrixStack, i+55,j+13,183,2,64,12);//Water-4
                this.blit(matrixStack, i+55,j+13,183,2,66,21);//Water-Full*/
    
    
    
            }
    
    
    
    
    
        }
    
    
       /* protected void actionPerformed(Button button) {
            ExpandedIndustry.LOGGER.log(Level.DEBUG, "Button clicked");
            if(button instanceof ImageButton) {
                ImageButton lb = (ImageButton)button;
                EnumAcceptType t = lb.cycleType();
                tileEntity.setEnumType(t);
                PacketHandler.sendToServer(new ToServerFilterClick(0, tileEntity.getPos(), t.ordinal()));
            }
        }*/
    
    
    }

     

  8. Sorry for the late reply but I've tried it now. However, the game crashes when i press the button with the following error

    1:22:08] [Render thread/FATAL] [minecraft/Minecraft]: Reported exception thrown!
    net.minecraft.crash.ReportedException: mouseClicked event handler
    	at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:434) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.MouseHelper.mouseButtonCallback(MouseHelper.java:90) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.MouseHelper.lambda$null$4(MouseHelper.java:191) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(ThreadTaskExecutor.java:86) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
    	at net.minecraft.client.MouseHelper.lambda$registerCallbacks$5(MouseHelper.java:190) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
    	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar:build 10] {}
    	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
    	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:89) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.MainWindow.flipFrame(MainWindow.java:305) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1022) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    	at net.minecraft.client.Minecraft.run(Minecraft.java:612) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    	at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_202] {}
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_202] {}
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_202] {}
    	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_202] {}
    	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {}
    	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
    	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
    	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
    	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
    	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}
    	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:108) [forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {}
    Caused by: java.lang.NullPointerException
    	at net.the_goldbeards.lootdebugs.screen.PubScreen.lambda$init$0(PubScreen.java:56) ~[main/:?] {re:classloading}
    	at net.minecraft.client.gui.widget.button.Button.onPress(Button.java:26) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.gui.widget.button.AbstractButton.onClick(AbstractButton.java:18) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.gui.widget.Widget.mouseClicked(Widget.java:136) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.gui.INestedGuiEventHandler.mouseClicked(INestedGuiEventHandler.java:31) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.gui.screen.inventory.ContainerScreen.mouseClicked(ContainerScreen.java:299) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    	at net.minecraft.client.MouseHelper.lambda$mouseButtonCallback$0(MouseHelper.java:92) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:427) ~[forge-1.16.5-36.2.8_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    	... 23 more

     

    and this is my Screenclass:

    package net.the_goldbeards.lootdebugs.screen;
    
    import com.mojang.blaze3d.matrix.MatrixStack;
    import com.mojang.blaze3d.platform.GlStateManager;
    import com.mojang.blaze3d.systems.RenderSystem;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.gui.screen.inventory.ContainerScreen;
    import net.minecraft.client.gui.screen.inventory.CraftingScreen;
    import net.minecraft.client.gui.screen.inventory.FurnaceScreen;
    import net.minecraft.client.gui.widget.button.Button;
    import net.minecraft.client.gui.widget.button.ImageButton;
    import net.minecraft.entity.player.PlayerInventory;
    import net.minecraft.entity.player.ServerPlayerEntity;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.util.text.ITextComponent;
    import net.minecraft.world.World;
    import net.minecraftforge.api.distmarker.Dist;
    import net.minecraftforge.api.distmarker.OnlyIn;
    import net.minecraftforge.fml.network.NetworkHooks;
    import net.minecraftforge.fml.network.simple.SimpleChannel;
    import net.the_goldbeards.lootdebugs.LootDebugsMain;
    import net.the_goldbeards.lootdebugs.Server.PacketHandler;
    import net.the_goldbeards.lootdebugs.Server.ToServerFilterCheck;
    import net.the_goldbeards.lootdebugs.container.PubContainer;
    import net.the_goldbeards.lootdebugs.tileentity.PubTile;
    import org.apache.logging.log4j.Level;
    
    
    public class PubScreen extends ContainerScreen<PubContainer>
    {
       PubTile pubTile;
        private MatrixStack matrixStack;
        private static int i;
        private static int j;
        private static final ResourceLocation GUI = new ResourceLocation(LootDebugsMain.MOD_ID, "textures/gui/pub_gui.png");
        private static final ResourceLocation CONTINUE_BUTTON = new ResourceLocation(LootDebugsMain.MOD_ID, "textures/gui/recipe_button.png");
    
    
    
        public PubScreen(PubContainer screenContainer, PlayerInventory inv, ITextComponent titleIn) {
            super(screenContainer, inv, titleIn);
         //   pubTile = (PubTile)screenContainer.
        }
    
        @Override
        protected void init() {
            super.init();
            this.addButton(new ImageButton(this.guiLeft + 140, this.height / 2 - 30, 20, 18, 0, 0, 19, CONTINUE_BUTTON, (button) -> {
                System.out.println("BUtton PReeess" +
                        "ssd");
                //PacketHandler.CHANNEL.sendToServer();
    System.out.println("hi");
    
    
                    PacketHandler.sendToServer(new ToServerFilterCheck(pubTile.getPos()));
    
               ((ImageButton)button).setPosition(this.guiLeft + 140, this.height / 2 - 30);
            }));
            this.titleX = (this.xSize - this.font.getStringPropertyWidth(this.title)) / 2;
        }
    
    
        @Override
        public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
            this.renderBackground(matrixStack);
            super.render(matrixStack, mouseX, mouseY, partialTicks);
            this.renderHoveredTooltip(matrixStack, mouseX, mouseY);
            for(int i = 0; i < this.buttons.size(); ++i)
            {
                this.buttons.get(i).render(matrixStack,mouseX,mouseY,partialTicks);
            }
    
    
        }
    
    
    
        @Override
        protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y)
        {
    
    
            RenderSystem.color4f(1f,1f,1f,1f);
            this.minecraft.getTextureManager().bindTexture(GUI);
            int i = this.guiLeft;
            int j = this.guiTop;
            this.matrixStack = matrixStack;
            this.j= j;
            this.i = i;
            this.blit(matrixStack, i,j,0,0,this.xSize, this.ySize);
    
            if(false)
            {
                /*this.blit(matrixStack, i+55,j+13,183,2,28,0);//Water-emty
                this.blit(matrixStack, i+55,j+13,183,2,28,3);//Water-1
                this.blit(matrixStack, i+55,j+13,183,2,38,5);//Water-2
                this.blit(matrixStack, i+55,j+13,183,2,48,5);//Water-3
                this.blit(matrixStack, i+55,j+13,183,2,64,12);//Water-4
                this.blit(matrixStack, i+55,j+13,183,2,66,21);//Water-Full*/
    
    
    
            }
    
    
    
    
    
        }
    
    
       /* protected void actionPerformed(Button button) {
            ExpandedIndustry.LOGGER.log(Level.DEBUG, "Button clicked");
            if(button instanceof ImageButton) {
                ImageButton lb = (ImageButton)button;
                EnumAcceptType t = lb.cycleType();
                tileEntity.setEnumType(t);
                PacketHandler.sendToServer(new ToServerFilterClick(0, tileEntity.getPos(), t.ordinal()));
            }
        }*/
    
    
    }

     

  9. ok, i have writed the Button Method but i have no idea what to write in the .sendToServer Method 

     @Override
        protected void init() {
            super.init();
            this.addButton(new ImageButton(this.guiLeft + 20, this.height / 2 - 49, 20, 18, 0, 0, 19, CONTINUE_BUTTON, (button) -> {
    
                PacketHandler.CHANNEL.sendToServer(new PubTile());
                ((ImageButton)button).setPosition(this.guiLeft + 20, this.height / 2 - 49);
            }));
            this.titleX = (this.xSize - this.font.getStringPropertyWidth(this.title)) / 2;
        }

     

  10. In this Class: 

    package net.the_goldbeards.lootdebugs.Server;
    
    
    import net.minecraft.util.ResourceLocation;
    import net.minecraftforge.fml.network.NetworkRegistry;
    import net.the_goldbeards.lootdebugs.LootDebugsMain;
    
    public  class SimpleChannel
    {
        private static final String PROTICOL_VERSION = "1";
        public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel(
                new ResourceLocation("corruption","main")
                ,() -> PROTICOL_VERSION
                , PROTICOL_VERSION::equals
                , PROTICOL_VERSION::equals);
    
    
    }

     

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.