more stuff
This commit is contained in:
parent
a8c296940e
commit
e856c1fb2a
|
|
@ -38,7 +38,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.network.NetworkRegistry;
|
||||
import net.montoyo.wd.block.BlockKeyboardRight;
|
||||
import net.montoyo.wd.block.BlockPeripheral;
|
||||
import net.montoyo.wd.block.BlockScreen;
|
||||
|
|
@ -48,7 +47,6 @@ import net.montoyo.wd.core.*;
|
|||
import net.montoyo.wd.entity.TileEntityScreen;
|
||||
import net.montoyo.wd.item.*;
|
||||
import net.montoyo.wd.miniserv.server.Server;
|
||||
import net.montoyo.wd.net.Messages;
|
||||
import net.montoyo.wd.net.client.CMessageServerInfo;
|
||||
import net.montoyo.wd.utilities.Log;
|
||||
import net.montoyo.wd.utilities.Util;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import net.minecraft.block.properties.PropertyEnum;
|
|||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
|
@ -31,7 +32,10 @@ import net.minecraft.world.Explosion;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.network.NetworkDirection;
|
||||
import net.minecraftforge.network.NetworkRegistry;
|
||||
import net.montoyo.wd.WebDisplays;
|
||||
import net.montoyo.wd.core.DefaultPeripheral;
|
||||
import net.montoyo.wd.entity.*;
|
||||
|
|
@ -275,8 +279,8 @@ public class BlockPeripheral extends WDBlockContainer {
|
|||
}
|
||||
}
|
||||
|
||||
private static NetworkRegistry.TargetPoint point(World world, BlockPos bp) {
|
||||
return new NetworkRegistry.TargetPoint(world.provider.getDimension(), (double) bp.getX(), (double) bp.getY(), (double) bp.getZ(), 64.0);
|
||||
private static NetworkDirection point(Level world, BlockPos bp) {
|
||||
return new NetworkDirection (world.dimension().location(), (double) bp.getX(), (double) bp.getY(), (double) bp.getZ(), 64.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.material.EnumPushReaction;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
|
@ -23,7 +22,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
|
@ -36,8 +34,8 @@ import net.minecraftforge.common.property.IUnlistedProperty;
|
|||
import net.minecraftforge.common.property.Properties;
|
||||
import net.montoyo.wd.WebDisplays;
|
||||
import net.montoyo.wd.core.DefaultUpgrade;
|
||||
import net.montoyo.wd.core.ScreenRights;
|
||||
import net.montoyo.wd.core.IUpgrade;
|
||||
import net.montoyo.wd.core.ScreenRights;
|
||||
import net.montoyo.wd.data.SetURLData;
|
||||
import net.montoyo.wd.entity.TileEntityScreen;
|
||||
import net.montoyo.wd.item.ItemPeripheral;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import net.minecraft.client.multiplayer.ClientAdvancements;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.packs.resources.ReloadableResourceManager;
|
||||
|
|
@ -32,7 +33,6 @@ import net.minecraft.world.level.Level;
|
|||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.client.ClientRegistry;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
|
@ -48,7 +48,6 @@ import net.montoyo.wd.client.gui.loading.GuiLoader;
|
|||
import net.montoyo.wd.client.renderers.IItemRenderer;
|
||||
import net.montoyo.wd.client.renderers.LaserPointerRenderer;
|
||||
import net.montoyo.wd.client.renderers.MinePadRenderer;
|
||||
import net.montoyo.wd.client.renderers.ScreenRenderer;
|
||||
import net.montoyo.wd.core.DefaultUpgrade;
|
||||
import net.montoyo.wd.core.HasAdvancement;
|
||||
import net.montoyo.wd.core.JSServerRequest;
|
||||
|
|
@ -133,7 +132,7 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer
|
|||
|
||||
@Override
|
||||
public void init() {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityScreen.class, new ScreenRenderer());
|
||||
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntityScreen.class, new ScreenRenderer());
|
||||
jsDispatcher = new JSQueryDispatcher(this);
|
||||
minePadRenderer = new MinePadRenderer();
|
||||
laserPointerRenderer = new LaserPointerRenderer();
|
||||
|
|
@ -152,15 +151,17 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer
|
|||
}
|
||||
|
||||
@Override
|
||||
public Level getWorld(ResourceLocation dim) {
|
||||
public Level getWorld(ResourceKey<Level> dim) {
|
||||
Level ret = mc.level;
|
||||
// if(dim == CURRENT_DIMENSION)
|
||||
// return ret;
|
||||
|
||||
if(!ret.dimension().location().equals(dim))
|
||||
throw new RuntimeException("Can't get non-current dimension " + dim + " from client.");
|
||||
|
||||
return ret;
|
||||
if(ret != null) {
|
||||
if (!ret.dimension().equals(dim))
|
||||
throw new RuntimeException("Can't get non-current dimension " + dim + " from client.");
|
||||
return ret;
|
||||
} else {
|
||||
throw new RuntimeException("Level on client is null");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -4,29 +4,29 @@
|
|||
|
||||
package net.montoyo.wd.client.gui;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.montoyo.wd.WebDisplays;
|
||||
import net.montoyo.wd.client.gui.controls.Button;
|
||||
import net.montoyo.wd.client.gui.controls.Control;
|
||||
import net.montoyo.wd.client.gui.controls.Label;
|
||||
import net.montoyo.wd.client.gui.loading.FillControl;
|
||||
import net.montoyo.wd.entity.TileEntityScreen;
|
||||
import net.montoyo.wd.net.Messages;
|
||||
import net.montoyo.wd.net.server.SMessageScreenCtrl;
|
||||
import net.montoyo.wd.utilities.BlockSide;
|
||||
import net.montoyo.wd.utilities.Log;
|
||||
import net.montoyo.wd.utilities.TypeData;
|
||||
import net.montoyo.wd.utilities.Util;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.system.CallbackI;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GuiKeyboard extends WDScreen {
|
||||
|
||||
private static final String WARNING_FNAME = "wd_keyboard_warning.txt";
|
||||
|
|
@ -58,10 +58,10 @@ public class GuiKeyboard extends WDScreen {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
public void init() {
|
||||
super.init();
|
||||
|
||||
if(mc.isIntegratedServerRunning() && mc.getIntegratedServer() != null && !mc.getIntegratedServer().getPublic())
|
||||
if(minecraft.getSingleplayerServer() != null && !minecraft.getSingleplayerServer().isPublished())
|
||||
showWarning = false; //NO NEED
|
||||
else
|
||||
showWarning = !hasUserReadWarning();
|
||||
|
|
@ -94,8 +94,8 @@ public class GuiKeyboard extends WDScreen {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
mc.inGameHasFocus = true;
|
||||
mc.mouseHelper.grabMouseCursor();
|
||||
minecraft.setWindowActive(true);
|
||||
minecraft.mouseHandler.grabMouse();
|
||||
}
|
||||
|
||||
defaultBackground = showWarning;
|
||||
|
|
@ -103,10 +103,10 @@ public class GuiKeyboard extends WDScreen {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleInput() {
|
||||
public void handleKeyboardInput() throws IOException {
|
||||
if(showWarning) {
|
||||
try {
|
||||
super.handleInput();
|
||||
super.handleKeyboardInput();
|
||||
} catch(IOException ex) {
|
||||
Log.warningEx("Caught exception while handling screen input", ex);
|
||||
}
|
||||
|
|
@ -141,7 +141,7 @@ public class GuiKeyboard extends WDScreen {
|
|||
@Override
|
||||
protected void sync() {
|
||||
if(!evStack.isEmpty()) {
|
||||
WebDisplays.NET_HANDLER.sendToServer(SMessageScreenCtrl.type(tes, side, WebDisplays.GSON.toJson(evStack), kbPos));
|
||||
Messages.INSTANCE.sendToServer(SMessageScreenCtrl.type(tes, side, WebDisplays.GSON.toJson(evStack), kbPos));
|
||||
evStack.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
package net.montoyo.wd.client.gui;
|
||||
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
|
|
@ -45,10 +46,10 @@ public class GuiMinePad extends WDScreen {
|
|||
}
|
||||
|
||||
private static void addRect(BufferBuilder bb, double x, double y, double w, double h) {
|
||||
bb.pos(x, y, 0.0).endVertex();
|
||||
bb.pos(x + w, y, 0.0).endVertex();
|
||||
bb.pos(x + w, y + h, 0.0).endVertex();
|
||||
bb.pos(x, y + h, 0.0).endVertex();
|
||||
bb.vertex(x, y, 0.0).endVertex();
|
||||
bb.vertex(x + w, y, 0.0).endVertex();
|
||||
bb.vertex(x + w, y + h, 0.0).endVertex();
|
||||
bb.vertex(x, y + h, 0.0).endVertex();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ import java.util.Collections;
|
|||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static net.montoyo.wd.block.BlockPeripheral.point;
|
||||
|
||||
public class TileEntityScreen extends BlockEntity{
|
||||
|
||||
public TileEntityScreen(BlockEntityType<?> arg, BlockPos arg2, BlockState arg3) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user