From 5f0de40ad7e5f9d40772fa637dadfb5eaa93651d Mon Sep 17 00:00:00 2001 From: Mysticpasta1 Date: Sun, 26 Jun 2022 21:10:55 -0500 Subject: [PATCH] lot of thing, lot - of - things --- src/main/java/net/montoyo/wd/WebDisplays.java | 10 +- .../montoyo/wd/block/BlockKeyboardLeft.java | 280 ++++++++++++++++++ .../net/montoyo/wd/block/BlockPeripheral.java | 9 - .../java/net/montoyo/wd/block/BlockRCTRL.java | 235 +++++++++++++++ .../net/montoyo/wd/block/BlockRedCTRL.java | 235 +++++++++++++++ .../net/montoyo/wd/block/BlockScreen.java | 15 +- .../net/montoyo/wd/block/BlockServer.java | 235 +++++++++++++++ .../net/montoyo/wd/client/ClientProxy.java | 8 +- .../net/montoyo/wd/client/gui/GuiMinePad.java | 4 +- .../wd/client/gui/GuiScreenConfig.java | 2 +- .../net/montoyo/wd/client/gui/GuiServer.java | 2 +- .../renderers/LaserPointerRenderer.java | 55 ++-- .../wd/client/renderers/ScreenRenderer.java | 39 ++- .../montoyo/wd/entity/TileEntityKeyboard.java | 10 +- .../montoyo/wd/entity/TileEntityRCtrl.java | 7 +- .../montoyo/wd/entity/TileEntityRedCtrl.java | 7 +- .../montoyo/wd/entity/TileEntityScreen.java | 22 +- .../montoyo/wd/entity/TileEntityServer.java | 9 +- .../java/net/montoyo/wd/init/BlockInit.java | 13 +- .../java/net/montoyo/wd/item/ItemLinker.java | 2 +- .../net/montoyo/wd/item/ItemMinePad2.java | 4 +- .../montoyo/wd/item/ItemOwnershipThief.java | 2 +- .../montoyo/wd/miniserv/server/Server.java | 2 +- .../assets/webdisplays/blockstates/rctrl.json | 8 +- .../webdisplays/blockstates/redctrl.json | 8 +- .../webdisplays/blockstates/server.json | 8 +- .../assets/webdisplays/lang/en_us.json | 157 ++++++++++ .../assets/webdisplays/lang/en_us.lang | 154 ---------- 28 files changed, 1255 insertions(+), 287 deletions(-) create mode 100644 src/main/java/net/montoyo/wd/block/BlockKeyboardLeft.java create mode 100644 src/main/java/net/montoyo/wd/block/BlockRCTRL.java create mode 100644 src/main/java/net/montoyo/wd/block/BlockRedCTRL.java create mode 100644 src/main/java/net/montoyo/wd/block/BlockServer.java create mode 100644 src/main/resources/assets/webdisplays/lang/en_us.json delete mode 100644 src/main/resources/assets/webdisplays/lang/en_us.lang diff --git a/src/main/java/net/montoyo/wd/WebDisplays.java b/src/main/java/net/montoyo/wd/WebDisplays.java index 5048754..b56c3dc 100644 --- a/src/main/java/net/montoyo/wd/WebDisplays.java +++ b/src/main/java/net/montoyo/wd/WebDisplays.java @@ -26,6 +26,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraftforge.client.event.ClientChatEvent; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.ServerChatEvent; @@ -66,6 +67,8 @@ public class WebDisplays { public static final String MOD_VERSION = "1.1"; + public static WebDisplays INSTANCE; + public static SharedProxy PROXY = DistExecutor.runForDist(() -> ClientProxy::new, () -> SharedProxy::new); public static WDCreativeTab CREATIVE_TAB; @@ -113,6 +116,7 @@ public class WebDisplays { public float avDist0; public WebDisplays() { + INSTANCE = this; AutoConfig.register(ModConfig.class, Toml4jConfigSerializer::new); ConfigHolder configHolder = AutoConfig.getConfigHolder(ModConfig.class); ModConfig config = configHolder.getConfig(); @@ -338,9 +342,9 @@ public class WebDisplays { } @SubscribeEvent - public void onPlayerClone(net.minecraftforge.event.entity.player.PlayerEvent.Clone ev) { - IWDDCapability src = ev.getOriginal().getCapability(WDDCapability.Provider.cap, null).orElseThrow(RuntimeException::new); - IWDDCapability dst = ev.getPlayer().getCapability(WDDCapability.Provider.cap, null).orElseThrow(RuntimeException::new); + public void onPlayerClone(PlayerEvent.Clone ev) { + IWDDCapability src = ev.getOriginal().getCapability(WDDCapability.Provider.cap, null).orElse(new WDDCapability.Factory().call()); + IWDDCapability dst = ev.getPlayer().getCapability(WDDCapability.Provider.cap, null).orElse(new WDDCapability.Factory().call()); if(src == null) { Log.error("src is null"); diff --git a/src/main/java/net/montoyo/wd/block/BlockKeyboardLeft.java b/src/main/java/net/montoyo/wd/block/BlockKeyboardLeft.java new file mode 100644 index 0000000..4efb0ab --- /dev/null +++ b/src/main/java/net/montoyo/wd/block/BlockKeyboardLeft.java @@ -0,0 +1,280 @@ +/* + * Copyright (C) 2019 BARBOTIN Nicolas + */ + +package net.montoyo.wd.block; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Vec3i; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Explosion; +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.RenderShape; +import net.minecraft.world.level.block.entity.BlockEntity; +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.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.PushReaction; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraftforge.network.PacketDistributor; +import net.montoyo.wd.core.DefaultPeripheral; +import net.montoyo.wd.entity.TileEntityInterfaceBase; +import net.montoyo.wd.entity.TileEntityKeyboard; +import net.montoyo.wd.entity.TileEntityPeripheralBase; +import net.montoyo.wd.entity.TileEntityServer; +import net.montoyo.wd.init.BlockInit; +import net.montoyo.wd.item.ItemLinker; +import net.montoyo.wd.net.Messages; +import net.montoyo.wd.net.client.CMessageCloseGui; +import org.jetbrains.annotations.Nullable; + +public class BlockKeyboardLeft extends WDBlockContainer { + + public static final EnumProperty type = EnumProperty.create("type", DefaultPeripheral.class); + public static final DirectionProperty facing = DirectionProperty.create("facing", Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST); + private static final Property[] properties = new Property[] { type, facing }; + + public BlockKeyboardLeft() { + super(Properties.of(Material.STONE).strength(1.5f, 10.f)); +// setName("peripheral"); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(properties); + } + + // @Nullable TODO: Fix +// @Override +// public BlockState getStateForPlacement(BlockPlaceContext context) { +// Direction rot = Direction.fromYRot(placer.getYHeadRot()); +// return defaultBlockState().setValue(type, DefaultPeripheral.fromMetadata(meta)).setValue(facing, rot); +// +// +// return getStateForPlacement(context); +// } +// +// public BlockState getStateForPlacement(@Nonnull Level world, @Nonnull BlockPos pos, @Nonnull Direction nocare, float hitX, +// float hitY, float hitZ, int meta, @Nonnull LivingEntity placer, InteractionHand hand) { +// } + +// @Override +// public void getSubBlocks(CreativeTabs tab, NonNullList list) { +// for(DefaultPeripheral dp : DefaultPeripheral.values()) +// list.add(new ItemStack(getItem(), 1, dp.toMetadata(0))); +// } + +// @Override +// @Nonnull +// public IBlockState getStateFromMeta(int meta) { +// DefaultPeripheral dp = DefaultPeripheral.fromMetadata(meta); +// IBlockState state = getDefaultState().withProperty(type, dp); +// +// if(dp.hasFacing()) +// state = state.withProperty(facing, (meta >> 2) & 3); +// +// return state; +// } +// +// @Override +// public int getMetaFromState(IBlockState state) { +// return state.getValue(type).toMetadata(state.getValue(facing)); +// } + + + /*@Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + BlockEntityType.BlockEntitySupplier cls = state.getValue(type).getTEClass(); + if(cls == null) + return null; + + try { + return cls.create(pos, state); + } catch(Throwable t) { + Log.errorEx("Couldn't instantiate peripheral TileEntity:", t); + } + + return null; + } */ + + @Override + public RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; + } + +// @Override +// public int damageDropped(IBlockState state) { +// return state.getValue(type).toMetadata(0); +// } + + + @Override + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + if(player.isShiftKeyDown()) + return InteractionResult.FAIL; + + if(player.getItemInHand(hand).getItem() instanceof ItemLinker) + return InteractionResult.FAIL; + + BlockEntity te = world.getBlockEntity(pos); + + if(te instanceof TileEntityPeripheralBase) + return ((TileEntityPeripheralBase) te).onRightClick(player, hand); + else if(te instanceof TileEntityServer) { + ((TileEntityServer) te).onPlayerRightClick(player); + return InteractionResult.PASS; + } else + return InteractionResult.FAIL; + } + +// @Override +// public boolean isFullCube(IBlockState state) { TODO: FIx. +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean isFullBlock(IBlockState state) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean isOpaqueCube(IBlockState state) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } + + @Override + public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { + return state.getValue(type) == DefaultPeripheral.KEYBOARD ? BlockKeyboardRight.KEYBOARD_AABB : Shapes.block(); + } + + @Override + public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + if(world.isClientSide) + return; + + if(state.getValue(type) == DefaultPeripheral.KEYBOARD) { + //Keyboard special treatment + Direction f = state.getValue(facing); + Vec3i dir = f.getClockWise().getNormal(); + BlockPos left = pos.offset(dir); + BlockPos right = pos.subtract(dir); + + if(!world.isEmptyBlock(pos.below()) && BlockKeyboardRight.checkNeighborhood(world, pos, null)) { + if(world.isEmptyBlock(right) && !world.isEmptyBlock(right.below()) && BlockKeyboardRight.checkNeighborhood(world, right, pos)) { + world.setBlock(right, BlockInit.blockKbRight.get().defaultBlockState().setValue(BlockKeyboardRight.facing, f), 3); + return; + } else if(world.isEmptyBlock(left) && !world.isEmptyBlock(left.below()) && BlockKeyboardRight.checkNeighborhood(world, left, pos)) { + world.setBlock(left, state, 3); + world.setBlock(pos, BlockInit.blockKbRight.get().defaultBlockState().setValue(BlockKeyboardRight.facing, f), 3); + return; + } + } + + //Not good; remove this shit... + world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); + if(!(placer instanceof Player) || !((Player) placer).isCreative()) { +// dropBlockAsItem(world, pos, state, 0); TODO: Loottable? + } + } else if(placer instanceof Player) { + BlockEntity te = world.getBlockEntity(pos); + + if(te instanceof TileEntityServer) + ((TileEntityServer) te).setOwner((Player) placer); + else if(te instanceof TileEntityInterfaceBase) + ((TileEntityInterfaceBase) te).setOwner((Player) placer); + } + } + + @Override + public PushReaction getPistonPushReaction(BlockState state) { + return PushReaction.IGNORE; + } + + private void removeRightPiece(Level world, BlockPos pos) { + for(Direction nf: Direction.Plane.HORIZONTAL) { + BlockPos np = pos.offset(nf.getNormal()); + + if(world.getBlockState(np).getBlock() instanceof BlockKeyboardRight) { + world.setBlock(np, Blocks.AIR.defaultBlockState(), 3); + break; + } + } + } + + @Override + public void neighborChanged(BlockState state, Level world, BlockPos pos, Block neighborType, BlockPos neighbor, boolean isMoving) { + BlockEntity te = world.getBlockEntity(pos); + if(te != null && te instanceof TileEntityPeripheralBase) + ((TileEntityPeripheralBase) te).onNeighborChange(neighborType, neighbor); + + if(world.isClientSide || state.getValue(type) != DefaultPeripheral.KEYBOARD) + return; + + if(neighbor.getX() == pos.getX() && neighbor.getY() == pos.getY() - 1 && neighbor.getZ() == pos.getZ() && world.isEmptyBlock(neighbor)) { + removeRightPiece(world, pos); + world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); +// dropBlockAsItem(world, pos, state, 0); //TODO Loottable + Messages.INSTANCE.send(PacketDistributor.NEAR.with(() -> point(world, pos)), new CMessageCloseGui(pos)); + } + } + + @Override + public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool) { + if(!world.isClientSide) { + if(state.getBlock() == this && state.getValue(type) == DefaultPeripheral.KEYBOARD) + removeRightPiece(world, pos); + + Messages.INSTANCE.send(PacketDistributor.NEAR.with(() -> point(world, pos)), new CMessageCloseGui(pos)); + } + } + + @Override + public void onBlockExploded(BlockState state, Level level, BlockPos pos, Explosion explosion) { + playerDestroy(level, null, pos, level.getBlockState(pos), null, null); + } + + @Override + public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if(!world.isClientSide && world.getBlockState(pos).getValue(type) == DefaultPeripheral.KEYBOARD) { + double rpos = (entity.getY() - ((double) pos.getY())) * 16.0; + + if(rpos >= 1.0 && rpos <= 2.0 && Math.random() < 0.25) { + BlockEntity te = world.getBlockEntity(pos); + + if(te != null && te instanceof TileEntityKeyboard) + ((TileEntityKeyboard) te).simulateCat(entity); + } + } + } + + public static PacketDistributor.TargetPoint point(Level world, BlockPos bp) { + return new PacketDistributor.TargetPoint(bp.getX(), bp.getY(), bp.getZ(), 64.0, world.dimension()); + } + +} diff --git a/src/main/java/net/montoyo/wd/block/BlockPeripheral.java b/src/main/java/net/montoyo/wd/block/BlockPeripheral.java index 7653530..9d5b5c4 100644 --- a/src/main/java/net/montoyo/wd/block/BlockPeripheral.java +++ b/src/main/java/net/montoyo/wd/block/BlockPeripheral.java @@ -4,19 +4,15 @@ package net.montoyo.wd.block; -import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.server.players.PlayerList; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; @@ -33,7 +29,6 @@ import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.PushReaction; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; @@ -49,9 +44,6 @@ import net.montoyo.wd.net.Messages; import net.montoyo.wd.net.client.CMessageCloseGui; import org.jetbrains.annotations.Nullable; -import java.util.List; -import java.util.Objects; - public class BlockPeripheral extends WDBlockContainer { public static final EnumProperty type = EnumProperty.create("type", DefaultPeripheral.class); @@ -61,7 +53,6 @@ public class BlockPeripheral extends WDBlockContainer { public BlockPeripheral() { super(BlockBehaviour.Properties.of(Material.STONE).strength(1.5f, 10.f)); // setName("peripheral"); - } @Override diff --git a/src/main/java/net/montoyo/wd/block/BlockRCTRL.java b/src/main/java/net/montoyo/wd/block/BlockRCTRL.java new file mode 100644 index 0000000..2082911 --- /dev/null +++ b/src/main/java/net/montoyo/wd/block/BlockRCTRL.java @@ -0,0 +1,235 @@ +/* + * Copyright (C) 2019 BARBOTIN Nicolas + */ + +package net.montoyo.wd.block; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Vec3i; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Explosion; +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.RenderShape; +import net.minecraft.world.level.block.entity.BlockEntity; +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.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.PushReaction; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraftforge.network.PacketDistributor; +import net.montoyo.wd.core.DefaultPeripheral; +import net.montoyo.wd.entity.TileEntityInterfaceBase; +import net.montoyo.wd.entity.TileEntityKeyboard; +import net.montoyo.wd.entity.TileEntityPeripheralBase; +import net.montoyo.wd.entity.TileEntityServer; +import net.montoyo.wd.init.BlockInit; +import net.montoyo.wd.item.ItemLinker; +import net.montoyo.wd.net.Messages; +import net.montoyo.wd.net.client.CMessageCloseGui; +import org.jetbrains.annotations.Nullable; + +public class BlockRCTRL extends WDBlockContainer { + + public static final DirectionProperty facing = DirectionProperty.create("facing", Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST); + private static final Property[] properties = new Property[] {facing}; + + public BlockRCTRL() { + super(Properties.of(Material.STONE).strength(1.5f, 10.f)); +// setName("peripheral"); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(properties); + } + + // @Nullable TODO: Fix +// @Override +// public BlockState getStateForPlacement(BlockPlaceContext context) { +// Direction rot = Direction.fromYRot(placer.getYHeadRot()); +// return defaultBlockState().setValue(type, DefaultPeripheral.fromMetadata(meta)).setValue(facing, rot); +// +// +// return getStateForPlacement(context); +// } +// +// public BlockState getStateForPlacement(@Nonnull Level world, @Nonnull BlockPos pos, @Nonnull Direction nocare, float hitX, +// float hitY, float hitZ, int meta, @Nonnull LivingEntity placer, InteractionHand hand) { +// } + +// @Override +// public void getSubBlocks(CreativeTabs tab, NonNullList list) { +// for(DefaultPeripheral dp : DefaultPeripheral.values()) +// list.add(new ItemStack(getItem(), 1, dp.toMetadata(0))); +// } + +// @Override +// @Nonnull +// public IBlockState getStateFromMeta(int meta) { +// DefaultPeripheral dp = DefaultPeripheral.fromMetadata(meta); +// IBlockState state = getDefaultState().withProperty(type, dp); +// +// if(dp.hasFacing()) +// state = state.withProperty(facing, (meta >> 2) & 3); +// +// return state; +// } +// +// @Override +// public int getMetaFromState(IBlockState state) { +// return state.getValue(type).toMetadata(state.getValue(facing)); +// } + + + /*@Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + BlockEntityType.BlockEntitySupplier cls = state.getValue(type).getTEClass(); + if(cls == null) + return null; + + try { + return cls.create(pos, state); + } catch(Throwable t) { + Log.errorEx("Couldn't instantiate peripheral TileEntity:", t); + } + + return null; + } */ + + @Override + public RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; + } + +// @Override +// public int damageDropped(IBlockState state) { +// return state.getValue(type).toMetadata(0); +// } + + + @Override + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + if(player.isShiftKeyDown()) + return InteractionResult.FAIL; + + if(player.getItemInHand(hand).getItem() instanceof ItemLinker) + return InteractionResult.FAIL; + + BlockEntity te = world.getBlockEntity(pos); + + if(te instanceof TileEntityPeripheralBase) + return ((TileEntityPeripheralBase) te).onRightClick(player, hand); + else if(te instanceof TileEntityServer) { + ((TileEntityServer) te).onPlayerRightClick(player); + return InteractionResult.PASS; + } else + return InteractionResult.FAIL; + } + +// @Override +// public boolean isFullCube(IBlockState state) { TODO: FIx. +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean isFullBlock(IBlockState state) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean isOpaqueCube(IBlockState state) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } + + @Override + public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + if(world.isClientSide) + return; + if(placer instanceof Player) { + BlockEntity te = world.getBlockEntity(pos); + + if(te instanceof TileEntityServer) + ((TileEntityServer) te).setOwner((Player) placer); + else if(te instanceof TileEntityInterfaceBase) + ((TileEntityInterfaceBase) te).setOwner((Player) placer); + } + } + + @Override + public PushReaction getPistonPushReaction(BlockState state) { + return PushReaction.IGNORE; + } + + @Override + public void neighborChanged(BlockState state, Level world, BlockPos pos, Block neighborType, BlockPos neighbor, boolean isMoving) { + BlockEntity te = world.getBlockEntity(pos); + if(te != null && te instanceof TileEntityPeripheralBase) + ((TileEntityPeripheralBase) te).onNeighborChange(neighborType, neighbor); + + if(world.isClientSide) + return; + + if(neighbor.getX() == pos.getX() && neighbor.getY() == pos.getY() - 1 && neighbor.getZ() == pos.getZ() && world.isEmptyBlock(neighbor)) { + world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); +// dropBlockAsItem(world, pos, state, 0); //TODO Loottable + Messages.INSTANCE.send(PacketDistributor.NEAR.with(() -> point(world, pos)), new CMessageCloseGui(pos)); + } + } + + @Override + public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool) { + if(!world.isClientSide) { + Messages.INSTANCE.send(PacketDistributor.NEAR.with(() -> point(world, pos)), new CMessageCloseGui(pos)); + } + } + + @Override + public void onBlockExploded(BlockState state, Level level, BlockPos pos, Explosion explosion) { + playerDestroy(level, null, pos, level.getBlockState(pos), null, null); + } + + @Override + public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if(!world.isClientSide) { + double rpos = (entity.getY() - ((double) pos.getY())) * 16.0; + + if(rpos >= 1.0 && rpos <= 2.0 && Math.random() < 0.25) { + BlockEntity te = world.getBlockEntity(pos); + + if(te != null && te instanceof TileEntityKeyboard) + ((TileEntityKeyboard) te).simulateCat(entity); + } + } + } + + public static PacketDistributor.TargetPoint point(Level world, BlockPos bp) { + return new PacketDistributor.TargetPoint(bp.getX(), bp.getY(), bp.getZ(), 64.0, world.dimension()); + } + +} diff --git a/src/main/java/net/montoyo/wd/block/BlockRedCTRL.java b/src/main/java/net/montoyo/wd/block/BlockRedCTRL.java new file mode 100644 index 0000000..a5131ad --- /dev/null +++ b/src/main/java/net/montoyo/wd/block/BlockRedCTRL.java @@ -0,0 +1,235 @@ +/* + * Copyright (C) 2019 BARBOTIN Nicolas + */ + +package net.montoyo.wd.block; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Vec3i; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Explosion; +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.RenderShape; +import net.minecraft.world.level.block.entity.BlockEntity; +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.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.PushReaction; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraftforge.network.PacketDistributor; +import net.montoyo.wd.core.DefaultPeripheral; +import net.montoyo.wd.entity.TileEntityInterfaceBase; +import net.montoyo.wd.entity.TileEntityKeyboard; +import net.montoyo.wd.entity.TileEntityPeripheralBase; +import net.montoyo.wd.entity.TileEntityServer; +import net.montoyo.wd.init.BlockInit; +import net.montoyo.wd.item.ItemLinker; +import net.montoyo.wd.net.Messages; +import net.montoyo.wd.net.client.CMessageCloseGui; +import org.jetbrains.annotations.Nullable; + +public class BlockRedCTRL extends WDBlockContainer { + + public static final DirectionProperty facing = DirectionProperty.create("facing", Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST); + private static final Property[] properties = new Property[] {facing}; + + public BlockRedCTRL() { + super(Properties.of(Material.STONE).strength(1.5f, 10.f)); +// setName("peripheral"); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(properties); + } + + // @Nullable TODO: Fix +// @Override +// public BlockState getStateForPlacement(BlockPlaceContext context) { +// Direction rot = Direction.fromYRot(placer.getYHeadRot()); +// return defaultBlockState().setValue(type, DefaultPeripheral.fromMetadata(meta)).setValue(facing, rot); +// +// +// return getStateForPlacement(context); +// } +// +// public BlockState getStateForPlacement(@Nonnull Level world, @Nonnull BlockPos pos, @Nonnull Direction nocare, float hitX, +// float hitY, float hitZ, int meta, @Nonnull LivingEntity placer, InteractionHand hand) { +// } + +// @Override +// public void getSubBlocks(CreativeTabs tab, NonNullList list) { +// for(DefaultPeripheral dp : DefaultPeripheral.values()) +// list.add(new ItemStack(getItem(), 1, dp.toMetadata(0))); +// } + +// @Override +// @Nonnull +// public IBlockState getStateFromMeta(int meta) { +// DefaultPeripheral dp = DefaultPeripheral.fromMetadata(meta); +// IBlockState state = getDefaultState().withProperty(type, dp); +// +// if(dp.hasFacing()) +// state = state.withProperty(facing, (meta >> 2) & 3); +// +// return state; +// } +// +// @Override +// public int getMetaFromState(IBlockState state) { +// return state.getValue(type).toMetadata(state.getValue(facing)); +// } + + + /*@Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + BlockEntityType.BlockEntitySupplier cls = state.getValue(type).getTEClass(); + if(cls == null) + return null; + + try { + return cls.create(pos, state); + } catch(Throwable t) { + Log.errorEx("Couldn't instantiate peripheral TileEntity:", t); + } + + return null; + } */ + + @Override + public RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; + } + +// @Override +// public int damageDropped(IBlockState state) { +// return state.getValue(type).toMetadata(0); +// } + + + @Override + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + if(player.isShiftKeyDown()) + return InteractionResult.FAIL; + + if(player.getItemInHand(hand).getItem() instanceof ItemLinker) + return InteractionResult.FAIL; + + BlockEntity te = world.getBlockEntity(pos); + + if(te instanceof TileEntityPeripheralBase) + return ((TileEntityPeripheralBase) te).onRightClick(player, hand); + else if(te instanceof TileEntityServer) { + ((TileEntityServer) te).onPlayerRightClick(player); + return InteractionResult.PASS; + } else + return InteractionResult.FAIL; + } + +// @Override +// public boolean isFullCube(IBlockState state) { TODO: FIx. +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean isFullBlock(IBlockState state) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean isOpaqueCube(IBlockState state) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } + + @Override + public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + if(world.isClientSide) + return; + if(placer instanceof Player) { + BlockEntity te = world.getBlockEntity(pos); + + if(te instanceof TileEntityServer) + ((TileEntityServer) te).setOwner((Player) placer); + else if(te instanceof TileEntityInterfaceBase) + ((TileEntityInterfaceBase) te).setOwner((Player) placer); + } + } + + @Override + public PushReaction getPistonPushReaction(BlockState state) { + return PushReaction.IGNORE; + } + + @Override + public void neighborChanged(BlockState state, Level world, BlockPos pos, Block neighborType, BlockPos neighbor, boolean isMoving) { + BlockEntity te = world.getBlockEntity(pos); + if(te != null && te instanceof TileEntityPeripheralBase) + ((TileEntityPeripheralBase) te).onNeighborChange(neighborType, neighbor); + + if(world.isClientSide) + return; + + if(neighbor.getX() == pos.getX() && neighbor.getY() == pos.getY() - 1 && neighbor.getZ() == pos.getZ() && world.isEmptyBlock(neighbor)) { + world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); +// dropBlockAsItem(world, pos, state, 0); //TODO Loottable + Messages.INSTANCE.send(PacketDistributor.NEAR.with(() -> point(world, pos)), new CMessageCloseGui(pos)); + } + } + + @Override + public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool) { + if(!world.isClientSide) { + Messages.INSTANCE.send(PacketDistributor.NEAR.with(() -> point(world, pos)), new CMessageCloseGui(pos)); + } + } + + @Override + public void onBlockExploded(BlockState state, Level level, BlockPos pos, Explosion explosion) { + playerDestroy(level, null, pos, level.getBlockState(pos), null, null); + } + + @Override + public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if(!world.isClientSide) { + double rpos = (entity.getY() - ((double) pos.getY())) * 16.0; + + if(rpos >= 1.0 && rpos <= 2.0 && Math.random() < 0.25) { + BlockEntity te = world.getBlockEntity(pos); + + if(te != null && te instanceof TileEntityKeyboard) + ((TileEntityKeyboard) te).simulateCat(entity); + } + } + } + + public static PacketDistributor.TargetPoint point(Level world, BlockPos bp) { + return new PacketDistributor.TargetPoint(bp.getX(), bp.getY(), bp.getZ(), 64.0, world.dimension()); + } + +} diff --git a/src/main/java/net/montoyo/wd/block/BlockScreen.java b/src/main/java/net/montoyo/wd/block/BlockScreen.java index 1d364c6..00ee9df 100644 --- a/src/main/java/net/montoyo/wd/block/BlockScreen.java +++ b/src/main/java/net/montoyo/wd/block/BlockScreen.java @@ -18,6 +18,7 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.BaseEntityBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.entity.BlockEntity; @@ -45,7 +46,7 @@ import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class BlockScreen extends Block { +public class BlockScreen extends BaseEntityBlock { public static final BooleanProperty hasTE = BooleanProperty.create("haste"); public static final BooleanProperty emitting = BooleanProperty.create("emitting"); @@ -71,7 +72,7 @@ public class BlockScreen extends Block { @Override public RenderShape getRenderShape(BlockState state) { - return RenderShape.MODEL; + return RenderShape.INVISIBLE; } public static boolean isntScreenBlock(Level world, Vector3i pos) { @@ -166,7 +167,7 @@ public class BlockScreen extends Block { Util.toast(player, ChatFormatting.AQUA, "upgradeOk"); if(player instanceof ServerPlayer) - new WebDisplays().criterionUpgradeScreen.trigger(((ServerPlayer) player).getAdvancements()); + WebDisplays.INSTANCE.criterionUpgradeScreen.trigger(((ServerPlayer) player).getAdvancements()); } else Util.toast(player, "upgradeError"); @@ -194,8 +195,8 @@ public class BlockScreen extends Block { return InteractionResult.SUCCESS; } - if(size.x > new WebDisplays().maxScreenX || size.y > new WebDisplays().maxScreenY) { - Util.toast(player, "tooBig", new WebDisplays().maxScreenX, new WebDisplays().maxScreenY); + if(size.x > WebDisplays.INSTANCE.maxScreenX || size.y > WebDisplays.INSTANCE.maxScreenY) { + Util.toast(player, "tooBig", WebDisplays.INSTANCE.maxScreenX, WebDisplays.INSTANCE.maxScreenY); return InteractionResult.SUCCESS; } @@ -294,7 +295,7 @@ public class BlockScreen extends Block { return false; } - /* @org.jetbrains.annotations.Nullable + @org.jetbrains.annotations.Nullable @Override public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { int meta = getMetaFromState(state); @@ -303,7 +304,7 @@ public class BlockScreen extends Block { return null; return ((meta & 1) == 0) ? null : new TileEntityScreen(pos, state); - }*/ + } /************************************************* DESTRUCTION HANDLING *************************************************/ diff --git a/src/main/java/net/montoyo/wd/block/BlockServer.java b/src/main/java/net/montoyo/wd/block/BlockServer.java new file mode 100644 index 0000000..d8de998 --- /dev/null +++ b/src/main/java/net/montoyo/wd/block/BlockServer.java @@ -0,0 +1,235 @@ +/* + * Copyright (C) 2019 BARBOTIN Nicolas + */ + +package net.montoyo.wd.block; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Vec3i; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Explosion; +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.RenderShape; +import net.minecraft.world.level.block.entity.BlockEntity; +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.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.PushReaction; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraftforge.network.PacketDistributor; +import net.montoyo.wd.core.DefaultPeripheral; +import net.montoyo.wd.entity.TileEntityInterfaceBase; +import net.montoyo.wd.entity.TileEntityKeyboard; +import net.montoyo.wd.entity.TileEntityPeripheralBase; +import net.montoyo.wd.entity.TileEntityServer; +import net.montoyo.wd.init.BlockInit; +import net.montoyo.wd.item.ItemLinker; +import net.montoyo.wd.net.Messages; +import net.montoyo.wd.net.client.CMessageCloseGui; +import org.jetbrains.annotations.Nullable; + +public class BlockServer extends WDBlockContainer { + + public static final DirectionProperty facing = DirectionProperty.create("facing", Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST); + private static final Property[] properties = new Property[] {facing}; + + public BlockServer() { + super(Properties.of(Material.STONE).strength(1.5f, 10.f)); +// setName("peripheral"); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(properties); + } + + // @Nullable TODO: Fix +// @Override +// public BlockState getStateForPlacement(BlockPlaceContext context) { +// Direction rot = Direction.fromYRot(placer.getYHeadRot()); +// return defaultBlockState().setValue(type, DefaultPeripheral.fromMetadata(meta)).setValue(facing, rot); +// +// +// return getStateForPlacement(context); +// } +// +// public BlockState getStateForPlacement(@Nonnull Level world, @Nonnull BlockPos pos, @Nonnull Direction nocare, float hitX, +// float hitY, float hitZ, int meta, @Nonnull LivingEntity placer, InteractionHand hand) { +// } + +// @Override +// public void getSubBlocks(CreativeTabs tab, NonNullList list) { +// for(DefaultPeripheral dp : DefaultPeripheral.values()) +// list.add(new ItemStack(getItem(), 1, dp.toMetadata(0))); +// } + +// @Override +// @Nonnull +// public IBlockState getStateFromMeta(int meta) { +// DefaultPeripheral dp = DefaultPeripheral.fromMetadata(meta); +// IBlockState state = getDefaultState().withProperty(type, dp); +// +// if(dp.hasFacing()) +// state = state.withProperty(facing, (meta >> 2) & 3); +// +// return state; +// } +// +// @Override +// public int getMetaFromState(IBlockState state) { +// return state.getValue(type).toMetadata(state.getValue(facing)); +// } + + + /*@Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + BlockEntityType.BlockEntitySupplier cls = state.getValue(type).getTEClass(); + if(cls == null) + return null; + + try { + return cls.create(pos, state); + } catch(Throwable t) { + Log.errorEx("Couldn't instantiate peripheral TileEntity:", t); + } + + return null; + } */ + + @Override + public RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; + } + +// @Override +// public int damageDropped(IBlockState state) { +// return state.getValue(type).toMetadata(0); +// } + + + @Override + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + if(player.isShiftKeyDown()) + return InteractionResult.FAIL; + + if(player.getItemInHand(hand).getItem() instanceof ItemLinker) + return InteractionResult.FAIL; + + BlockEntity te = world.getBlockEntity(pos); + + if(te instanceof TileEntityPeripheralBase) + return ((TileEntityPeripheralBase) te).onRightClick(player, hand); + else if(te instanceof TileEntityServer) { + ((TileEntityServer) te).onPlayerRightClick(player); + return InteractionResult.PASS; + } else + return InteractionResult.FAIL; + } + +// @Override +// public boolean isFullCube(IBlockState state) { TODO: FIx. +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean isFullBlock(IBlockState state) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean isOpaqueCube(IBlockState state) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } +// +// @Override +// public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) { +// return state.getValue(type) != DefaultPeripheral.KEYBOARD; +// } + + @Override + public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + if(world.isClientSide) + return; + if(placer instanceof Player) { + BlockEntity te = world.getBlockEntity(pos); + + if(te instanceof TileEntityServer) + ((TileEntityServer) te).setOwner((Player) placer); + else if(te instanceof TileEntityInterfaceBase) + ((TileEntityInterfaceBase) te).setOwner((Player) placer); + } + } + + @Override + public PushReaction getPistonPushReaction(BlockState state) { + return PushReaction.IGNORE; + } + + @Override + public void neighborChanged(BlockState state, Level world, BlockPos pos, Block neighborType, BlockPos neighbor, boolean isMoving) { + BlockEntity te = world.getBlockEntity(pos); + if(te != null && te instanceof TileEntityPeripheralBase) + ((TileEntityPeripheralBase) te).onNeighborChange(neighborType, neighbor); + + if(world.isClientSide) + return; + + if(neighbor.getX() == pos.getX() && neighbor.getY() == pos.getY() - 1 && neighbor.getZ() == pos.getZ() && world.isEmptyBlock(neighbor)) { + world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); +// dropBlockAsItem(world, pos, state, 0); //TODO Loottable + Messages.INSTANCE.send(PacketDistributor.NEAR.with(() -> point(world, pos)), new CMessageCloseGui(pos)); + } + } + + @Override + public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool) { + if(!world.isClientSide) { + Messages.INSTANCE.send(PacketDistributor.NEAR.with(() -> point(world, pos)), new CMessageCloseGui(pos)); + } + } + + @Override + public void onBlockExploded(BlockState state, Level level, BlockPos pos, Explosion explosion) { + playerDestroy(level, null, pos, level.getBlockState(pos), null, null); + } + + @Override + public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if(!world.isClientSide) { + double rpos = (entity.getY() - ((double) pos.getY())) * 16.0; + + if(rpos >= 1.0 && rpos <= 2.0 && Math.random() < 0.25) { + BlockEntity te = world.getBlockEntity(pos); + + if(te != null && te instanceof TileEntityKeyboard) + ((TileEntityKeyboard) te).simulateCat(entity); + } + } + } + + public static PacketDistributor.TargetPoint point(Level world, BlockPos bp) { + return new PacketDistributor.TargetPoint(bp.getX(), bp.getY(), bp.getZ(), 64.0, world.dimension()); + } + +} diff --git a/src/main/java/net/montoyo/wd/client/ClientProxy.java b/src/main/java/net/montoyo/wd/client/ClientProxy.java index ae9e5a3..b804070 100644 --- a/src/main/java/net/montoyo/wd/client/ClientProxy.java +++ b/src/main/java/net/montoyo/wd/client/ClientProxy.java @@ -90,7 +90,7 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer private PadData(String url, int id) { view = mcef.createBrowser(WebDisplays.applyBlacklist(url)); - view.resize((int) new WebDisplays().padResX, (int) new WebDisplays().padResY); + view.resize((int) WebDisplays.INSTANCE.padResX, (int) WebDisplays.INSTANCE.padResY); isInHotbar = true; this.id = id; } @@ -487,7 +487,7 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer @SubscribeEvent public void onRegisterModels(ModelRegistryEvent ev) { - final WebDisplays wd = new WebDisplays(); + final WebDisplays wd = WebDisplays.INSTANCE; //I hope I'm doing this right because it doesn't seem like it... // registerItemModel(wd.blockScreen.getItem(), 0, "inventory"); @@ -547,11 +547,11 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer double dist2 = mc.player.distanceToSqr(tes.getBlockPos().getX(), tes.getBlockPos().getY(), tes.getBlockPos().getZ()); if(tes.isLoaded()) { - if(dist2 > new WebDisplays().unloadDistance2) + if(dist2 > WebDisplays.INSTANCE.unloadDistance2) tes.unload(); //else if(WebDisplays.INSTANCE.enableSoundDistance) // tes.updateTrackDistance(dist2, SoundSystemConfig.getMasterGain()); - } else if(dist2 <= new WebDisplays().loadDistance2) + } else if(dist2 <= WebDisplays.INSTANCE.loadDistance2) tes.load(); } diff --git a/src/main/java/net/montoyo/wd/client/gui/GuiMinePad.java b/src/main/java/net/montoyo/wd/client/gui/GuiMinePad.java index c61eb02..72ce7fd 100644 --- a/src/main/java/net/montoyo/wd/client/gui/GuiMinePad.java +++ b/src/main/java/net/montoyo/wd/client/gui/GuiMinePad.java @@ -143,8 +143,8 @@ public class GuiMinePad extends WDScreen { sy = vh - sy; //Scale again according to the webview - sx = (int) (((double) sx) / ((double) vw) * new WebDisplays().padResX); - sy = (int) (((double) sy) / ((double) vh) * new WebDisplays().padResY); + sx = (int) (((double) sx) / ((double) vw) * WebDisplays.INSTANCE.padResX); + sy = (int) (((double) sy) / ((double) vh) * WebDisplays.INSTANCE.padResY); if (btn == -1) pad.view.injectMouseMove(sx, sy, 0, false); diff --git a/src/main/java/net/montoyo/wd/client/gui/GuiScreenConfig.java b/src/main/java/net/montoyo/wd/client/gui/GuiScreenConfig.java index 75856d4..1fde606 100644 --- a/src/main/java/net/montoyo/wd/client/gui/GuiScreenConfig.java +++ b/src/main/java/net/montoyo/wd/client/gui/GuiScreenConfig.java @@ -172,7 +172,7 @@ public class GuiScreenConfig extends WDScreen { updateMyRights(); updateRotationStr(); - minecraft.getSoundManager().play(SimpleSoundInstance.forUI( new WebDisplays().soundScreenCfg, 1.0f, 1.0f)); + minecraft.getSoundManager().play(SimpleSoundInstance.forUI( WebDisplays.INSTANCE.soundScreenCfg, 1.0f, 1.0f)); } private void updateRotationStr() { diff --git a/src/main/java/net/montoyo/wd/client/gui/GuiServer.java b/src/main/java/net/montoyo/wd/client/gui/GuiServer.java index 9d912d4..2179f5a 100644 --- a/src/main/java/net/montoyo/wd/client/gui/GuiServer.java +++ b/src/main/java/net/montoyo/wd/client/gui/GuiServer.java @@ -169,7 +169,7 @@ public class GuiServer extends WDScreen { accessTime = 20; } else { if(accessSound == null) { - accessSound = new SimpleSoundInstance( new WebDisplays().soundServer.getLocation(), SoundSource.MASTER, 1.0f, 1.0f, true, 0, SoundInstance.Attenuation.NONE, 0.0f, 0.0f, 0.0f, false); + accessSound = new SimpleSoundInstance( WebDisplays.INSTANCE.soundServer.getLocation(), SoundSource.MASTER, 1.0f, 1.0f, true, 0, SoundInstance.Attenuation.NONE, 0.0f, 0.0f, 0.0f, false); minecraft.getSoundManager().play(accessSound); } diff --git a/src/main/java/net/montoyo/wd/client/renderers/LaserPointerRenderer.java b/src/main/java/net/montoyo/wd/client/renderers/LaserPointerRenderer.java index 92a3e5c..c810fa3 100644 --- a/src/main/java/net/montoyo/wd/client/renderers/LaserPointerRenderer.java +++ b/src/main/java/net/montoyo/wd/client/renderers/LaserPointerRenderer.java @@ -51,7 +51,7 @@ public final class LaserPointerRenderer implements IItemRenderer { poseStack.pushPose(); poseStack.translate(handSideSign * -0.4f * sinSqrtSwingProg1, (float) (0.2f * Math.sin(sqrtSwingProg * PI * 2.0f)), (float) (-0.2f * Math.sin(swingProgress * PI))); poseStack.translate(handSideSign * 0.56f, -0.52f - equipProgress * 0.6f, -0.72f); - poseStack.mulPose(Vector3f.YP.rotationDegrees((float) (handSideSign * (45.0f - Math.sin(swingProgress * swingProgress * PI) * 20.0f))); + poseStack.mulPose(Vector3f.YP.rotationDegrees((float) (handSideSign * (45.0f - Math.sin(swingProgress * swingProgress * PI) * 20.0f)))); poseStack.mulPose(Vector3f.ZP.rotationDegrees(handSideSign * sinSqrtSwingProg1 * -20.0f)); poseStack.mulPose(Vector3f.XP.rotationDegrees(sinSqrtSwingProg1 * -80.0f)); poseStack.mulPose(Vector3f.YP.rotationDegrees(handSideSign * -30.0f)); @@ -60,6 +60,7 @@ public final class LaserPointerRenderer implements IItemRenderer { poseStack.scale(1.0f / 16.0f, 1.0f / 16.0f, 1.0f / 16.0f); RenderSystem.setShaderColor(0.5f, 0.5f, 0.5f, 1.0f); + bb.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION); bb.vertex(0.0, 0.0, 0.0).endVertex(); bb.vertex(1.0, 0.0, 0.0).endVertex(); @@ -80,39 +81,35 @@ public final class LaserPointerRenderer implements IItemRenderer { bb.vertex(1.0, -1.0, 4.0).endVertex(); bb.vertex(1.0, 0.0, 4.0).endVertex(); bb.vertex(0.0, 0.0, 4.0).endVertex(); - vb.draw(); - -// if(isOn) { -// glTranslatef(0.5f, -0.5f, 0.0f); -// matrix1.position(0); -// glGetFloat(GL_MODELVIEW_MATRIX); //Hax to get that damn position -// } + t.end(); + if(isOn) { + poseStack.translate(0.5f, -0.5f, 0.0f); + matrix1.position(0); + RenderSystem.getModelViewMatrix(); //Hax to get that damn position + } poseStack.popPose(); -// if(isOn) { -// //Actual laser -// glPushMatrix(); -// glLoadIdentity(); -// RenderSystem.enableBlend(); -// RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.DST_ALPHA); -// glColor4f(1.0f, 0.0f, 0.0f, 0.5f); -// RenderSystem.lineWidth(3.0f); -// -// matrix1.position(12); -// renderBuffer.put(matrix1.get()); -// renderBuffer.put(matrix1.get()); -// renderBuffer.put(matrix1.get() - 0.02f); //I know this is stupid, but it's the only thing that worked... -// renderBuffer.put(matrix1.get()); -// renderBuffer.position(0); -// glVertexPointer(4, 0, 0 , renderBuffer); -// glEnableClientState(GL_VERTEX_ARRAY); -// glDrawArrays(GL_LINES, 0, 2); -// glDisableClientState(GL_VERTEX_ARRAY); -// glPopMatrix(); -// } + if(isOn) { + //Actual laser + poseStack.pushPose(); + RenderSystem.enableBlend(); + RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.DST_ALPHA); + RenderSystem.setShaderColor(1.0f, 0.0f, 0.0f, 0.5f); + RenderSystem.lineWidth(3.0f); + + matrix1.position(12); + renderBuffer.put(matrix1.get()); + renderBuffer.put(matrix1.get()); + renderBuffer.put(matrix1.get() - 0.02f); //I know this is stupid, but it's the only thing that worked... + renderBuffer.put(matrix1.get()); + renderBuffer.position(0); + RenderSystem.drawElements(GL_LINES, 0, GL_UNSIGNED_INT); + poseStack.popPose(); + } RenderSystem.enableTexture(); //Fix for shitty minecraft fire + RenderSystem.enableCull(); } } diff --git a/src/main/java/net/montoyo/wd/client/renderers/ScreenRenderer.java b/src/main/java/net/montoyo/wd/client/renderers/ScreenRenderer.java index ff7e01a..f08bd0b 100644 --- a/src/main/java/net/montoyo/wd/client/renderers/ScreenRenderer.java +++ b/src/main/java/net/montoyo/wd/client/renderers/ScreenRenderer.java @@ -105,11 +105,11 @@ public class ScreenRenderer implements BlockEntityRenderer { scr.doTurnOnAnim = false; } - glScalef(ft, ft, 1.0f); + poseStack.scale(ft, ft, 1.0f); } - if(!scr.rotation.isNull) - glRotatef(scr.rotation.angle, 0.0f, 0.0f, 1.0f); + // if(!scr.rotation.isNull) + // poseStack.mulPose(YP.rotationDegrees(scr.rotation.angle)); float sw = ((float) scr.size.x) * 0.5f - 2.f / 16.f; float sh = ((float) scr.size.y) * 0.5f - 2.f / 16.f; @@ -130,30 +130,29 @@ public class ScreenRenderer implements BlockEntityRenderer { builder.vertex( sw, -sh, 0.505f).color(1.f, 1.f, 1.f, 1.f).uv(1.f, 1.f).endVertex(); builder.vertex( sw, sh, 0.505f).color(1.f, 1.f, 1.f, 1.f).uv(1.f, 0.f).endVertex(); builder.vertex(-sw, sh, 0.505f).color(1.f, 1.f, 1.f, 1.f).uv(0.f, 0.f).endVertex(); - builder.end(); - RenderSystem.bindTexture(0); //Minecraft does shit with mah texture otherwise... + tesselator.end();//Minecraft does shit with mah texture otherwise... + RenderSystem.bindTexture(0); poseStack.popPose(); } - /* + //Bounding box debugging - glPushMatrix(); - glTranslated(-rendererDispatcher.entityX, -rendererDispatcher.entityY, -rendererDispatcher.entityZ); + poseStack.pushPose(); + poseStack.translate(-te.getBlockPos().getX(), -te.getBlockPos().getY(), -te.getBlockPos().getZ()); renderAABB(te.getRenderBoundingBox()); - glPopMatrix(); - */ + poseStack.popPose(); //Re-enable lighting RenderSystem.enableCull(); } public void renderAABB(AABB bb) { - glDisable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glDisable(GL_CULL_FACE); - glColor4f(0.f, 0.5f, 1.f, 0.75f); - glDepthMask(false); + RenderSystem.disableTexture(); + RenderSystem.enableBlend(); + RenderSystem.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + RenderSystem.disableCull(); + RenderSystem.setShaderColor(0.f, 0.5f, 1.f, 0.75f); + RenderSystem.depthMask(false); Tesselator t = new Tesselator(); BufferBuilder vb = t.getBuilder(); @@ -197,9 +196,9 @@ public class ScreenRenderer implements BlockEntityRenderer { vb.vertex(bb.minX, bb.maxY, bb.maxZ).endVertex(); tb.draw(); - glDepthMask(true); - glEnable(GL_CULL_FACE); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); + RenderSystem.depthMask(true); + RenderSystem.enableCull(); + RenderSystem.enableTexture(); + RenderSystem.disableBlend(); } } diff --git a/src/main/java/net/montoyo/wd/entity/TileEntityKeyboard.java b/src/main/java/net/montoyo/wd/entity/TileEntityKeyboard.java index e1f84a4..d0b9cf3 100644 --- a/src/main/java/net/montoyo/wd/entity/TileEntityKeyboard.java +++ b/src/main/java/net/montoyo/wd/entity/TileEntityKeyboard.java @@ -20,6 +20,8 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.montoyo.wd.WebDisplays; import net.montoyo.wd.block.BlockKeyboardRight; +import net.montoyo.wd.block.BlockPeripheral; +import net.montoyo.wd.core.DefaultPeripheral; import net.montoyo.wd.core.ScreenRights; import net.montoyo.wd.data.KeyboardData; import net.montoyo.wd.init.TileInit; @@ -39,11 +41,7 @@ public class TileEntityKeyboard extends TileEntityPeripheralBase { } public static Block getBlockFromTE() { - if(blockPos != null && blockState != null) { - return new TileEntityKeyboard(blockPos, blockState).getBlockState().getBlock(); - } else { - throw new RuntimeException(); - } + return new BlockPeripheral().defaultBlockState().getBlock(); } @Override @@ -91,7 +89,7 @@ public class TileEntityKeyboard extends TileEntityPeripheralBase { Player owner = level.getPlayerByUUID(scr.owner.uuid); if(owner != null && owner instanceof ServerPlayer && ent instanceof Ocelot) - new WebDisplays().criterionKeyboardCat.trigger(((ServerPlayer) owner).getAdvancements()); + WebDisplays.INSTANCE.criterionKeyboardCat.trigger(((ServerPlayer) owner).getAdvancements()); } } } diff --git a/src/main/java/net/montoyo/wd/entity/TileEntityRCtrl.java b/src/main/java/net/montoyo/wd/entity/TileEntityRCtrl.java index 047cc17..2acba26 100644 --- a/src/main/java/net/montoyo/wd/entity/TileEntityRCtrl.java +++ b/src/main/java/net/montoyo/wd/entity/TileEntityRCtrl.java @@ -12,6 +12,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; +import net.montoyo.wd.block.BlockPeripheral; import net.montoyo.wd.core.ScreenRights; import net.montoyo.wd.data.SetURLData; import net.montoyo.wd.init.TileInit; @@ -29,11 +30,7 @@ public class TileEntityRCtrl extends TileEntityPeripheralBase { } public static Block getBlockFromTE() { - if(blockPos != null && blockState != null) { - return new TileEntityKeyboard(blockPos, blockState).getBlockState().getBlock(); - } else { - throw new RuntimeException(); - } + return new BlockPeripheral().defaultBlockState().getBlock(); } @Override diff --git a/src/main/java/net/montoyo/wd/entity/TileEntityRedCtrl.java b/src/main/java/net/montoyo/wd/entity/TileEntityRedCtrl.java index 80dc32a..2ca0328 100644 --- a/src/main/java/net/montoyo/wd/entity/TileEntityRedCtrl.java +++ b/src/main/java/net/montoyo/wd/entity/TileEntityRedCtrl.java @@ -14,6 +14,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; +import net.montoyo.wd.block.BlockPeripheral; import net.montoyo.wd.core.ScreenRights; import net.montoyo.wd.data.RedstoneCtrlData; import net.montoyo.wd.init.TileInit; @@ -37,11 +38,7 @@ public class TileEntityRedCtrl extends TileEntityPeripheralBase { } public static Block getBlockFromTE() { - if(blockPos != null && blockState != null) { - return new TileEntityKeyboard(blockPos, blockState).getBlockState().getBlock(); - } else { - throw new RuntimeException(); - } + return new BlockPeripheral().defaultBlockState().getBlock(); } @Override diff --git a/src/main/java/net/montoyo/wd/entity/TileEntityScreen.java b/src/main/java/net/montoyo/wd/entity/TileEntityScreen.java index 68879ff..2f75c16 100644 --- a/src/main/java/net/montoyo/wd/entity/TileEntityScreen.java +++ b/src/main/java/net/montoyo/wd/entity/TileEntityScreen.java @@ -203,16 +203,16 @@ public class TileEntityScreen extends BlockEntity{ public void clampResolution() { - if(resolution.x > new WebDisplays().maxResX) { - float newY = ((float) resolution.y) * ((float) new WebDisplays().maxResX) / ((float) resolution.x); - resolution.x = new WebDisplays().maxResX; + if(resolution.x > WebDisplays.INSTANCE.maxResX) { + float newY = ((float) resolution.y) * ((float) WebDisplays.INSTANCE.maxResX) / ((float) resolution.x); + resolution.x = WebDisplays.INSTANCE.maxResX; resolution.y = (int) newY; } - if(resolution.y > new WebDisplays().maxResY) { - float newX = ((float) resolution.x) * ((float) new WebDisplays().maxResY) / ((float) resolution.y); + if(resolution.y > WebDisplays.INSTANCE.maxResY) { + float newX = ((float) resolution.x) * ((float) WebDisplays.INSTANCE.maxResY) / ((float) resolution.y); resolution.x = (int) newX; - resolution.y = new WebDisplays().maxResY; + resolution.y = WebDisplays.INSTANCE.maxResY; } } @@ -289,7 +289,7 @@ public class TileEntityScreen extends BlockEntity{ Screen ret = new Screen(); ret.side = side; ret.size = size; - ret.url = new WebDisplays().homePage; + ret.url = WebDisplays.INSTANCE.homePage; ret.friends = new ArrayList<>(); ret.friendRights = ScreenRights.DEFAULTS; ret.otherRights = ScreenRights.DEFAULTS; @@ -661,7 +661,7 @@ public class TileEntityScreen extends BlockEntity{ //FIXME: Not called if enableSoundDistance is false public void updateTrackDistance(double d, float masterVolume) { - final WebDisplays wd = new WebDisplays(); + final WebDisplays wd = WebDisplays.INSTANCE; boolean needsComputation = true; int intPart = 0; //Need to initialize those because the compiler is stupid int fracPart = 0; @@ -804,7 +804,7 @@ public class TileEntityScreen extends BlockEntity{ Messages.INSTANCE.send(PacketDistributor.NEAR.with(() -> point(level, getBlockPos())), CMessageScreenUpdate.type(this, side, text)); if(soundPos != null) - playSoundAt( new WebDisplays().soundTyping, soundPos, 0.25f, 1.f); + playSoundAt( WebDisplays.INSTANCE.soundTyping, soundPos, 0.25f, 1.f); } } @@ -871,7 +871,7 @@ public class TileEntityScreen extends BlockEntity{ scr.upgrades.add(isCopy); Messages.INSTANCE.send(PacketDistributor.NEAR.with(() -> point(level, getBlockPos())), CMessageScreenUpdate.upgrade(this, side)); itemAsUpgrade.onInstall(this, side, player, isCopy); - playSoundAt(new WebDisplays().soundUpgradeAdd, getBlockPos(), 1.0f, 1.0f); + playSoundAt(WebDisplays.INSTANCE.soundUpgradeAdd, getBlockPos(), 1.0f, 1.0f); setChanged(); return true; } @@ -922,7 +922,7 @@ public class TileEntityScreen extends BlockEntity{ dropUpgrade(scr.upgrades.get(idxToRemove), side, player); scr.upgrades.remove(idxToRemove); Messages.INSTANCE.send(PacketDistributor.NEAR.with(() -> point(level, getBlockPos())), CMessageScreenUpdate.upgrade(this, side)); - playSoundAt(new WebDisplays().soundUpgradeDel, getBlockPos(), 1.0f, 1.0f); + playSoundAt(WebDisplays.INSTANCE.soundUpgradeDel, getBlockPos(), 1.0f, 1.0f); setChanged(); } else Log.warning("Tried to remove non-existing upgrade %s to screen %s at %s", safeName(is), side.toString(), getBlockPos().toString()); diff --git a/src/main/java/net/montoyo/wd/entity/TileEntityServer.java b/src/main/java/net/montoyo/wd/entity/TileEntityServer.java index bc02d3e..63d7af9 100644 --- a/src/main/java/net/montoyo/wd/entity/TileEntityServer.java +++ b/src/main/java/net/montoyo/wd/entity/TileEntityServer.java @@ -13,6 +13,7 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.montoyo.wd.WebDisplays; +import net.montoyo.wd.block.BlockPeripheral; import net.montoyo.wd.data.ServerData; import net.montoyo.wd.init.TileInit; import net.montoyo.wd.utilities.NameUUIDPair; @@ -33,11 +34,7 @@ public class TileEntityServer extends BlockEntity { } public static Block getBlockFromTE() { - if(blockPos != null && blockState != null) { - return new TileEntityKeyboard(blockPos, blockState).getBlockState().getBlock(); - } else { - throw new RuntimeException(); - } + return new TileEntityServer(blockPos, blockState).getBlockState().getBlock(); } @Override @@ -63,7 +60,7 @@ public class TileEntityServer extends BlockEntity { if(level.isClientSide) return; - if( new WebDisplays().miniservPort == 0) + if( WebDisplays.INSTANCE.miniservPort == 0) Util.toast(ply, "noMiniserv"); else if(owner != null && ply instanceof ServerPlayer) (new ServerData(getBlockPos(), owner)).sendTo((ServerPlayer) ply); diff --git a/src/main/java/net/montoyo/wd/init/BlockInit.java b/src/main/java/net/montoyo/wd/init/BlockInit.java index 4990495..037c100 100644 --- a/src/main/java/net/montoyo/wd/init/BlockInit.java +++ b/src/main/java/net/montoyo/wd/init/BlockInit.java @@ -7,9 +7,8 @@ import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; -import net.montoyo.wd.block.BlockKeyboardRight; -import net.montoyo.wd.block.BlockPeripheral; -import net.montoyo.wd.block.BlockScreen; +import net.montoyo.wd.block.*; +import net.montoyo.wd.core.DefaultPeripheral; public class BlockInit { @@ -21,13 +20,13 @@ public class BlockInit { public static final RegistryObject blockScreen = BLOCKS.register("screen", () -> new BlockScreen(BlockBehaviour.Properties.of(Material.STONE))); - public static final RegistryObject blockKeyBoard = BlockInit.BLOCKS.register("kb_left", BlockPeripheral::new); + public static final RegistryObject blockKeyBoard = BlockInit.BLOCKS.register("kb_left", BlockKeyboardLeft::new); - public static final RegistryObject blockRedControl = BlockInit.BLOCKS.register("redctrl", BlockPeripheral::new); + public static final RegistryObject blockRedControl = BlockInit.BLOCKS.register("redctrl", BlockRedCTRL::new); - public static final RegistryObject blockRControl = BlockInit.BLOCKS.register("rctrl", BlockPeripheral::new); + public static final RegistryObject blockRControl = BlockInit.BLOCKS.register("rctrl", BlockRCTRL::new); - public static final RegistryObject blockServer = BlockInit.BLOCKS.register("server", BlockPeripheral::new); + public static final RegistryObject blockServer = BlockInit.BLOCKS.register("server", BlockServer::new); public static final RegistryObject blockKbRight = BLOCKS.register("kb_right", BlockKeyboardRight::new); } diff --git a/src/main/java/net/montoyo/wd/item/ItemLinker.java b/src/main/java/net/montoyo/wd/item/ItemLinker.java index bc34ac5..3e7579a 100644 --- a/src/main/java/net/montoyo/wd/item/ItemLinker.java +++ b/src/main/java/net/montoyo/wd/item/ItemLinker.java @@ -72,7 +72,7 @@ public class ItemLinker extends Item implements WDItem { Util.toast(context.getPlayer(), ChatFormatting.AQUA, "linked"); if(context.getPlayer() instanceof ServerPlayer) - new WebDisplays().criterionLinkPeripheral.trigger(((ServerPlayer) context.getPlayer()).getAdvancements()); + WebDisplays.INSTANCE.criterionLinkPeripheral.trigger(((ServerPlayer) context.getPlayer()).getAdvancements()); } else Util.toast(context.getPlayer(), "linkError"); diff --git a/src/main/java/net/montoyo/wd/item/ItemMinePad2.java b/src/main/java/net/montoyo/wd/item/ItemMinePad2.java index 202fa5d..79ca039 100644 --- a/src/main/java/net/montoyo/wd/item/ItemMinePad2.java +++ b/src/main/java/net/montoyo/wd/item/ItemMinePad2.java @@ -37,7 +37,7 @@ public class ItemMinePad2 extends Item implements WDItem { private static String getURL(ItemStack is) { if(is.getTag() == null || !is.getTag().contains("PadURL")) - return new WebDisplays().homePage; + return WebDisplays.INSTANCE.homePage; else return is.getTag().getString("PadURL"); } @@ -92,7 +92,7 @@ public class ItemMinePad2 extends Item implements WDItem { Player ply = ent.getLevel().getPlayerByUUID(thrower); if(ply != null && ply instanceof ServerPlayer) - new WebDisplays().criterionPadBreak.trigger(((ServerPlayer) ply).getAdvancements()); + WebDisplays.INSTANCE.criterionPadBreak.trigger(((ServerPlayer) ply).getAdvancements()); } } } diff --git a/src/main/java/net/montoyo/wd/item/ItemOwnershipThief.java b/src/main/java/net/montoyo/wd/item/ItemOwnershipThief.java index 468141d..6c62953 100644 --- a/src/main/java/net/montoyo/wd/item/ItemOwnershipThief.java +++ b/src/main/java/net/montoyo/wd/item/ItemOwnershipThief.java @@ -38,7 +38,7 @@ public class ItemOwnershipThief extends Item implements WDItem { if(context.getLevel().isClientSide) return InteractionResult.SUCCESS; - if( new WebDisplays().disableOwnershipThief) { + if(WebDisplays.INSTANCE.disableOwnershipThief) { Util.toast(context.getPlayer(), "otDisabled"); return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/montoyo/wd/miniserv/server/Server.java b/src/main/java/net/montoyo/wd/miniserv/server/Server.java index 52f5ad5..e9f0698 100644 --- a/src/main/java/net/montoyo/wd/miniserv/server/Server.java +++ b/src/main/java/net/montoyo/wd/miniserv/server/Server.java @@ -236,7 +236,7 @@ public class Server implements Runnable { } public long getMaxQuota() { - return new WebDisplays().miniservQuota; + return WebDisplays.INSTANCE.miniservQuota; } } diff --git a/src/main/resources/assets/webdisplays/blockstates/rctrl.json b/src/main/resources/assets/webdisplays/blockstates/rctrl.json index b5de174..06ea585 100644 --- a/src/main/resources/assets/webdisplays/blockstates/rctrl.json +++ b/src/main/resources/assets/webdisplays/blockstates/rctrl.json @@ -2,9 +2,9 @@ "forge_marker": 1, "uvlock": false, "variants": { - "facing=north,type=default_peripheral_remotectrl": { "model": "webdisplays:block/rctrl" }, - "facing=east,type=default_peripheral_remotectrl": { "model": "webdisplays:block/rctrl" }, - "facing=south,type=default_peripheral_remotectrl": { "model": "webdisplays:block/rctrl" }, - "facing=west,type=default_peripheral_remotectrl": { "model": "webdisplays:block/rctrl" } + "facing=north": { "model": "webdisplays:block/rctrl" }, + "facing=east": { "model": "webdisplays:block/rctrl" }, + "facing=south": { "model": "webdisplays:block/rctrl" }, + "facing=west": { "model": "webdisplays:block/rctrl" } } } diff --git a/src/main/resources/assets/webdisplays/blockstates/redctrl.json b/src/main/resources/assets/webdisplays/blockstates/redctrl.json index 0d55475..8dc09aa 100644 --- a/src/main/resources/assets/webdisplays/blockstates/redctrl.json +++ b/src/main/resources/assets/webdisplays/blockstates/redctrl.json @@ -2,9 +2,9 @@ "forge_marker": 1, "uvlock": false, "variants": { - "facing=north,type=default_peripheral_redstonectrl": { "model": "webdisplays:block/redctrl" }, - "facing=east,type=default_peripheral_redstonectrl": { "model": "webdisplays:block/redctrl" }, - "facing=south,type=default_peripheral_redstonectrl": { "model": "webdisplays:block/redctrl" }, - "facing=west,type=default_peripheral_redstonectrl": { "model": "webdisplays:block/redctrl" } + "facing=north": { "model": "webdisplays:block/redctrl" }, + "facing=east": { "model": "webdisplays:block/redctrl" }, + "facing=south": { "model": "webdisplays:block/redctrl" }, + "facing=west": { "model": "webdisplays:block/redctrl" } } } diff --git a/src/main/resources/assets/webdisplays/blockstates/server.json b/src/main/resources/assets/webdisplays/blockstates/server.json index e6d9dae..8a5bf8a 100644 --- a/src/main/resources/assets/webdisplays/blockstates/server.json +++ b/src/main/resources/assets/webdisplays/blockstates/server.json @@ -2,9 +2,9 @@ "forge_marker": 1, "uvlock": false, "variants": { - "facing=north,type=default_peripheral_server": { "model": "webdisplays:block/server" }, - "facing=east,type=default_peripheral_server": { "model": "webdisplays:block/server" }, - "facing=south,type=default_peripheral_server": { "model": "webdisplays:block/server" }, - "facing=west,type=default_peripheral_server": { "model": "webdisplays:block/server" } + "facing=north": { "model": "webdisplays:block/server" }, + "facing=east": { "model": "webdisplays:block/server" }, + "facing=south": { "model": "webdisplays:block/server" }, + "facing=west": { "model": "webdisplays:block/server" } } } diff --git a/src/main/resources/assets/webdisplays/lang/en_us.json b/src/main/resources/assets/webdisplays/lang/en_us.json new file mode 100644 index 0000000..fd242ce --- /dev/null +++ b/src/main/resources/assets/webdisplays/lang/en_us.json @@ -0,0 +1,157 @@ +{ + "itemGroup.webdisplays": "§5Web Displays", + "tile.webdisplays.screen.name": "Web Screen", + "tile.webdisplays.peripheral.name": "Peripheral", + "tile.webdisplays.peripheral.keyboard.name": "Keyboard", + "tile.webdisplays.peripheral.remotectrl.name": "Remote Controller", + "tile.webdisplays.peripheral.ccinterface.name": "ComputerCraft Interface", + "tile.webdisplays.peripheral.cointerface.name": "OpenComputers Interface", + "tile.webdisplays.peripheral.redstonectrl.name": "Redstone Controller", + "tile.webdisplays.peripheral.server.name": "Server", + "item.webdisplays.screencfg.name": "Screen Configurator", + "item.webdisplays.ownerthief.name": "Ownership Thief [ADMIN]", + "item.webdisplays.linker.name": "Linking Tool", + "item.webdisplays.craftcomp.name": "Craft Component", + "item.webdisplays.craftcomp.stonekey.name": "Stone Key", + "item.webdisplays.craftcomp.upgrade.name": "Blank Upgrade", + "item.webdisplays.craftcomp.peripheral.name": "Peripheral Base", + "item.webdisplays.craftcomp.batcell.name": "Battery Cell", + "item.webdisplays.craftcomp.batpack.name": "Battery Pack", + "item.webdisplays.craftcomp.laserdiode.name": "650nm Laser Diode", + "item.webdisplays.craftcomp.backlight.name": "Backlight", + "item.webdisplays.craftcomp.extcard.name": "Extension Card", + "item.webdisplays.craftcomp.badextcard.name": "Bad Extension Card", + "item.webdisplays.minepad.name": "minePad", + "item.webdisplays.minepad2.name": "minePad 2", + "item.webdisplays.upgrade.name": "Screen Upgrade", + "item.webdisplays.upgrade.lasermouse.name": "Laser Sensor", + "item.webdisplays.upgrade.redinput.name": "Redstone Input Port", + "item.webdisplays.upgrade.redoutput.name": "Redstone Output Port", + "item.webdisplays.upgrade.gps.name": "GPS Module", + "item.webdisplays.laserpointer.name": "Laser Pointer", + "item.webdisplays.advicon.name": "Advancement Icon", + "item.webdisplays.advicon.wd.name": "WebDisplays", + "item.webdisplays.advicon.brokenpad.name": "Broken minePad", + "item.webdisplays.advicon.pigeon.name": "Pigeon", + "item.webdisplays.wiki": "Hit 'F1' to open the Wiki", + "webdisplays.message.tooSmall": "Too small! Minimum size is 2x2.", + "webdisplays.message.tooBig": "Too big! Maximum size is %dx%d.", + "webdisplays.message.invalid": "Structure is invalid; look at %s.", + "webdisplays.message.turnOn": "You need to turn the screen on first!", + "webdisplays.message.screenSet": "Screen set! Now give the item to the new ow,ner...", + "webdisplays.message.newOwner": "You are now the owner of this screen!", + "webdisplays.message.restrictions": "You are not allowed to do this :(", + "webdisplays.message.peripheral": "This is not a peripheral!", + "webdisplays.message.linked": "Linked!", + "webdisplays.message.linkError": "Link error :( Check logs...", + "webdisplays.message.notAScreen": "Please right click on the screen first...", + "webdisplays.message.screenSet2": "Screen set! Now right click on the periphe,ral...", + "webdisplays.message.chunkUnloaded": "The chunk the screen is placed in is no,t loaded!", + "webdisplays.message.notLinked": "This peripheral has not been linked yet.", + "webdisplays.message.missingCC": "ComputerCraft is not available.", + "webdisplays.message.missingOC": "OpenComputers is not available.", + "webdisplays.message.upgradeError": "Upgrade error :( Check logs...", + "webdisplays.message.upgradeOk": "Upgrade installed!", + "webdisplays.message.linkAbort": "Linker reset", + "webdisplays.message.noMiniserv": "Server block is disabled on this server", + "webdisplays.message.otDisabled": "Ownership thief is disabled on this server", + "webdisplays.message.welcome1": "Thank you for installing WebDisplays! If you", + "webdisplays.message.welcome2": "need help, hover any WD item with your mouse", + "webdisplays.message.welcome3": "and hit F1. Have fun with the mod, - montoyo", + "webdisplays.gui.screencfg.owner": "Screen owner:", + "webdisplays.gui.screencfg.friends": "Friends:", + "webdisplays.gui.screencfg.permissions": "Permissions:", + "webdisplays.gui.screencfg.seturl": "Change URL", + "webdisplays.gui.screencfg.click": "Click & type", + "webdisplays.gui.screencfg.friendlist": "Manage friends", + "webdisplays.gui.screencfg.otherrights": "Manage others", + "webdisplays.gui.screencfg.mupgrades": "Upgrade & link", + "webdisplays.gui.screencfg.mres": "Change resolution", + "webdisplays.gui.screencfg.others": "Others", + "webdisplays.gui.screencfg.upgrades": "Upgrades:", + "webdisplays.gui.screencfg.resolution": "Resolution : ", + "webdisplays.gui.screencfg.setres": "Set Resolution", + "webdisplays.gui.screencfg.rotation": "Rotation", + "webdisplays.gui.screencfg.rot0": "0°", + "webdisplays.gui.screencfg.rot90": "90°", + "webdisplays.gui.screencfg.rot180": "180°", + "webdisplays.gui.screencfg.rot270": "270°", + "webdisplays.gui.screencfg.lockratio": "Lock ratio", + "webdisplays.gui.screencfg.autovol": "Auto Volume", + "webdisplays.gui.screencfg.avwarning": "§cCareful!\nAuto volume only works on YouTube\nvideos, and if enabled in client config!", + "webdisplays.linker.selectScreen": "Right click on a screen", + "webdisplays.linker.selectPeripheral": "Right click on a peripheral", + "webdisplays.linker.posInfo": "Screen pos: %d %d %d", + "webdisplays.linker.sideInfo": "Side: %s", + "webdisplays.gui.seturl.url": "URL: ", + "webdisplays.gui.seturl.ok": "OK", + "webdisplays.gui.seturl.cancel": "Cancel", + "webdisplays.gui.seturl.shutdown": "Shut down", + "webdisplays.minepad.turnon": "Sneak and right-click to turn on", + "webdisplays.minepad2.info": "NO REFUNDS!", + "webdisplays.extcard.cantcraft1": "You don't know enough yet.", + "webdisplays.extcard.cantcraft2": "You WILL FAIL at crafting this item.", + "webdisplays.extcard.bad": "Someone failed at crafting an extension card", + "webdisplays.gui.keyboard.hooked": "Keyboard hooked. Press escape to leave.", + "webdisplays.gui.keyboard.warning1": "WARNING! Typed data are sent in PLAIN T,EXT to the server.", + "webdisplays.gui.keyboard.warning2": "This means anyone can know what you're ,up to.", + "webdisplays.gui.keyboard.warning3": "NEVER write one of your passwords using, this keyboard.", + "webdisplays.gui.keyboard.gotcha": "Got ya", + "advancements.webdisplays.root.title": "WebDisplays", + "advancements.webdisplays.root.description": "The WebDisplays mod", + "advancements.webdisplays.screen.title": "The internet is for...", + "advancements.webdisplays.screen.description": "Craft your first web display", + "advancements.webdisplays.minepad.title": "This is a revolution", + "advancements.webdisplays.minepad.description": "Get your hands on the newest technology: the minePad", + "advancements.webdisplays.padbreak.title": "Reverse Engineering", + "advancements.webdisplays.padbreak.description": "These things are fragile! Don't drop a minePad from high place to unlock the upgrade recipes", + "advancements.webdisplays.minepad2.title": "Pigeon", + "advancements.webdisplays.minepad2.description": "Craft a minePad 2. Look, I know it's expensive, but that means it's better than anything else, right? ...right?", + "advancements.webdisplays.linkperipheral.title": "It's wireless!", + "advancements.webdisplays.linkperipheral.description": "Link a peripheral to ,a screen", + "advancements.webdisplays.keyboardcat.title": "DAMN CATS", + "advancements.webdisplays.keyboardcat.description": "Have an ocelot walk on y,our keyboard", + "advancements.webdisplays.upgrade.title": "More than a screen", + "advancements.webdisplays.upgrade.description": "Install your first upgrade", + "advancements.webdisplays.laser.title": "Don't aim the eyes", + "advancements.webdisplays.laser.description": "Craft a laser pointer!", + "webdisplays.side.bottom": "Bottom", + "webdisplays.side.top": "Top", + "webdisplays.side.north": "North", + "webdisplays.side.south": "South", + "webdisplays.side.west": "West", + "webdisplays.side.east": "East", + "webdisplays.server.info": "Type 'help' if you need some.", + "webdisplays.server.unknowncmd": "Unknown command.", + "webdisplays.server.error": "Internal error. Check logs.", + "webdisplays.server.error2": "Internal error %d. Check logs.", + "webdisplays.server.argerror": "Unrecognized argument.", + "webdisplays.server.queryerr": "Query error, try 'reconnect'.", + "webdisplays.server.errowner": "Only the owner can access this.", + "webdisplays.server.timeout": "Query timed out. Check logs.", + "webdisplays.server.ownername": "Owner name: %s", + "webdisplays.server.owneruuid": "Owner UUID", + "webdisplays.server.quota": "%s/%s used", + "webdisplays.server.fnamearg": "Missing file name argument", + "webdisplays.server.nameerr": "Invalid file name", + "webdisplays.server.urlcopied": "Copied URL to clipboard.", + "webdisplays.server.notfound": "File not found", + "webdisplays.server.upload.info": "Choose a file to upload", + "webdisplays.server.upload.parent": "[Parent directory]", + "webdisplays.server.upload.uploading": "Uploading...", + "webdisplays.server.upload.done": "Done", + "webdisplays.server.upload.exists": "Error: File exists", + "webdisplays.server.upload.quota": "Error: File size exceeds quota", + "webdisplays.server.help.help": "Displays this text", + "webdisplays.server.help.clear": "Clears the screen", + "webdisplays.server.help.exit": "Leaves this console", + "webdisplays.server.help.access": "§kNo help data", + "webdisplays.server.help.owner": "Displays the server owner", + "webdisplays.server.help.quota": "Displays the storage quota", + "webdisplays.server.help.ls": "Lists the files on this server", + "webdisplays.server.help.url": "Copies a file URL into your clipboard", + "webdisplays.server.help.upload": "Opens the upload wizard", + "webdisplays.server.help.rm": "Deletes a file", + "webdisplays.server.help.reconnect": "Reconnect to miniserv [DEBUG]" +} + diff --git a/src/main/resources/assets/webdisplays/lang/en_us.lang b/src/main/resources/assets/webdisplays/lang/en_us.lang deleted file mode 100644 index 6322965..0000000 --- a/src/main/resources/assets/webdisplays/lang/en_us.lang +++ /dev/null @@ -1,154 +0,0 @@ -itemGroup.webdisplays=§5Web Displays -tile.webdisplays.screen.name=Web Screen -tile.webdisplays.peripheral.name=Peripheral -tile.webdisplays.peripheral.keyboard.name=Keyboard -tile.webdisplays.peripheral.remotectrl.name=Remote Controller -tile.webdisplays.peripheral.ccinterface.name=ComputerCraft Interface -tile.webdisplays.peripheral.cointerface.name=OpenComputers Interface -tile.webdisplays.peripheral.redstonectrl.name=Redstone Controller -tile.webdisplays.peripheral.server.name=Server -item.webdisplays.screencfg.name=Screen Configurator -item.webdisplays.ownerthief.name=Ownership Thief [ADMIN] -item.webdisplays.linker.name=Linking Tool -item.webdisplays.craftcomp.name=Craft Component -item.webdisplays.craftcomp.stonekey.name=Stone Key -item.webdisplays.craftcomp.upgrade.name=Blank Upgrade -item.webdisplays.craftcomp.peripheral.name=Peripheral Base -item.webdisplays.craftcomp.batcell.name=Battery Cell -item.webdisplays.craftcomp.batpack.name=Battery Pack -item.webdisplays.craftcomp.laserdiode.name=650nm Laser Diode -item.webdisplays.craftcomp.backlight.name=Backlight -item.webdisplays.craftcomp.extcard.name=Extension Card -item.webdisplays.craftcomp.badextcard.name=Bad Extension Card -item.webdisplays.minepad.name=minePad -item.webdisplays.minepad2.name=minePad 2 -item.webdisplays.upgrade.name=Screen Upgrade -item.webdisplays.upgrade.lasermouse.name=Laser Sensor -item.webdisplays.upgrade.redinput.name=Redstone Input Port -item.webdisplays.upgrade.redoutput.name=Redstone Output Port -item.webdisplays.upgrade.gps.name=GPS Module -item.webdisplays.laserpointer.name=Laser Pointer -item.webdisplays.advicon.name=Advancement Icon -item.webdisplays.advicon.wd.name=WebDisplays -item.webdisplays.advicon.brokenpad.name=Broken minePad -item.webdisplays.advicon.pigeon.name=Pigeon -item.webdisplays.wiki=Hit "F1" to open the Wiki -webdisplays.message.tooSmall=Too small! Minimum size is 2x2. -webdisplays.message.tooBig=Too big! Maximum size is %dx%d. -webdisplays.message.invalid=Structure is invalid; look at %s. -webdisplays.message.turnOn=You need to turn the screen on first! -webdisplays.message.screenSet=Screen set! Now give the item to the new owner... -webdisplays.message.newOwner=You are now the owner of this screen! -webdisplays.message.restrictions=You are not allowed to do this :( -webdisplays.message.peripheral=This is not a peripheral! -webdisplays.message.linked=Linked! -webdisplays.message.linkError=Link error :( Check logs... -webdisplays.message.notAScreen=Please right click on the screen first... -webdisplays.message.screenSet2=Screen set! Now right click on the peripheral... -webdisplays.message.chunkUnloaded=The chunk the screen is placed in is not loaded! -webdisplays.message.notLinked=This peripheral has not been linked yet. -webdisplays.message.missingCC=ComputerCraft is not available. -webdisplays.message.missingOC=OpenComputers is not available. -webdisplays.message.upgradeError=Upgrade error :( Check logs... -webdisplays.message.upgradeOk=Upgrade installed! -webdisplays.message.linkAbort=Linker reset -webdisplays.message.noMiniserv=Server block is disabled on this server -webdisplays.message.otDisabled=Ownership thief is disabled on this server -webdisplays.message.welcome1=Thank you for installing WebDisplays! If you -webdisplays.message.welcome2=need help, hover any WD item with your mouse -webdisplays.message.welcome3=and hit F1. Have fun with the mod, - montoyo -webdisplays.gui.screencfg.owner=Screen owner: -webdisplays.gui.screencfg.friends=Friends: -webdisplays.gui.screencfg.permissions=Permissions: -webdisplays.gui.screencfg.seturl=Change URL -webdisplays.gui.screencfg.click=Click & type -webdisplays.gui.screencfg.friendlist=Manage friends -webdisplays.gui.screencfg.otherrights=Manage others -webdisplays.gui.screencfg.mupgrades=Upgrade & link -webdisplays.gui.screencfg.mres=Change resolution -webdisplays.gui.screencfg.others=Others -webdisplays.gui.screencfg.upgrades=Upgrades: -webdisplays.gui.screencfg.resolution=Resolution: -webdisplays.gui.screencfg.setres=Set Resolution -webdisplays.gui.screencfg.rotation=Rotation -webdisplays.gui.screencfg.rot0=0° -webdisplays.gui.screencfg.rot90=90° -webdisplays.gui.screencfg.rot180=180° -webdisplays.gui.screencfg.rot270=270° -webdisplays.gui.screencfg.lockratio=Lock ratio -webdisplays.gui.screencfg.autovol=Auto Volume -webdisplays.gui.screencfg.avwarning=§cCareful!\nAuto volume only works on YouTube\nvideos, and if enabled in client config! -webdisplays.linker.selectScreen=Right click on a screen -webdisplays.linker.selectPeripheral=Right click on a peripheral -webdisplays.linker.posInfo=Screen pos: %d %d %d -webdisplays.linker.sideInfo=Side: %s -webdisplays.gui.seturl.url=URL: -webdisplays.gui.seturl.ok=OK -webdisplays.gui.seturl.cancel=Cancel -webdisplays.gui.seturl.shutdown=Shut down -webdisplays.minepad.turnon=Sneak and right-click to turn on -webdisplays.minepad2.info=NO REFUNDS! -webdisplays.extcard.cantcraft1=You don't know enough yet. -webdisplays.extcard.cantcraft2=You WILL FAIL at crafting this item. -webdisplays.extcard.bad=Someone failed at crafting an extension card -webdisplays.gui.keyboard.hooked=Keyboard hooked. Press escape to leave. -webdisplays.gui.keyboard.warning1=WARNING! Typed data are sent in PLAIN TEXT to the server. -webdisplays.gui.keyboard.warning2=This means anyone can know what you're up to. -webdisplays.gui.keyboard.warning3=NEVER write one of your passwords using this keyboard. -webdisplays.gui.keyboard.gotcha=Got ya -advancements.webdisplays.root.title=WebDisplays -advancements.webdisplays.root.description=The WebDisplays mod -advancements.webdisplays.screen.title=The internet is for... -advancements.webdisplays.screen.description=Craft your first web display -advancements.webdisplays.minepad.title=This is a revolution -advancements.webdisplays.minepad.description=Get your hands on the newest technology: the minePad -advancements.webdisplays.padbreak.title=Reverse Engineering -advancements.webdisplays.padbreak.description=These things are fragile! Don't drop a minePad from high place to unlock the upgrade recipes -advancements.webdisplays.minepad2.title=Pigeon -advancements.webdisplays.minepad2.description=Craft a minePad 2. Look, I know it's expensive, but that means it's better than anything else, right? ...right? -advancements.webdisplays.linkperipheral.title=It's wireless! -advancements.webdisplays.linkperipheral.description=Link a peripheral to a screen -advancements.webdisplays.keyboardcat.title=DAMN CATS -advancements.webdisplays.keyboardcat.description=Have an ocelot walk on your keyboard -advancements.webdisplays.upgrade.title=More than a screen -advancements.webdisplays.upgrade.description=Install your first upgrade -advancements.webdisplays.laser.title=Don't aim the eyes -advancements.webdisplays.laser.description=Craft a laser pointer! -webdisplays.side.bottom=Bottom -webdisplays.side.top=Top -webdisplays.side.north=North -webdisplays.side.south=South -webdisplays.side.west=West -webdisplays.side.east=East -webdisplays.server.info=Type "help" if you need some. -webdisplays.server.unknowncmd=Unknown command. -webdisplays.server.error=Internal error. Check logs. -webdisplays.server.error2=Internal error %d. Check logs. -webdisplays.server.argerror=Unrecognized argument. -webdisplays.server.queryerr=Query error, try "reconnect". -webdisplays.server.errowner=Only the owner can access this. -webdisplays.server.timeout=Query timed out. Check logs. -webdisplays.server.ownername=Owner name: %s -webdisplays.server.owneruuid=Owner UUID: -webdisplays.server.quota=%s/%s used -webdisplays.server.fnamearg=Missing file name argument -webdisplays.server.nameerr=Invalid file name -webdisplays.server.urlcopied=Copied URL to clipboard. -webdisplays.server.notfound=File not found -webdisplays.server.upload.info=Choose a file to upload -webdisplays.server.upload.parent=[Parent directory] -webdisplays.server.upload.uploading=Uploading... -webdisplays.server.upload.done=Done -webdisplays.server.upload.exists=Error: File exists -webdisplays.server.upload.quota=Error: File size exceeds quota -webdisplays.server.help.help=Displays this text -webdisplays.server.help.clear=Clears the screen -webdisplays.server.help.exit=Leaves this console -webdisplays.server.help.access=§kNo help data -webdisplays.server.help.owner=Displays the server owner -webdisplays.server.help.quota=Displays the storage quota -webdisplays.server.help.ls=Lists the files on this server -webdisplays.server.help.url=Copies a file URL into your clipboard -webdisplays.server.help.upload=Opens the upload wizard -webdisplays.server.help.rm=Deletes a file -webdisplays.server.help.reconnect=Reconnect to miniserv [DEBUG]