commit
2aa3b3f456
|
|
@ -1,12 +1,9 @@
|
||||||
# WebDisplays for Minecraft 1.12.2
|
# WebDisplays for Minecraft 1.19.2
|
||||||
This is the WebDisplays mod for Minecraft 1.12.2. I don't have time to maintain it anymore, so I changed the license recently and anybody is welcome to create forks and/or re-distribute it. For more info see [LICENSE](LICENSE).
|
This is a fork of the Web Displays mod from 1.12, updated to work on 1.19, and with some bug fixes and reworking.
|
||||||
|
|
||||||
### Wiki
|
### Wiki
|
||||||
* The Wiki that details all blocks/items can be found on my website https://montoyo.net/wdwiki/
|
* The Wiki that details all blocks/items can be found on my website https://montoyo.net/wdwiki/
|
||||||
|
|
||||||
### Things before release
|
|
||||||
* Release ready. Targeted release date: 17/02/2018.
|
|
||||||
|
|
||||||
### Delayed things
|
### Delayed things
|
||||||
* Plugin API
|
* Plugin API
|
||||||
* The Shop
|
* The Shop
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ dependencies {
|
||||||
minecraft 'net.minecraftforge:forge:1.19.2-43.2.6'
|
minecraft 'net.minecraftforge:forge:1.19.2-43.2.6'
|
||||||
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
|
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
|
||||||
|
|
||||||
implementation fg.deobf("com.github.Mysticpasta1:mcef-forge:d45957d9f6")
|
implementation fg.deobf("com.github.Mysticpasta1:mcef-forge:cb00f566f1")
|
||||||
implementation fg.deobf("curse.maven:cloth_config_forge-348521:3972423")
|
implementation fg.deobf("curse.maven:cloth_config_forge-348521:3972423")
|
||||||
implementation fg.deobf("curse.maven:SU-370704:4410614")
|
implementation fg.deobf("curse.maven:SU-370704:4410614")
|
||||||
implementation fg.deobf("curse.maven:spark-361579:4381167")
|
implementation fg.deobf("curse.maven:spark-361579:4381167")
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,10 @@ import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.network.NetworkEvent;
|
import net.minecraftforge.network.NetworkEvent;
|
||||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||||
|
import net.montoyo.mcef.api.CefInitEvent;
|
||||||
import net.montoyo.wd.core.HasAdvancement;
|
import net.montoyo.wd.core.HasAdvancement;
|
||||||
import net.montoyo.wd.core.JSServerRequest;
|
import net.montoyo.wd.core.JSServerRequest;
|
||||||
import net.montoyo.wd.data.GuiData;
|
import net.montoyo.wd.data.GuiData;
|
||||||
|
|
@ -27,11 +29,15 @@ public class SharedProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
|
MinecraftForge.EVENT_BUS.addListener(this::onCefInit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postInit() {
|
public void postInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onCefInit(CefInitEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated(forRemoval = true)
|
@Deprecated(forRemoval = true)
|
||||||
public Level getWorld(ResourceKey<Level> dim) {
|
public Level getWorld(ResourceKey<Level> dim) {
|
||||||
return getServer().getLevel(dim);
|
return getServer().getLevel(dim);
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ public class BlockScreen extends BaseEntityBlock {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Vector2i size = Multiblock.measure(world, pos, side);
|
Vector2i size = Multiblock.measure(world, pos, side);
|
||||||
if (size.x < 2 || size.y < 2) {
|
if (size.x < 2 && size.y < 2) {
|
||||||
Util.toast(player, "tooSmall");
|
Util.toast(player, "tooSmall");
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
package net.montoyo.wd.block.item;
|
package net.montoyo.wd.block.item;
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.montoyo.wd.block.BlockKeyboardLeft;
|
import net.montoyo.wd.block.BlockKeyboardLeft;
|
||||||
|
|
@ -20,7 +22,7 @@ public class KeyboardItem extends BlockItem {
|
||||||
|
|
||||||
Direction d = BlockKeyboardLeft.mapDirection(facing);
|
Direction d = BlockKeyboardLeft.mapDirection(facing);
|
||||||
|
|
||||||
if (isValid(arg, arg2, d)) {
|
if (isValid(arg.getClickedPos(), arg.getLevel(), arg2, d)) {
|
||||||
Block kbRight = BlockInit.blockKbRight.get();
|
Block kbRight = BlockInit.blockKbRight.get();
|
||||||
BlockState rightState = kbRight.defaultBlockState();
|
BlockState rightState = kbRight.defaultBlockState();
|
||||||
|
|
||||||
|
|
@ -31,11 +33,22 @@ public class KeyboardItem extends BlockItem {
|
||||||
11
|
11
|
||||||
)) return false;
|
)) return false;
|
||||||
return arg.getLevel().setBlock(arg.getClickedPos(), arg2, 11);// 161
|
return arg.getLevel().setBlock(arg.getClickedPos(), arg2, 11);// 161
|
||||||
|
} else if (isValid(arg.getClickedPos().relative(d.getOpposite(), 2), arg.getLevel(), arg2, d)) {
|
||||||
|
Block kbRight = BlockInit.blockKbRight.get();
|
||||||
|
BlockState rightState = kbRight.defaultBlockState();
|
||||||
|
|
||||||
|
rightState = rightState.setValue(BlockKeyboardLeft.FACING, facing);
|
||||||
|
if (!arg.getLevel().setBlock(
|
||||||
|
arg.getClickedPos(),
|
||||||
|
rightState,
|
||||||
|
11
|
||||||
|
)) return false;
|
||||||
|
return arg.getLevel().setBlock(arg.getClickedPos().relative(d.getOpposite()), arg2, 11);// 161
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isValid(BlockPlaceContext context, BlockState state, Direction d) {
|
private boolean isValid(BlockPos pos, Level level, BlockState state, Direction d) {
|
||||||
return context.getLevel().getBlockState(context.getClickedPos().relative(d)).isAir();
|
return level.getBlockState(pos.relative(d)).isAir();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -153,15 +153,22 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preInit() {
|
public void preInit() {
|
||||||
|
super.preInit();
|
||||||
mc = Minecraft.getInstance();
|
mc = Minecraft.getInstance();
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
|
||||||
mcef = MCEFApi.getAPI();
|
|
||||||
if(mcef != null)
|
|
||||||
mcef.registerScheme("wd", WDScheme.class, true, false, false, true, true, false, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
|
super.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCefInit(CefInitEvent event) {
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
mcef = event.getApi();
|
||||||
|
if(mcef != null)
|
||||||
|
mcef.registerScheme("wd", WDScheme.class, true, false, false, true, true, false, false);
|
||||||
|
|
||||||
jsDispatcher = new JSQueryDispatcher(this);
|
jsDispatcher = new JSQueryDispatcher(this);
|
||||||
minePadRenderer = new MinePadRenderer();
|
minePadRenderer = new MinePadRenderer();
|
||||||
laserPointerRenderer = new LaserPointerRenderer();
|
laserPointerRenderer = new LaserPointerRenderer();
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ public abstract class WDScreen extends Screen {
|
||||||
boolean down = false;
|
boolean down = false;
|
||||||
|
|
||||||
for (Control ctrl : controls)
|
for (Control ctrl : controls)
|
||||||
down = down || ctrl.keyDown(keyCode);
|
down = down || ctrl.keyDown(keyCode, scanCode, modifiers);
|
||||||
|
|
||||||
if (Minecraft.getInstance().screen instanceof GuiKeyboard) {
|
if (Minecraft.getInstance().screen instanceof GuiKeyboard) {
|
||||||
return down;
|
return down;
|
||||||
|
|
@ -221,7 +221,7 @@ public abstract class WDScreen extends Screen {
|
||||||
boolean up = false;
|
boolean up = false;
|
||||||
|
|
||||||
for(Control ctrl : controls)
|
for(Control ctrl : controls)
|
||||||
up = up || ctrl.keyUp(keyCode);
|
up = up || ctrl.keyUp(keyCode, scanCode, modifiers);
|
||||||
|
|
||||||
return up || super.keyReleased(keyCode, scanCode, modifiers);
|
return up || super.keyReleased(keyCode, scanCode, modifiers);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ public class Button extends Control {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyUp(int key) {
|
public boolean keyUp(int key, int scanCode, int modifiers) {
|
||||||
if(key == GLFW.GLFW_KEY_LEFT_SHIFT || key == GLFW.GLFW_KEY_RIGHT_SHIFT) {
|
if(key == GLFW.GLFW_KEY_LEFT_SHIFT || key == GLFW.GLFW_KEY_RIGHT_SHIFT) {
|
||||||
shiftDown = false;
|
shiftDown = false;
|
||||||
btn.setFGColor(originalColor);
|
btn.setFGColor(originalColor);
|
||||||
|
|
@ -170,7 +170,7 @@ public class Button extends Control {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyDown(int key) {
|
public boolean keyDown(int key, int scanCode, int modifiers) {
|
||||||
if(key == GLFW.GLFW_KEY_LEFT_SHIFT || key == GLFW.GLFW_KEY_RIGHT_SHIFT) {
|
if(key == GLFW.GLFW_KEY_LEFT_SHIFT || key == GLFW.GLFW_KEY_RIGHT_SHIFT) {
|
||||||
shiftDown = true;
|
shiftDown = true;
|
||||||
btn.setFGColor(shiftColor);
|
btn.setFGColor(shiftColor);
|
||||||
|
|
|
||||||
|
|
@ -36,24 +36,24 @@ public abstract class Container extends BasicControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyUp(int key) {
|
public boolean keyUp(int key, int scanCode, int modifiers) {
|
||||||
boolean up = false;
|
boolean up = false;
|
||||||
|
|
||||||
if(!disabled) {
|
if(!disabled) {
|
||||||
for(Control ctrl : childs)
|
for(Control ctrl : childs)
|
||||||
up = up || ctrl.keyUp(key);
|
up = up || ctrl.keyUp(key, scanCode, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
return up;
|
return up;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyDown(int key) {
|
public boolean keyDown(int key, int scanCode, int modifiers) {
|
||||||
boolean down = false;
|
boolean down = false;
|
||||||
|
|
||||||
if(!disabled) {
|
if(!disabled) {
|
||||||
for(Control ctrl : childs)
|
for(Control ctrl : childs)
|
||||||
down = down || ctrl.keyDown(key);
|
down = down || ctrl.keyDown(key, scanCode, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
return down;
|
return down;
|
||||||
|
|
|
||||||
|
|
@ -62,11 +62,11 @@ public abstract class Control {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean keyUp(int key) {
|
public boolean keyUp(int key, int scanCode, int modifiers) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean keyDown(int key) {
|
public boolean keyDown(int key, int scanCode, int modifiers) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,14 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import net.minecraft.client.gui.components.EditBox;
|
import net.minecraft.client.gui.components.EditBox;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
||||||
|
import org.cef.browser.CefBrowserOsr;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import static java.awt.event.KeyEvent.VK_ENTER;
|
||||||
|
import static org.lwjgl.glfw.GLFW.*;
|
||||||
|
|
||||||
public class TextField extends Control {
|
public class TextField extends Control {
|
||||||
|
|
||||||
public static class EnterPressedEvent extends Event<TextField> {
|
public static class EnterPressedEvent extends Event<TextField> {
|
||||||
|
|
@ -105,27 +109,32 @@ public class TextField extends Control {
|
||||||
field.setValue(text);
|
field.setValue(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: make this public static in CefBrowserOSR
|
||||||
|
private long mapScanCode(int key, char c) {
|
||||||
|
if (key == GLFW_KEY_LEFT_CONTROL || key == GLFW_KEY_RIGHT_CONTROL) return 29;
|
||||||
|
return switch (key) {
|
||||||
|
case GLFW_KEY_DELETE -> 83;
|
||||||
|
case GLFW_KEY_LEFT -> 75;
|
||||||
|
case GLFW_KEY_DOWN -> 80;
|
||||||
|
case GLFW_KEY_UP -> 72;
|
||||||
|
case GLFW_KEY_RIGHT -> 77;
|
||||||
|
case GLFW_KEY_PAGE_DOWN -> 81;
|
||||||
|
case GLFW_KEY_PAGE_UP -> 73;
|
||||||
|
case GLFW_KEY_END -> 79;
|
||||||
|
case GLFW_KEY_HOME -> 71;
|
||||||
|
case VK_ENTER, GLFW_KEY_ENTER, GLFW_KEY_KP_ENTER -> 28;
|
||||||
|
default -> GLFW.glfwGetKeyScancode(key);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyDown(int key) {
|
public boolean keyDown(int key, int scanCode, int modifiers) {
|
||||||
if(key == GLFW.GLFW_KEY_BACKSPACE) {
|
return field.keyPressed(key, scanCode, modifiers);
|
||||||
String old;
|
}
|
||||||
if(enabled && field.isFocused())
|
|
||||||
old = field.getValue();
|
|
||||||
else
|
|
||||||
old = null;
|
|
||||||
|
|
||||||
if(field.getValue().length() > 0)
|
@Override
|
||||||
field.setValue(field.getValue().substring(0, field.getValue().length() - 1));
|
public boolean keyUp(int key, int scanCode, int modifiers) {
|
||||||
|
return field.keyReleased(key, scanCode, modifiers);
|
||||||
if(enabled && field.isFocused() && !field.getValue().equals(old)) {
|
|
||||||
for(TextChangeListener tcl : listeners)
|
|
||||||
tcl.onTextChange(this, old, field.getValue());
|
|
||||||
|
|
||||||
parent.actionPerformed(new TextChangedEvent(this, old));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -141,14 +150,14 @@ public class TextField extends Control {
|
||||||
else
|
else
|
||||||
old = null;
|
old = null;
|
||||||
|
|
||||||
field.charTyped((char) keyCode, modifier);
|
|
||||||
|
|
||||||
if(enabled && field.isFocused() && !field.getValue().equals(old)) {
|
if(enabled && field.isFocused() && !field.getValue().equals(old)) {
|
||||||
for(TextChangeListener tcl : listeners)
|
for(TextChangeListener tcl : listeners)
|
||||||
tcl.onTextChange(this, old, field.getValue());
|
tcl.onTextChange(this, old, field.getValue());
|
||||||
|
|
||||||
parent.actionPerformed(new TextChangedEvent(this, old));
|
parent.actionPerformed(new TextChangedEvent(this, old));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return field.charTyped((char) keyCode, modifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -159,6 +168,27 @@ public class TextField extends Control {
|
||||||
return field.mouseClicked(mouseX, mouseY, mouseButton);
|
return field.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseReleased(double mouseX, double mouseY, int state) {
|
||||||
|
return field.mouseReleased(mouseX, mouseY, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseClickMove(double mouseX, double mouseY, int button, double dragX, double dragY) {
|
||||||
|
return field.mouseClicked(mouseX, mouseY, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseMove(double mouseX, double mouseY) {
|
||||||
|
field.mouseMoved(mouseX, mouseY);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseScroll(double mouseX, double mouseY, double amount) {
|
||||||
|
return field.mouseScrolled(mouseX, mouseY, amount);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void draw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
field.render(poseStack, mouseX, mouseY, ptt);
|
field.render(poseStack, mouseX, mouseY, ptt);
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,13 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.*;
|
import com.mojang.blaze3d.vertex.*;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GameRenderer;
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
|
import net.minecraft.client.renderer.LevelRenderer;
|
||||||
import net.minecraft.client.renderer.MultiBufferSource;
|
import net.minecraft.client.renderer.MultiBufferSource;
|
||||||
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
|
import net.montoyo.mcef.api.IStringVisitor;
|
||||||
import net.montoyo.wd.SharedProxy;
|
import net.montoyo.wd.SharedProxy;
|
||||||
import net.montoyo.wd.WebDisplays;
|
import net.montoyo.wd.WebDisplays;
|
||||||
import net.montoyo.wd.client.ClientProxy;
|
import net.montoyo.wd.client.ClientProxy;
|
||||||
|
|
@ -157,68 +160,15 @@ public class ScreenRenderer implements BlockEntityRenderer<TileEntityScreen> {
|
||||||
|
|
||||||
|
|
||||||
//Bounding box debugging
|
//Bounding box debugging
|
||||||
// poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
// poseStack.translate(-te.getBlockPos().getX(), -te.getBlockPos().getY(), -te.getBlockPos().getZ());
|
poseStack.translate(-te.getBlockPos().getX(), -te.getBlockPos().getY(), -te.getBlockPos().getZ());
|
||||||
// renderAABB(te.getRenderBoundingBox());
|
LevelRenderer.renderLineBox(
|
||||||
// poseStack.popPose();
|
poseStack, bufferSource.getBuffer(RenderType.LINES),
|
||||||
|
te.getRenderBoundingBox(), 1, 1, 1, 1f
|
||||||
|
);
|
||||||
|
poseStack.popPose();
|
||||||
|
|
||||||
//Re-enable lighting
|
//Re-enable lighting
|
||||||
RenderSystem.enableCull();
|
RenderSystem.enableCull();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderAABB(AABB bb) {
|
|
||||||
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();
|
|
||||||
VertexBuffer tb = new VertexBuffer();
|
|
||||||
vb.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION);
|
|
||||||
|
|
||||||
//Bottom
|
|
||||||
vb.vertex(bb.minX, bb.minY, bb.minZ).endVertex();
|
|
||||||
vb.vertex(bb.maxX, bb.minY, bb.minZ).endVertex();
|
|
||||||
vb.vertex(bb.maxX, bb.minY, bb.maxZ).endVertex();
|
|
||||||
vb.vertex(bb.minX, bb.minY, bb.maxZ).endVertex();
|
|
||||||
|
|
||||||
//Top
|
|
||||||
vb.vertex(bb.minX, bb.maxY, bb.minZ).endVertex();
|
|
||||||
vb.vertex(bb.maxX, bb.maxY, bb.minZ).endVertex();
|
|
||||||
vb.vertex(bb.maxX, bb.maxY, bb.maxZ).endVertex();
|
|
||||||
vb.vertex(bb.minX, bb.maxY, bb.maxZ).endVertex();
|
|
||||||
|
|
||||||
//Left
|
|
||||||
vb.vertex(bb.minX, bb.minY, bb.minZ).endVertex();
|
|
||||||
vb.vertex(bb.minX, bb.minY, bb.maxZ).endVertex();
|
|
||||||
vb.vertex(bb.minX, bb.maxY, bb.maxZ).endVertex();
|
|
||||||
vb.vertex(bb.minX, bb.maxY, bb.minZ).endVertex();
|
|
||||||
|
|
||||||
//Right
|
|
||||||
vb.vertex(bb.maxX, bb.minY, bb.minZ).endVertex();
|
|
||||||
vb.vertex(bb.maxX, bb.minY, bb.maxZ).endVertex();
|
|
||||||
vb.vertex(bb.maxX, bb.maxY, bb.maxZ).endVertex();
|
|
||||||
vb.vertex(bb.maxX, bb.maxY, bb.minZ).endVertex();
|
|
||||||
|
|
||||||
//Front
|
|
||||||
vb.vertex(bb.minX, bb.minY, bb.minZ).endVertex();
|
|
||||||
vb.vertex(bb.maxX, bb.minY, bb.minZ).endVertex();
|
|
||||||
vb.vertex(bb.maxX, bb.maxY, bb.minZ).endVertex();
|
|
||||||
vb.vertex(bb.minX, bb.maxY, bb.minZ).endVertex();
|
|
||||||
|
|
||||||
//Back
|
|
||||||
vb.vertex(bb.minX, bb.minY, bb.maxZ).endVertex();
|
|
||||||
vb.vertex(bb.maxX, bb.minY, bb.maxZ).endVertex();
|
|
||||||
vb.vertex(bb.maxX, bb.maxY, bb.maxZ).endVertex();
|
|
||||||
vb.vertex(bb.minX, bb.maxY, bb.maxZ).endVertex();
|
|
||||||
tb.draw();
|
|
||||||
|
|
||||||
RenderSystem.depthMask(true);
|
|
||||||
RenderSystem.enableCull();
|
|
||||||
RenderSystem.enableTexture();
|
|
||||||
RenderSystem.disableBlend();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@
|
||||||
package net.montoyo.wd.data;
|
package net.montoyo.wd.data;
|
||||||
|
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
|
@ -15,9 +17,15 @@ import net.montoyo.wd.net.Messages;
|
||||||
import net.montoyo.wd.net.client.CMessageOpenGui;
|
import net.montoyo.wd.net.client.CMessageOpenGui;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
public abstract class GuiData {
|
public abstract class GuiData {
|
||||||
|
|
||||||
|
protected static class GuiType {
|
||||||
|
Class<?> clazz;
|
||||||
|
ResourceLocation id;
|
||||||
|
}
|
||||||
|
|
||||||
private static final HashMap<String, Class<? extends GuiData>> dataTable = new HashMap<>();
|
private static final HashMap<String, Class<? extends GuiData>> dataTable = new HashMap<>();
|
||||||
static {
|
static {
|
||||||
dataTable.put("SetURL", SetURLData.class);
|
dataTable.put("SetURL", SetURLData.class);
|
||||||
|
|
@ -31,6 +39,13 @@ public abstract class GuiData {
|
||||||
return dataTable.get(name);
|
return dataTable.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GuiData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// public GuiData(FriendlyByteBuf buf) {
|
||||||
|
// this.deserialize(buf);
|
||||||
|
// }
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public abstract Screen createGui(Screen old, Level world);
|
public abstract Screen createGui(Screen old, Level world);
|
||||||
public abstract String getName();
|
public abstract String getName();
|
||||||
|
|
@ -39,4 +54,7 @@ public abstract class GuiData {
|
||||||
Messages.INSTANCE.send(PacketDistributor.PLAYER.with(() -> player), new CMessageOpenGui(this));
|
Messages.INSTANCE.send(PacketDistributor.PLAYER.with(() -> player), new CMessageOpenGui(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public abstract void serialize(FriendlyByteBuf buf);
|
||||||
|
// public abstract void deserialize(FriendlyByteBuf buf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ package net.montoyo.wd.data;
|
||||||
|
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
|
@ -27,6 +28,10 @@ public class KeyboardData extends GuiData {
|
||||||
public KeyboardData() {
|
public KeyboardData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public KeyboardData(FriendlyByteBuf buf) {
|
||||||
|
// super(buf);
|
||||||
|
// }
|
||||||
|
|
||||||
public KeyboardData(TileEntityScreen tes, BlockSide side, BlockPos kbPos) {
|
public KeyboardData(TileEntityScreen tes, BlockSide side, BlockPos kbPos) {
|
||||||
pos = new Vector3i(tes.getBlockPos());
|
pos = new Vector3i(tes.getBlockPos());
|
||||||
this.side = side;
|
this.side = side;
|
||||||
|
|
@ -52,4 +57,23 @@ public class KeyboardData extends GuiData {
|
||||||
return "Keyboard";
|
return "Keyboard";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public void serialize(FriendlyByteBuf buf) {
|
||||||
|
// buf.writeInt(pos.x);
|
||||||
|
// buf.writeInt(pos.y);
|
||||||
|
// buf.writeInt(pos.z);
|
||||||
|
// buf.writeByte(side.ordinal());
|
||||||
|
// buf.writeInt(kbX);
|
||||||
|
// buf.writeInt(kbY);
|
||||||
|
// buf.writeInt(kbZ);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void deserialize(FriendlyByteBuf buf) {
|
||||||
|
// this.pos = new Vector3i(buf.readInt(), buf.readInt(), buf.readInt());
|
||||||
|
// this.side = BlockSide.values()[buf.readByte()];
|
||||||
|
// this.kbX = buf.readInt();
|
||||||
|
// this.kbY = buf.readInt();
|
||||||
|
// this.kbZ = buf.readInt();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ package net.montoyo.wd.data;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.chat.Style;
|
import net.minecraft.network.chat.Style;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
|
@ -23,8 +24,13 @@ public class RedstoneCtrlData extends GuiData {
|
||||||
public String fallingEdgeURL;
|
public String fallingEdgeURL;
|
||||||
|
|
||||||
public RedstoneCtrlData() {
|
public RedstoneCtrlData() {
|
||||||
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public RedstoneCtrlData(FriendlyByteBuf buf) {
|
||||||
|
// super(buf);
|
||||||
|
// }
|
||||||
|
|
||||||
public RedstoneCtrlData(ResourceLocation d, BlockPos p, String r, String f) {
|
public RedstoneCtrlData(ResourceLocation d, BlockPos p, String r, String f) {
|
||||||
dimension = d;
|
dimension = d;
|
||||||
pos = new Vector3i(p);
|
pos = new Vector3i(p);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
package net.montoyo.wd.data;
|
package net.montoyo.wd.data;
|
||||||
|
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
|
|
@ -34,6 +35,10 @@ public class ScreenConfigData extends GuiData {
|
||||||
public ScreenConfigData() {
|
public ScreenConfigData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public ScreenConfigData(FriendlyByteBuf buf) {
|
||||||
|
// super(buf);
|
||||||
|
// }
|
||||||
|
|
||||||
public ScreenConfigData(Vector3i pos, BlockSide side, TileEntityScreen.Screen scr) {
|
public ScreenConfigData(Vector3i pos, BlockSide side, TileEntityScreen.Screen scr) {
|
||||||
this.pos = pos;
|
this.pos = pos;
|
||||||
this.side = side;
|
this.side = side;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ package net.montoyo.wd.data;
|
||||||
|
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
@ -21,6 +22,10 @@ public class ServerData extends GuiData {
|
||||||
public ServerData() {
|
public ServerData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public ServerData(FriendlyByteBuf buf) {
|
||||||
|
// super(buf);
|
||||||
|
// }
|
||||||
|
|
||||||
public ServerData(BlockPos bp, NameUUIDPair owner) {
|
public ServerData(BlockPos bp, NameUUIDPair owner) {
|
||||||
pos = new Vector3i(bp);
|
pos = new Vector3i(bp);
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ package net.montoyo.wd.data;
|
||||||
|
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
|
@ -27,6 +28,10 @@ public class SetURLData extends GuiData {
|
||||||
public SetURLData() {
|
public SetURLData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public SetURLData(FriendlyByteBuf buf) {
|
||||||
|
// super(buf);
|
||||||
|
// }
|
||||||
|
|
||||||
public SetURLData(Vector3i pos, BlockSide side, String url) {
|
public SetURLData(Vector3i pos, BlockSide side, String url) {
|
||||||
this.pos = pos;
|
this.pos = pos;
|
||||||
this.side = side;
|
this.side = side;
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.network.Connection;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
|
|
@ -30,9 +28,9 @@ import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraftforge.network.PacketDistributor;
|
import net.minecraftforge.network.PacketDistributor;
|
||||||
import net.montoyo.mcef.api.IBrowser;
|
import net.montoyo.mcef.api.IBrowser;
|
||||||
import net.montoyo.wd.SharedProxy;
|
|
||||||
import net.montoyo.wd.WebDisplays;
|
import net.montoyo.wd.WebDisplays;
|
||||||
import net.montoyo.wd.block.BlockScreen;
|
import net.montoyo.wd.block.BlockScreen;
|
||||||
import net.montoyo.wd.client.ClientProxy;
|
import net.montoyo.wd.client.ClientProxy;
|
||||||
|
|
@ -47,9 +45,7 @@ import net.montoyo.wd.init.TileInit;
|
||||||
import net.montoyo.wd.miniserv.SyncPlugin;
|
import net.montoyo.wd.miniserv.SyncPlugin;
|
||||||
import net.montoyo.wd.net.Messages;
|
import net.montoyo.wd.net.Messages;
|
||||||
import net.montoyo.wd.net.client.*;
|
import net.montoyo.wd.net.client.*;
|
||||||
import net.montoyo.wd.net.server.SMessageGetUrl;
|
|
||||||
import net.montoyo.wd.net.server.SMessageRequestTEData;
|
import net.montoyo.wd.net.server.SMessageRequestTEData;
|
||||||
import net.montoyo.wd.net.server.URLMessage;
|
|
||||||
import net.montoyo.wd.utilities.*;
|
import net.montoyo.wd.utilities.*;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
|
|
@ -57,10 +53,7 @@ import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.awt.event.InputEvent;
|
import java.awt.event.InputEvent;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.*;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import static net.montoyo.wd.block.BlockPeripheral.point;
|
import static net.montoyo.wd.block.BlockPeripheral.point;
|
||||||
|
|
@ -672,19 +665,47 @@ public class TileEntityScreen extends BlockEntity {
|
||||||
|
|
||||||
private void updateAABB() {
|
private void updateAABB() {
|
||||||
Vector3i origin = new Vector3i(getBlockPos());
|
Vector3i origin = new Vector3i(getBlockPos());
|
||||||
Vector3i tmp = new Vector3i();
|
MutableAABB box = null;
|
||||||
AABB aabb = new AABB(origin);
|
|
||||||
|
|
||||||
for (Screen scr : screens) {
|
for (Screen scr : screens) {
|
||||||
tmp.set(origin);
|
Vector3i f = scr.side.forward;
|
||||||
tmp.addMul(scr.side.right, scr.size.x);
|
|
||||||
tmp.addMul(scr.side.up, scr.size.y);
|
|
||||||
tmp.add(scr.side.forward);
|
|
||||||
|
|
||||||
aabb.expand(tmp);
|
int fx = Math.max(f.x, 0);
|
||||||
|
int fy = Math.max(f.y, 0);
|
||||||
|
int fz = Math.max(f.z, 0);
|
||||||
|
int ox = 0;
|
||||||
|
if (scr.side.equals(BlockSide.NORTH)) ox = 1;
|
||||||
|
int oz = 0;
|
||||||
|
if (
|
||||||
|
scr.side.equals(BlockSide.EAST) ||
|
||||||
|
scr.side.equals(BlockSide.TOP) ||
|
||||||
|
scr.side.equals(BlockSide.BOTTOM)
|
||||||
|
) oz = 1;
|
||||||
|
|
||||||
|
if (box == null) {
|
||||||
|
box = new MutableAABB(
|
||||||
|
origin.x + fx + ox,
|
||||||
|
origin.y + fy,
|
||||||
|
origin.z + fz + oz,
|
||||||
|
|
||||||
|
origin.x + ox + scr.side.right.x * scr.size.x + fx + scr.side.up.x * scr.size.y,
|
||||||
|
origin.y + scr.side.right.y * scr.size.x + fy + scr.side.up.y * scr.size.y,
|
||||||
|
origin.z + oz + scr.side.right.z * scr.size.x + fz + scr.side.up.z * scr.size.y
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
box.expand(
|
||||||
|
origin.x + fx + ox,
|
||||||
|
origin.y + fy,
|
||||||
|
origin.z + fz + oz,
|
||||||
|
|
||||||
|
origin.x + ox + scr.side.right.x * scr.size.x + fx + scr.side.up.x * scr.size.y,
|
||||||
|
origin.y + scr.side.right.y * scr.size.x + fy + scr.side.up.y * scr.size.y,
|
||||||
|
origin.z + oz + scr.side.right.z * scr.size.x + fz + scr.side.up.z * scr.size.y
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderBB = aabb.toMc().expandTowards(0.1, 0.1, 0.1);
|
renderBB = box.toMc();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2018 BARBOTIN Nicolas
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.montoyo.wd.utilities;
|
|
||||||
|
|
||||||
public final class AABB {
|
|
||||||
|
|
||||||
public final Vector3i start;
|
|
||||||
public final Vector3i end;
|
|
||||||
|
|
||||||
public AABB() {
|
|
||||||
start = new Vector3i();
|
|
||||||
end = new Vector3i();
|
|
||||||
}
|
|
||||||
|
|
||||||
public AABB(Vector3i pos) {
|
|
||||||
start = pos.clone();
|
|
||||||
end = pos.clone();
|
|
||||||
}
|
|
||||||
|
|
||||||
public AABB(Vector3i a, Vector3i b) {
|
|
||||||
start = new Vector3i();
|
|
||||||
end = new Vector3i();
|
|
||||||
|
|
||||||
start.x = Math.min(a.x, b.x);
|
|
||||||
start.y = Math.min(a.y, b.y);
|
|
||||||
start.z = Math.min(a.z, b.z);
|
|
||||||
end.x = Math.max(a.x, b.x);
|
|
||||||
end.y = Math.max(a.y, b.y);
|
|
||||||
end.z = Math.max(a.z, b.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AABB(net.minecraft.world.phys.AABB bb) {
|
|
||||||
start = new Vector3i();
|
|
||||||
end = new Vector3i();
|
|
||||||
|
|
||||||
start.x = (int) bb.minX;
|
|
||||||
start.y = (int) bb.minY;
|
|
||||||
start.z = (int) bb.minZ;
|
|
||||||
end.x = (int) Math.ceil(bb.maxX);
|
|
||||||
end.y = (int) Math.ceil(bb.maxY);
|
|
||||||
end.z = (int) Math.ceil(bb.maxZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AABB expand(Vector3i vec) {
|
|
||||||
if(vec.x > end.x)
|
|
||||||
end.x = vec.x;
|
|
||||||
else if(vec.x < start.x)
|
|
||||||
start.x = vec.x;
|
|
||||||
|
|
||||||
if(vec.y > end.y)
|
|
||||||
end.y = vec.y;
|
|
||||||
else if(vec.y < start.y)
|
|
||||||
start.y = vec.y;
|
|
||||||
|
|
||||||
if(vec.z > end.z)
|
|
||||||
end.z = vec.z;
|
|
||||||
else if(vec.z < start.z)
|
|
||||||
start.z = vec.z;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AABB move(Vector3i start) {
|
|
||||||
end.sub(this.start).add(start);
|
|
||||||
this.start.set(start);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public net.minecraft.world.phys.AABB toMc() {
|
|
||||||
return new net.minecraft.world.phys.AABB(start.x, start.y, start.z, end.x, end.y, end.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
83
src/main/java/net/montoyo/wd/utilities/MutableAABB.java
Normal file
83
src/main/java/net/montoyo/wd/utilities/MutableAABB.java
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 BARBOTIN Nicolas
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.montoyo.wd.utilities;
|
||||||
|
|
||||||
|
import net.minecraft.world.phys.AABB;
|
||||||
|
|
||||||
|
public final class MutableAABB extends AABB {
|
||||||
|
public MutableAABB() {
|
||||||
|
super(0, 0, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableAABB(Vector3i pos) {
|
||||||
|
super(pos.x, pos.y, pos.z, pos.x, pos.y, pos.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableAABB(Vector3i a, Vector3i b) {
|
||||||
|
super(a.x, a.y, a.z, b.x, b.y, b.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableAABB(net.minecraft.world.phys.AABB bb) {
|
||||||
|
super(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableAABB(double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||||
|
super(x1, y1, z1, x2, y2, z2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableAABB expand(Vector3i vec) {
|
||||||
|
if (vec.x > maxX)
|
||||||
|
maxX = vec.x;
|
||||||
|
else if (vec.x < minX)
|
||||||
|
minX = vec.x;
|
||||||
|
|
||||||
|
if (vec.y > maxY)
|
||||||
|
maxY = vec.y;
|
||||||
|
else if (vec.y < minY)
|
||||||
|
minY = vec.y;
|
||||||
|
|
||||||
|
if (vec.z > maxZ)
|
||||||
|
maxZ = vec.z;
|
||||||
|
else if (vec.z < minZ)
|
||||||
|
minZ = vec.z;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AABB move(double x, double y, double z) {
|
||||||
|
minX += x;
|
||||||
|
minY += y;
|
||||||
|
minZ += z;
|
||||||
|
maxX += x;
|
||||||
|
maxY += y;
|
||||||
|
maxZ += z;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public net.minecraft.world.phys.AABB toMc() {
|
||||||
|
return new AABB(minX, minY, minZ, maxX, maxY, maxZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAndCheck(double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||||
|
minX = Math.min(x1, x2);
|
||||||
|
minY = Math.min(y1, y2);
|
||||||
|
minZ = Math.min(z1, z2);
|
||||||
|
|
||||||
|
maxX = Math.max(x1, x2);
|
||||||
|
maxY = Math.max(y1, y2);
|
||||||
|
maxZ = Math.max(z1, z2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void expand(double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||||
|
minX = Math.min(minX, Math.min(x1, x2));
|
||||||
|
minY = Math.min(minY, Math.min(y1, y2));
|
||||||
|
minZ = Math.min(minZ, Math.min(z1, z2));
|
||||||
|
|
||||||
|
maxX = Math.max(maxX, Math.max(x1, x2));
|
||||||
|
maxY = Math.max(maxY, Math.max(y1, y2));
|
||||||
|
maxZ = Math.max(maxZ, Math.max(z1, z2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -20,6 +20,7 @@ import java.util.UUID;
|
||||||
|
|
||||||
public abstract class Util {
|
public abstract class Util {
|
||||||
|
|
||||||
|
@Deprecated(forRemoval = true)
|
||||||
public static void serialize(FriendlyByteBuf bb, Object f) {
|
public static void serialize(FriendlyByteBuf bb, Object f) {
|
||||||
Class<?> cls = f.getClass();
|
Class<?> cls = f.getClass();
|
||||||
|
|
||||||
|
|
@ -61,6 +62,7 @@ public abstract class Util {
|
||||||
throw new RuntimeException(String.format("Cannot transmit class %s over network!", cls.getName()));
|
throw new RuntimeException(String.format("Cannot transmit class %s over network!", cls.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated(forRemoval = true)
|
||||||
public static Object unserialize(FriendlyByteBuf bb, Class cls) {
|
public static Object unserialize(FriendlyByteBuf bb, Class cls) {
|
||||||
if(cls == Integer.class || cls == Integer.TYPE)
|
if(cls == Integer.class || cls == Integer.TYPE)
|
||||||
return bb.readInt();
|
return bb.readInt();
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
public net.minecraft.client.resources.sounds.SimpleSoundInstance
|
|
||||||
10
src/main/resources/META-INF/accesstransformer.cfg
Normal file
10
src/main/resources/META-INF/accesstransformer.cfg
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
public net.minecraft.client.resources.sounds.SimpleSoundInstance
|
||||||
|
|
||||||
|
|
||||||
|
# AABB
|
||||||
|
public-f net.minecraft.world.phys.AABB f_82288_
|
||||||
|
public-f net.minecraft.world.phys.AABB f_82289_
|
||||||
|
public-f net.minecraft.world.phys.AABB f_82290_
|
||||||
|
public-f net.minecraft.world.phys.AABB f_82291_
|
||||||
|
public-f net.minecraft.world.phys.AABB f_82292_
|
||||||
|
public-f net.minecraft.world.phys.AABB f_82293_
|
||||||
|
|
@ -1,38 +1,38 @@
|
||||||
{
|
{
|
||||||
"itemGroup.webdisplays": "§5Web Displays",
|
"itemGroup.webdisplays": "§5Web Displays",
|
||||||
"tile.webdisplays.screen.name": "Web Screen",
|
"block.webdisplays.screen": "Web Screen",
|
||||||
"tile.webdisplays.peripheral.name": "Peripheral",
|
"block.webdisplays.peripheral": "Peripheral",
|
||||||
"tile.webdisplays.peripheral.keyboard.name": "Keyboard",
|
"block.webdisplays.peripheral.keyboard": "Keyboard",
|
||||||
"tile.webdisplays.peripheral.remotectrl.name": "Remote Controller",
|
"block.webdisplays.peripheral.remotectrl": "Remote Controller",
|
||||||
"tile.webdisplays.peripheral.ccinterface.name": "ComputerCraft Interface",
|
"block.webdisplays.peripheral.ccinterface": "ComputerCraft Interface",
|
||||||
"tile.webdisplays.peripheral.cointerface.name": "OpenComputers Interface",
|
"block.webdisplays.peripheral.cointerface": "OpenComputers Interface",
|
||||||
"tile.webdisplays.peripheral.redstonectrl.name": "Redstone Controller",
|
"block.webdisplays.peripheral.redstonectrl": "Redstone Controller",
|
||||||
"tile.webdisplays.peripheral.server.name": "Server",
|
"block.webdisplays.peripheral.server": "Server",
|
||||||
"item.webdisplays.screencfg.name": "Screen Configurator",
|
"item.webdisplays.screencfg": "Screen Configurator",
|
||||||
"item.webdisplays.ownerthief.name": "Ownership Thief [ADMIN]",
|
"item.webdisplays.ownerthief": "Ownership Thief [ADMIN]",
|
||||||
"item.webdisplays.linker.name": "Linking Tool",
|
"item.webdisplays.linker": "Linking Tool",
|
||||||
"item.webdisplays.craftcomp.name": "Craft Component",
|
"item.webdisplays.craftcomp": "Craft Component",
|
||||||
"item.webdisplays.craftcomp.stonekey.name": "Stone Key",
|
"item.webdisplays.craftcomp.stonekey": "Stone Key",
|
||||||
"item.webdisplays.craftcomp.upgrade.name": "Blank Upgrade",
|
"item.webdisplays.craftcomp.upgrade": "Blank Upgrade",
|
||||||
"item.webdisplays.craftcomp.peripheral.name": "Peripheral Base",
|
"item.webdisplays.craftcomp.peripheral": "Peripheral Base",
|
||||||
"item.webdisplays.craftcomp.batcell.name": "Battery Cell",
|
"item.webdisplays.craftcomp.batcell": "Battery Cell",
|
||||||
"item.webdisplays.craftcomp.batpack.name": "Battery Pack",
|
"item.webdisplays.craftcomp.batpack": "Battery Pack",
|
||||||
"item.webdisplays.craftcomp.laserdiode.name": "650nm Laser Diode",
|
"item.webdisplays.craftcomp.laserdiode": "650nm Laser Diode",
|
||||||
"item.webdisplays.craftcomp.backlight.name": "Backlight",
|
"item.webdisplays.craftcomp.backlight": "Backlight",
|
||||||
"item.webdisplays.craftcomp.extcard.name": "Extension Card",
|
"item.webdisplays.craftcomp.extcard": "Extension Card",
|
||||||
"item.webdisplays.craftcomp.badextcard.name": "Bad Extension Card",
|
"item.webdisplays.craftcomp.badextcard": "Bad Extension Card",
|
||||||
"item.webdisplays.minepad.name": "minePad",
|
"item.webdisplays.minepad": "minePad",
|
||||||
"item.webdisplays.minepad2.name": "minePad 2",
|
"item.webdisplays.minepad2": "minePad 2",
|
||||||
"item.webdisplays.upgrade.name": "Screen Upgrade",
|
"item.webdisplays.upgrade": "Screen Upgrade",
|
||||||
"item.webdisplays.upgrade.lasermouse.name": "Laser Sensor",
|
"item.webdisplays.upgrade.lasermouse": "Laser Sensor",
|
||||||
"item.webdisplays.upgrade.redinput.name": "Redstone Input Port",
|
"item.webdisplays.upgrade.redinput": "Redstone Input Port",
|
||||||
"item.webdisplays.upgrade.redoutput.name": "Redstone Output Port",
|
"item.webdisplays.upgrade.redoutput": "Redstone Output Port",
|
||||||
"item.webdisplays.upgrade.gps.name": "GPS Module",
|
"item.webdisplays.upgrade.gps": "GPS Module",
|
||||||
"item.webdisplays.laserpointer.name": "Laser Pointer",
|
"item.webdisplays.laserpointer": "Laser Pointer",
|
||||||
"item.webdisplays.advicon.name": "Advancement Icon",
|
"item.webdisplays.advicon": "Advancement Icon",
|
||||||
"item.webdisplays.advicon.wd.name": "WebDisplays",
|
"item.webdisplays.advicon.wd": "WebDisplays",
|
||||||
"item.webdisplays.advicon.brokenpad.name": "Broken minePad",
|
"item.webdisplays.advicon.brokenpad": "Broken minePad",
|
||||||
"item.webdisplays.advicon.pigeon.name": "Pigeon",
|
"item.webdisplays.advicon.pigeon": "Pigeon",
|
||||||
"item.webdisplays.wiki": "Hit 'F1' to open the Wiki",
|
"item.webdisplays.wiki": "Hit 'F1' to open the Wiki",
|
||||||
"webdisplays.message.tooSmall": "Too small! Minimum size is 2x2.",
|
"webdisplays.message.tooSmall": "Too small! Minimum size is 2x2.",
|
||||||
"webdisplays.message.tooBig": "Too big! Maximum size is %dx%d.",
|
"webdisplays.message.tooBig": "Too big! Maximum size is %dx%d.",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user