Pushed what I poked
This commit is contained in:
parent
1cfbb02d6e
commit
e93b25c672
|
|
@ -639,7 +639,7 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer
|
|||
if(ev.getHand() == InteractionHand.OFF_HAND)
|
||||
handSide = handSide.getOpposite();
|
||||
|
||||
renderer.render(new PoseStack(), ev.getItemStack(), (handSide == HumanoidArm.RIGHT) ? 1.0f : -1.0f, ev.getSwingProgress(), ev.getEquipProgress());
|
||||
renderer.render(ev.getPoseStack(), ev.getItemStack(), (handSide == HumanoidArm.RIGHT) ? 1.0f : -1.0f, ev.getSwingProgress(), ev.getEquipProgress(), ev.getMultiBufferSource(), ev.getPackedLight());
|
||||
ev.setCanceled(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,11 @@
|
|||
package net.montoyo.wd.client.renderers;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public interface IItemRenderer {
|
||||
|
||||
void render(PoseStack stack, ItemStack is, float handSideSign, float swingProgress, float equipProgress);
|
||||
void render(PoseStack stack, ItemStack is, float handSideSign, float swingProgress, float equipProgress, MultiBufferSource multiBufferSource, int packedLight);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package net.montoyo.wd.client.renderers;
|
|||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.*;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
|
@ -36,7 +37,7 @@ public final class LaserPointerRenderer implements IItemRenderer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, ItemStack is, float handSideSign, float swingProgress, float equipProgress) {
|
||||
public void render(PoseStack poseStack, ItemStack is, float handSideSign, float swingProgress, float equipProgress, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
//This whole method is a fucking hack
|
||||
float sqrtSwingProg = (float) Math.sqrt(swingProgress);
|
||||
float sinSqrtSwingProg1 = (float) Math.sin(sqrtSwingProg * PI);
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@
|
|||
|
||||
package net.montoyo.wd.client.renderers;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.player.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
|
@ -44,7 +48,7 @@ public final class MinePadRenderer implements IItemRenderer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final void render(PoseStack stack, ItemStack is, float handSideSign, float swingProgress, float equipProgress) {
|
||||
public final void render(PoseStack stack, ItemStack is, float handSideSign, float swingProgress, float equipProgress, MultiBufferSource multiBufferSource, int packedLight) {
|
||||
//Pre-compute values
|
||||
float sqrtSwingProg = (float) Math.sqrt(swingProgress);
|
||||
sinSqrtSwingProg1 = (float) Math.sin(sqrtSwingProg * PI);
|
||||
|
|
@ -52,18 +56,18 @@ public final class MinePadRenderer implements IItemRenderer {
|
|||
sinSwingProg1 = (float) Math.sin(swingProgress * PI);
|
||||
sinSwingProg2 = (float) Math.sin(swingProgress * swingProgress * PI);
|
||||
|
||||
glDisable(GL_CULL_FACE);
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
RenderSystem.disableCull();
|
||||
// glEnable(GL_RESCALE_NORMAL);
|
||||
|
||||
//Render arm
|
||||
glPushMatrix();
|
||||
renderArmFirstPerson(equipProgress, handSideSign);
|
||||
glPopMatrix();
|
||||
stack.pushPose();
|
||||
renderArmFirstPerson(stack, multiBufferSource, packedLight, equipProgress, handSideSign);
|
||||
stack.popPose();
|
||||
|
||||
//Prepare minePad transform
|
||||
glPushMatrix();
|
||||
glTranslatef(handSideSign * -0.4f * sinSqrtSwingProg1, 0.2f * sinSqrtSwingProg2, -0.2f * sinSwingProg1);
|
||||
glTranslatef(handSideSign * 0.56f, -0.52f - equipProgress * 0.6f, -0.72f);
|
||||
stack.translate(handSideSign * -0.4f * sinSqrtSwingProg1, 0.2f * sinSqrtSwingProg2, -0.2f * sinSwingProg1);
|
||||
stack.translate(handSideSign * 0.56f, -0.52f - equipProgress * 0.6f, -0.72f);
|
||||
glRotatef(handSideSign * (45.0f - sinSwingProg2 * 20.0f), 0.0f, 1.0f, 0.0f);
|
||||
glRotatef(handSideSign * sinSqrtSwingProg1 * -20.0f, 0.0f, 0.0f, 1.0f);
|
||||
glRotatef(sinSqrtSwingProg1 * -80.0f, 1.0f, 0.0f, 0.0f);
|
||||
|
|
@ -82,7 +86,7 @@ public final class MinePadRenderer implements IItemRenderer {
|
|||
glPushMatrix();
|
||||
glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
//TODO mc.renderEngine.bindTexture(tex);
|
||||
RenderSystem.setShaderTexture(0, tex);
|
||||
model.render(1.f / 16.f);
|
||||
glPopMatrix();
|
||||
|
||||
|
|
@ -98,32 +102,32 @@ public final class MinePadRenderer implements IItemRenderer {
|
|||
}
|
||||
|
||||
glPopMatrix();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
// glDisable(GL_RESCALE_NORMAL);
|
||||
glEnable(GL_CULL_FACE);
|
||||
}
|
||||
|
||||
private void renderArmFirstPerson(float equipProgress, float handSideSign) {
|
||||
private void renderArmFirstPerson(PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, float equipProgress, float handSideSign) {
|
||||
float tx = -0.3f * sinSqrtSwingProg1;
|
||||
float ty = 0.4f * sinSqrtSwingProg2;
|
||||
float tz = -0.4f * sinSwingProg1;
|
||||
|
||||
glTranslatef(handSideSign * (tx + 0.64000005f), ty - 0.6f - equipProgress * 0.6f, tz - 0.71999997f);
|
||||
matrixStack.translate(handSideSign * (tx + 0.64000005f), ty - 0.6f - equipProgress * 0.6f, tz - 0.71999997f);
|
||||
glRotatef(handSideSign * 45.0f, 0.0f, 1.0f, 0.0f);
|
||||
glRotatef(handSideSign * sinSqrtSwingProg1 * 70.0f, 0.0f, 1.0f, 0.0f);
|
||||
glRotatef(handSideSign * sinSwingProg2 * -20.0f, 0.0f, 0.0f, 1.0f);
|
||||
glTranslatef(-handSideSign, 3.6f, 3.5f);
|
||||
matrixStack.translate(-handSideSign, 3.6f, 3.5f);
|
||||
glRotatef(handSideSign * 120.0f, 0.0f, 0.0f, 1.0f);
|
||||
glRotatef(200.0f, 1.0f, 0.0f, 0.0f);
|
||||
glRotatef(handSideSign * -135.0f, 0.0f, 1.0f, 0.0f);
|
||||
glTranslatef(handSideSign * 5.6f, 0.0f, 0.0f);
|
||||
matrixStack.translate(handSideSign * 5.6f, 0.0f, 0.0f);
|
||||
|
||||
/*RenderPlayer playerRenderer = (RenderPlayer) mc.getRenderManager().<AbstractClientPlayer>getEntityRenderObject(mc.player);
|
||||
mc.getTextureManager().bindTexture(mc.player.getLocationSkin());
|
||||
PlayerRenderer playerRenderer = (PlayerRenderer) mc.getEntityRenderDispatcher().getRenderer(mc.player);
|
||||
RenderSystem.setShaderTexture(0, mc.player.getSkinTextureLocation());
|
||||
|
||||
if(handSideSign >= 0.0f)
|
||||
playerRenderer.renderRightArm(mc.player);
|
||||
playerRenderer.renderRightHand(matrixStack, buffer, combinedLight, mc.player);
|
||||
else
|
||||
playerRenderer.renderLeftArm(mc.player);*/
|
||||
playerRenderer.renderLeftHand(matrixStack, buffer, combinedLight, mc.player);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,5 +45,6 @@ public class Messages {
|
|||
INSTANCE.registerMessage(index++, SMessageRedstoneCtrl.class, SMessageRedstoneCtrl::encode, SMessageRedstoneCtrl::decode, SMessageRedstoneCtrl::handle);
|
||||
INSTANCE.registerMessage(index++, SMessageRequestTEData.class, SMessageRequestTEData::encode, SMessageRequestTEData::decode, SMessageRequestTEData::handle);
|
||||
INSTANCE.registerMessage(index++, SMessageScreenCtrl.class, SMessageScreenCtrl::encode, SMessageScreenCtrl::decode, SMessageScreenCtrl::handle);
|
||||
INSTANCE.registerMessage(index++, SMessagePadCtrl.class, SMessagePadCtrl::encode, SMessagePadCtrl::decode, SMessagePadCtrl::handle);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ public class CMessageACResult {
|
|||
contextSupplier.get().enqueueWork(() -> {
|
||||
WebDisplays.PROXY.onAutocompleteResult(result);
|
||||
});
|
||||
contextSupplier.get().setPacketHandled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,5 +113,6 @@ public class CMessageAddScreen {
|
|||
}
|
||||
|
||||
});
|
||||
contextSupplier.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,5 +60,6 @@ public class CMessageCloseGui {
|
|||
else
|
||||
WebDisplays.PROXY.closeGui(blockPos, blockSide);
|
||||
});
|
||||
contextSupplier.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,5 +83,6 @@ public class CMessageJSResponse {
|
|||
Log.warningEx("Could not handle JS response", t);
|
||||
}
|
||||
});
|
||||
contextSupplier.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class CMessageMiniservKey {
|
|||
return new CMessageMiniservKey(encryptedKey);
|
||||
}
|
||||
|
||||
public CMessageMiniservKey encode(FriendlyByteBuf buf) {
|
||||
public void encode(FriendlyByteBuf buf) {
|
||||
buf.writeShort(encryptedKey.length);
|
||||
buf.writeBytes(encryptedKey);
|
||||
}
|
||||
|
|
@ -39,5 +39,6 @@ public class CMessageMiniservKey {
|
|||
WebDisplays.PROXY.startMiniservClient();
|
||||
}
|
||||
});
|
||||
contextSupplier.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,5 +45,6 @@ public class CMessageOpenGui implements Runnable {
|
|||
|
||||
public void handle(Supplier<NetworkEvent.Context> contextSupplier) {
|
||||
contextSupplier.get().enqueueWork(this);
|
||||
contextSupplier.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,33 +241,26 @@ public class CMessageScreenUpdate {
|
|||
|
||||
TileEntityScreen tes = (TileEntityScreen) te;
|
||||
|
||||
if(action == UPDATE_URL)
|
||||
tes.setScreenURL(side, string);
|
||||
else if(action == UPDATE_MOUSE)
|
||||
tes.handleMouseEvent(side, mouseEvent, vec2i);
|
||||
else if(action == UPDATE_DELETE)
|
||||
tes.removeScreen(side);
|
||||
else if(action == UPDATE_RESOLUTION)
|
||||
tes.setResolution(side, vec2i);
|
||||
else if(action == UPDATE_TYPE)
|
||||
tes.type(side, string, null);
|
||||
else if(action == UPDATE_RUN_JS)
|
||||
tes.evalJS(side, string);
|
||||
else if(action == UPDATE_UPGRADES)
|
||||
tes.updateUpgrades(side, upgrades);
|
||||
else if(action == UPDATE_JS_REDSTONE)
|
||||
tes.updateJSRedstone(side, vec2i, redstoneLevel);
|
||||
else if(action == UPDATE_OWNER) {
|
||||
TileEntityScreen.Screen scr = tes.getScreen(side);
|
||||
|
||||
if(scr != null)
|
||||
scr.owner = owner;
|
||||
} else if(action == UPDATE_ROTATION)
|
||||
tes.setRotation(side, rotation);
|
||||
else if(action == UPDATE_AUTO_VOL)
|
||||
tes.setAutoVolume(side, autoVolume);
|
||||
else
|
||||
Log.warning("Caught invalid CMessageScreenUpdate with action ID %d", action);
|
||||
switch (action) {
|
||||
case UPDATE_URL -> tes.setScreenURL(side, string);
|
||||
case UPDATE_MOUSE -> tes.handleMouseEvent(side, mouseEvent, vec2i);
|
||||
case UPDATE_DELETE -> tes.removeScreen(side);
|
||||
case UPDATE_RESOLUTION -> tes.setResolution(side, vec2i);
|
||||
case UPDATE_TYPE -> tes.type(side, string, null);
|
||||
case UPDATE_RUN_JS -> tes.evalJS(side, string);
|
||||
case UPDATE_UPGRADES -> tes.updateUpgrades(side, upgrades);
|
||||
case UPDATE_JS_REDSTONE -> tes.updateJSRedstone(side, vec2i, redstoneLevel);
|
||||
case UPDATE_OWNER -> {
|
||||
TileEntityScreen.Screen scr = tes.getScreen(side);
|
||||
if (scr != null)
|
||||
scr.owner = owner;
|
||||
}
|
||||
case UPDATE_ROTATION -> tes.setRotation(side, rotation);
|
||||
case UPDATE_AUTO_VOL -> tes.setAutoVolume(side, autoVolume);
|
||||
default -> Log.warning("Caught invalid CMessageScreenUpdate with action ID %d", action);
|
||||
}
|
||||
});
|
||||
|
||||
contextSupplier.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,5 +36,6 @@ public class CMessageServerInfo {
|
|||
if (miniservPort > 0)
|
||||
Messages.INSTANCE.sendToServer(Client.getInstance().beginConnection());
|
||||
});
|
||||
contextSupplier.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public class SMessageACQuery implements Runnable {
|
|||
public void handle(Supplier<NetworkEvent.Context> contextSupplier) {
|
||||
player = contextSupplier.get().getSender();
|
||||
contextSupplier.get().enqueueWork(this);
|
||||
contextSupplier.get().setPacketHandled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,5 +52,7 @@ public class SMessageMiniservConnect {
|
|||
if (encKey != null) {
|
||||
Messages.INSTANCE.sendToServer(new CMessageMiniservKey(encKey));
|
||||
}
|
||||
|
||||
contextSupplier.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,27 +4,23 @@
|
|||
|
||||
package net.montoyo.wd.net.server;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
import net.montoyo.wd.WebDisplays;
|
||||
import net.montoyo.wd.net.Message;
|
||||
import net.montoyo.wd.init.ItemInit;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Message(messageId = 7, side = Side.SERVER)
|
||||
public class SMessagePadCtrl implements Runnable {
|
||||
|
||||
private int id;
|
||||
private String url;
|
||||
private EntityPlayer player;
|
||||
private ServerPlayer player;
|
||||
|
||||
public SMessagePadCtrl() {
|
||||
}
|
||||
|
|
@ -40,29 +36,29 @@ public class SMessagePadCtrl implements Runnable {
|
|||
}
|
||||
|
||||
private boolean matchesMinePadID(ItemStack is) {
|
||||
return is.getItem() == WebDisplays.INSTANCE.itemMinePad && is.getTagCompound() != null && is.getTagCompound().hasKey("PadID") && is.getTagCompound().getInteger("PadID") == id;
|
||||
return is.getItem() == ItemInit.itemMinePad.get() && is.getTag() != null && is.getTag().contains("PadID") && is.getTag().getInt("PadID") == id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if(id < 0) {
|
||||
ItemStack is = player.getHeldItem(EnumHand.MAIN_HAND);
|
||||
ItemStack is = player.getItemInHand(InteractionHand.MAIN_HAND);
|
||||
|
||||
if(is.getItem() == WebDisplays.INSTANCE.itemMinePad) {
|
||||
if(is.getItem() == ItemInit.itemMinePad.get()) {
|
||||
if(url.isEmpty())
|
||||
is.setTagCompound(null); //Shutdown
|
||||
is.setTag(null); //Shutdown
|
||||
else {
|
||||
if(is.getTagCompound() == null)
|
||||
is.setTagCompound(new NBTTagCompound());
|
||||
if(is.getTag() == null)
|
||||
is.setTag(new CompoundTag());
|
||||
|
||||
if(!is.getTagCompound().hasKey("PadID"))
|
||||
is.getTagCompound().setInteger("PadID", WebDisplays.getNextAvailablePadID());
|
||||
if(!is.getTag().contains("PadID"))
|
||||
is.getTag().putInt("PadID", WebDisplays.getNextAvailablePadID());
|
||||
|
||||
is.getTagCompound().setString("PadURL", WebDisplays.applyBlacklist(url));
|
||||
is.getTag().putString("PadURL", WebDisplays.applyBlacklist(url));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
NonNullList<ItemStack> inv = player.inventory.mainInventory;
|
||||
NonNullList<ItemStack> inv = player.getInventory().items;
|
||||
ItemStack target = null;
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
|
|
@ -72,35 +68,30 @@ public class SMessagePadCtrl implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
if(target == null && matchesMinePadID(player.inventory.offHandInventory.get(0)))
|
||||
target = player.inventory.offHandInventory.get(0);
|
||||
if(target == null && matchesMinePadID(player.getInventory().offhand.get(0)))
|
||||
target = player.getInventory().offhand.get(0);
|
||||
|
||||
if(target != null)
|
||||
target.getTagCompound().setString("PadURL", WebDisplays.applyBlacklist(url));
|
||||
target.getTag().putString("PadURL", WebDisplays.applyBlacklist(url));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf) {
|
||||
id = buf.readInt();
|
||||
url = ByteBufUtils.readUTF8String(buf);
|
||||
public static SMessagePadCtrl decode(FriendlyByteBuf buf) {
|
||||
SMessagePadCtrl message = new SMessagePadCtrl();
|
||||
message.id = buf.readInt();
|
||||
message.url = buf.readUtf();
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
public void encode(FriendlyByteBuf buf) {
|
||||
buf.writeInt(id);
|
||||
ByteBufUtils.writeUTF8String(buf, url);
|
||||
buf.writeUtf(url);
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<SMessagePadCtrl, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(SMessagePadCtrl msg, MessageContext ctx) {
|
||||
msg.player = ctx.getServerHandler().player;
|
||||
((WorldServer) msg.player.world).addScheduledTask(msg);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void handle(Supplier<NetworkEvent.Context> contextSupplier) {
|
||||
player = contextSupplier.get().getSender();
|
||||
contextSupplier.get().enqueueWork(this);
|
||||
contextSupplier.get().setPacketHandled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,5 +81,6 @@ public class SMessageRedstoneCtrl implements Runnable {
|
|||
public void handle(Supplier<NetworkEvent.Context> contextSupplier) {
|
||||
player = contextSupplier.get().getSender();
|
||||
contextSupplier.get().enqueueWork(this);
|
||||
contextSupplier.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,5 +66,6 @@ public class SMessageRequestTEData implements Runnable {
|
|||
public void handle(Supplier<NetworkEvent.Context> contextSupplier) {
|
||||
player = contextSupplier.get().getSender();
|
||||
contextSupplier.get().enqueueWork(this);
|
||||
contextSupplier.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,6 +358,7 @@ public class SMessageScreenCtrl implements Runnable {
|
|||
public void handle(Supplier<NetworkEvent.Context> contextSupplier) {
|
||||
player = contextSupplier.get().getSender();
|
||||
contextSupplier.get().enqueueWork(this);
|
||||
contextSupplier.get().setPacketHandled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package net.montoyo.wd.utilities;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.montoyo.wd.WebDisplays;
|
||||
import net.montoyo.wd.init.BlockInit;
|
||||
|
||||
public abstract class Multiblock {
|
||||
|
||||
|
|
@ -50,7 +51,7 @@ public abstract class Multiblock {
|
|||
do {
|
||||
pos.add(side.left);
|
||||
pos.toBlock(bp);
|
||||
} while(override.apply(pos, world.getBlockState(bp).getBlock() == WebDisplays.INSTANCE.blockScreen));
|
||||
} while(override.apply(pos, world.getBlockState(bp).getBlock() == BlockInit.blockScreen.get()));
|
||||
|
||||
pos.add(side.right);
|
||||
|
||||
|
|
@ -58,7 +59,7 @@ public abstract class Multiblock {
|
|||
do {
|
||||
pos.add(side.down);
|
||||
pos.toBlock(bp);
|
||||
} while(override.apply(pos, world.getBlockState(bp).getBlock() == WebDisplays.INSTANCE.blockScreen));
|
||||
} while(override.apply(pos, world.getBlockState(bp).getBlock() == BlockInit.blockScreen.get()));
|
||||
|
||||
pos.add(side.up);
|
||||
}
|
||||
|
|
@ -77,7 +78,7 @@ public abstract class Multiblock {
|
|||
pos.add(side.up);
|
||||
pos.toBlock(bp);
|
||||
ret.y++;
|
||||
} while(world.getBlockState(bp).getBlock() == WebDisplays.INSTANCE.blockScreen);
|
||||
} while(world.getBlockState(bp).getBlock() == BlockInit.blockScreen.get());
|
||||
|
||||
pos.add(side.down);
|
||||
|
||||
|
|
@ -86,7 +87,7 @@ public abstract class Multiblock {
|
|||
pos.add(side.right);
|
||||
pos.toBlock(bp);
|
||||
ret.x++;
|
||||
} while(world.getBlockState(bp).getBlock() == WebDisplays.INSTANCE.blockScreen);
|
||||
} while(world.getBlockState(bp).getBlock() == BlockInit.blockScreen.get());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -102,17 +103,17 @@ public abstract class Multiblock {
|
|||
for(int y = 0; y < size.y; y++) {
|
||||
for(int x = 0; x < size.x; x++) {
|
||||
pos.toBlock(bp);
|
||||
if(!(world.getBlockState(bp).getBlock() == WebDisplays.INSTANCE.blockScreen))
|
||||
if(!(world.getBlockState(bp).getBlock() == BlockInit.blockScreen.get()))
|
||||
return pos; //Hole
|
||||
|
||||
pos.add(side.forward);
|
||||
pos.toBlock(bp);
|
||||
if(world.getBlockState(bp).getBlock() == WebDisplays.INSTANCE.blockScreen)
|
||||
if(world.getBlockState(bp).getBlock() == BlockInit.blockScreen.get())
|
||||
return pos; //Back should be empty
|
||||
|
||||
pos.addMul(side.backward, 2);
|
||||
pos.toBlock(bp);
|
||||
if(world.getBlockState(bp).getBlock() == WebDisplays.INSTANCE.blockScreen)
|
||||
if(world.getBlockState(bp).getBlock() == BlockInit.blockScreen.get())
|
||||
return pos; //Front should be empty
|
||||
|
||||
pos.add(side.forward);
|
||||
|
|
@ -129,7 +130,7 @@ public abstract class Multiblock {
|
|||
|
||||
for(int y = 0; y < size.y; y++) {
|
||||
pos.toBlock(bp);
|
||||
if(world.getBlockState(bp).getBlock() == WebDisplays.INSTANCE.blockScreen)
|
||||
if(world.getBlockState(bp).getBlock() == BlockInit.blockScreen.get())
|
||||
return pos; //Left edge should be empty
|
||||
|
||||
pos.add(side.up);
|
||||
|
|
@ -141,7 +142,7 @@ public abstract class Multiblock {
|
|||
|
||||
for(int y = 0; y < size.y; y++) {
|
||||
pos.toBlock(bp);
|
||||
if(world.getBlockState(bp).getBlock() == WebDisplays.INSTANCE.blockScreen)
|
||||
if(world.getBlockState(bp).getBlock() == BlockInit.blockScreen.get())
|
||||
return pos; //Left edge should be empty
|
||||
|
||||
pos.add(side.up);
|
||||
|
|
@ -153,7 +154,7 @@ public abstract class Multiblock {
|
|||
|
||||
for(int x = 0; x < size.x; x++) {
|
||||
pos.toBlock(bp);
|
||||
if(world.getBlockState(bp).getBlock() == WebDisplays.INSTANCE.blockScreen)
|
||||
if(world.getBlockState(bp).getBlock() == BlockInit.blockScreen.get())
|
||||
return pos; //Left edge should be empty
|
||||
|
||||
pos.add(side.right);
|
||||
|
|
@ -165,7 +166,7 @@ public abstract class Multiblock {
|
|||
|
||||
for(int x = 0; x < size.x; x++) {
|
||||
pos.toBlock(bp);
|
||||
if(world.getBlockState(bp).getBlock() == WebDisplays.INSTANCE.blockScreen)
|
||||
if(world.getBlockState(bp).getBlock() == BlockInit.blockScreen.get())
|
||||
return pos; //Left edge should be empty
|
||||
|
||||
pos.add(side.right);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user