push what I have so far
This commit is contained in:
parent
a4f0b2642c
commit
e7c8fcb0df
|
|
@ -66,8 +66,6 @@ public class WebDisplays {
|
|||
|
||||
public static final String MOD_VERSION = "1.1";
|
||||
|
||||
public static WebDisplays INSTANCE;
|
||||
|
||||
public static SharedProxy PROXY = DistExecutor.<SharedProxy>runForDist(() -> ClientProxy::new, () -> SharedProxy::new);
|
||||
|
||||
public static WDCreativeTab CREATIVE_TAB;
|
||||
|
|
@ -235,6 +233,16 @@ public class WebDisplays {
|
|||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldLeave(WorldEvent.Unload ev) throws IOException {
|
||||
if(ev.getWorld() instanceof Level level) {
|
||||
if (ev.getWorld().isClientSide() || level.dimension() != Level.OVERWORLD)
|
||||
return;
|
||||
Server sw = Server.getInstance();
|
||||
sw.stopServer();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldSave(WorldEvent.Save ev) {
|
||||
if(ev.getWorld() instanceof Level level) {
|
||||
|
|
@ -286,7 +294,7 @@ public class WebDisplays {
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onServerStop(ServerStoppingEvent ev) {
|
||||
public static void onServerStop(ServerStoppingEvent ev) throws IOException {
|
||||
Server.getInstance().stopServer();
|
||||
}
|
||||
|
||||
|
|
@ -380,7 +388,7 @@ public class WebDisplays {
|
|||
}
|
||||
|
||||
public static int getNextAvailablePadID() {
|
||||
return INSTANCE.lastPadId++;
|
||||
return new WebDisplays().lastPadId++;
|
||||
}
|
||||
|
||||
private static SoundEvent registerSound(RegistryEvent.Register<SoundEvent> ev, String resName) {
|
||||
|
|
@ -397,18 +405,18 @@ public class WebDisplays {
|
|||
CriteriaTriggers.register(c);
|
||||
}
|
||||
|
||||
public static boolean isOpenComputersAvailable() {
|
||||
return INSTANCE.hasOC;
|
||||
}
|
||||
// public static boolean isOpenComputersAvailable() {
|
||||
// return INSTANCE.hasOC;
|
||||
// }
|
||||
|
||||
public static boolean isComputerCraftAvailable() {
|
||||
return INSTANCE.hasCC;
|
||||
}
|
||||
// public static boolean isComputerCraftAvailable() {
|
||||
// return INSTANCE.hasCC;
|
||||
// }
|
||||
|
||||
public static boolean isSiteBlacklisted(String url) {
|
||||
try {
|
||||
URL url2 = new URL(Util.addProtocol(url));
|
||||
return INSTANCE.blacklist.stream().anyMatch(str -> str.equalsIgnoreCase(url2.getHost()));
|
||||
return new ModConfig.Main().blacklist.stream().anyMatch(str -> str.equalsIgnoreCase(url2.getHost()));
|
||||
} catch(MalformedURLException ex) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import net.minecraft.world.level.material.FluidState;
|
|||
import net.minecraft.world.level.material.PushReaction;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.montoyo.wd.WebDisplays;
|
||||
import net.montoyo.wd.config.ModConfig;
|
||||
import net.montoyo.wd.core.DefaultUpgrade;
|
||||
import net.montoyo.wd.core.IUpgrade;
|
||||
import net.montoyo.wd.core.ScreenRights;
|
||||
|
|
@ -165,7 +166,7 @@ public class BlockScreen extends Block {
|
|||
|
||||
Util.toast(player, ChatFormatting.AQUA, "upgradeOk");
|
||||
if(player instanceof ServerPlayer)
|
||||
WebDisplays.INSTANCE.criterionUpgradeScreen.trigger(((ServerPlayer) player).getAdvancements());
|
||||
new WebDisplays().criterionUpgradeScreen.trigger(((ServerPlayer) player).getAdvancements());
|
||||
} else
|
||||
Util.toast(player, "upgradeError");
|
||||
|
||||
|
|
@ -193,8 +194,8 @@ public class BlockScreen extends Block {
|
|||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
if(size.x > WebDisplays.INSTANCE.maxScreenX || size.y > WebDisplays.INSTANCE.maxScreenY) {
|
||||
Util.toast(player, "tooBig", WebDisplays.INSTANCE.maxScreenX, WebDisplays.INSTANCE.maxScreenY);
|
||||
if(size.x > new WebDisplays().maxScreenX || size.y > new WebDisplays().maxScreenY) {
|
||||
Util.toast(player, "tooBig", new WebDisplays().maxScreenX, new WebDisplays().maxScreenY);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.inventory.ContainerScreen;
|
||||
import net.minecraft.client.multiplayer.ClientAdvancements;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
|
@ -30,24 +34,28 @@ import net.minecraft.world.item.Item;
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.model.IModelLoader;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.montoyo.mcef.api.*;
|
||||
import net.montoyo.wd.SharedProxy;
|
||||
import net.montoyo.wd.WebDisplays;
|
||||
import net.montoyo.wd.block.BlockScreen;
|
||||
import net.montoyo.wd.client.gui.*;
|
||||
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.*;
|
||||
import net.montoyo.wd.core.DefaultUpgrade;
|
||||
import net.montoyo.wd.core.HasAdvancement;
|
||||
import net.montoyo.wd.core.JSServerRequest;
|
||||
|
|
@ -55,6 +63,7 @@ import net.montoyo.wd.data.GuiData;
|
|||
import net.montoyo.wd.entity.TileEntityScreen;
|
||||
import net.montoyo.wd.init.BlockInit;
|
||||
import net.montoyo.wd.init.ItemInit;
|
||||
import net.montoyo.wd.init.TileInit;
|
||||
import net.montoyo.wd.item.WDItem;
|
||||
import net.montoyo.wd.miniserv.client.Client;
|
||||
import net.montoyo.wd.net.Messages;
|
||||
|
|
@ -69,6 +78,7 @@ import java.net.InetSocketAddress;
|
|||
import java.net.SocketAddress;
|
||||
import java.util.*;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = "webdisplays", value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQueryHandler, ResourceManagerReloadListener {
|
||||
|
||||
public class PadData {
|
||||
|
|
@ -80,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) WebDisplays.INSTANCE.padResX, (int) WebDisplays.INSTANCE.padResY);
|
||||
view.resize((int) new WebDisplays().padResX, (int) new WebDisplays().padResY);
|
||||
isInHotbar = true;
|
||||
this.id = id;
|
||||
}
|
||||
|
|
@ -120,13 +130,15 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer
|
|||
private int minePadTickCounter = 0;
|
||||
|
||||
/**************************************** INHERITED METHODS ****************************************/
|
||||
@SubscribeEvent
|
||||
public static void onClientSetup(FMLClientSetupEvent event) {
|
||||
BlockEntityRenderers.register(TileInit.SCREEN_BLOCK_ENTITY.get(), new ScreenRenderer.ScreenRendererProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
mc = Minecraft.getInstance();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
// registerCustomBlockBaker(new ScreenBaker(), WebDisplays.INSTANCE.blockScreen);
|
||||
|
||||
mcef = MCEFApi.getAPI();
|
||||
if(mcef != null)
|
||||
mcef.registerScheme("wd", WDScheme.class, true, false, false, true, true, false, false);
|
||||
|
|
@ -134,7 +146,6 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer
|
|||
|
||||
@Override
|
||||
public void init() {
|
||||
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntityScreen.class, new ScreenRenderer());
|
||||
jsDispatcher = new JSQueryDispatcher(this);
|
||||
minePadRenderer = new MinePadRenderer();
|
||||
laserPointerRenderer = new LaserPointerRenderer();
|
||||
|
|
@ -476,7 +487,7 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer
|
|||
|
||||
@SubscribeEvent
|
||||
public void onRegisterModels(ModelRegistryEvent ev) {
|
||||
final WebDisplays wd = WebDisplays.INSTANCE;
|
||||
final WebDisplays wd = new WebDisplays();
|
||||
|
||||
//I hope I'm doing this right because it doesn't seem like it...
|
||||
// registerItemModel(wd.blockScreen.getItem(), 0, "inventory");
|
||||
|
|
@ -536,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 > WebDisplays.INSTANCE.unloadDistance2)
|
||||
if(dist2 > new WebDisplays().unloadDistance2)
|
||||
tes.unload();
|
||||
//else if(WebDisplays.INSTANCE.enableSoundDistance)
|
||||
// tes.updateTrackDistance(dist2, SoundSystemConfig.getMasterGain());
|
||||
} else if(dist2 <= WebDisplays.INSTANCE.loadDistance2)
|
||||
} else if(dist2 <= new WebDisplays().loadDistance2)
|
||||
tes.load();
|
||||
}
|
||||
|
||||
|
|
@ -691,10 +702,10 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer
|
|||
}
|
||||
|
||||
private void updateInventory(NonNullList<ItemStack> inv, ItemStack heldStack, int cnt) {
|
||||
for(int i = 0; i < cnt; i++) {
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
ItemStack item = inv.get(i);
|
||||
|
||||
if(ItemInit.itemMinePad.isPresent()) {
|
||||
if (ItemInit.itemMinePad.isPresent()) {
|
||||
if (item.getItem() == ItemInit.itemMinePad.get()) {
|
||||
CompoundTag tag = item.getTag();
|
||||
|
||||
|
|
@ -705,24 +716,6 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer
|
|||
}
|
||||
}
|
||||
|
||||
// private void registerCustomBlockBaker(IModelBaker baker, Block block0) {
|
||||
// ModelResourceLocation normalLoc = new ModelResourceLocation(block0.getRegistryName(), "normal");
|
||||
// ResourceModelPair pair = new ResourceModelPair(normalLoc, baker);
|
||||
// modelBakers.add(pair);
|
||||
// ModelLoader.setCustomStateMapper(block0, new StaticStateMapper(normalLoc));
|
||||
// }
|
||||
//
|
||||
// private void registerItemModel(Item item, int meta, String variant) {
|
||||
// ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), variant));
|
||||
// }
|
||||
//
|
||||
// private void registerItemMultiModels(ItemMulti item) {
|
||||
// Enum[] values = item.getEnumValues();
|
||||
//
|
||||
// for(int i = 0; i < values.length; i++)
|
||||
// ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(item.getRegistryName().toString() + '_' + values[i], "normal"));
|
||||
// }
|
||||
|
||||
private void updatePad(int id, CompoundTag tag, boolean isSelected) {
|
||||
PadData pd = padMap.get(id);
|
||||
|
||||
|
|
|
|||
|
|
@ -143,8 +143,8 @@ public class GuiMinePad extends WDScreen {
|
|||
sy = vh - sy;
|
||||
|
||||
//Scale again according to the webview
|
||||
sx = (int) (((double) sx) / ((double) vw) * WebDisplays.INSTANCE.padResX);
|
||||
sy = (int) (((double) sy) / ((double) vh) * WebDisplays.INSTANCE.padResY);
|
||||
sx = (int) (((double) sx) / ((double) vw) * new WebDisplays().padResX);
|
||||
sy = (int) (((double) sy) / ((double) vh) * new WebDisplays().padResY);
|
||||
|
||||
if (btn == -1)
|
||||
pad.view.injectMouseMove(sx, sy, 0, false);
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ public class GuiScreenConfig extends WDScreen {
|
|||
updateMyRights();
|
||||
updateRotationStr();
|
||||
|
||||
minecraft.getSoundManager().play(SimpleSoundInstance.forUI(WebDisplays.INSTANCE.soundScreenCfg, 1.0f, 1.0f));
|
||||
minecraft.getSoundManager().play(SimpleSoundInstance.forUI( new WebDisplays().soundScreenCfg, 1.0f, 1.0f));
|
||||
}
|
||||
|
||||
private void updateRotationStr() {
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ public class GuiServer extends WDScreen {
|
|||
accessTime = 20;
|
||||
} else {
|
||||
if(accessSound == null) {
|
||||
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);
|
||||
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);
|
||||
minecraft.getSoundManager().play(accessSound);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public final class LaserPointerRenderer implements IItemRenderer {
|
|||
RenderSystem.disableCull();
|
||||
RenderSystem.disableTexture();
|
||||
|
||||
poseStack.pushPose();
|
||||
//Laser pointer
|
||||
glPushMatrix();
|
||||
glTranslatef(handSideSign * -0.4f * sinSqrtSwingProg1, (float) (0.2f * Math.sin(sqrtSwingProg * PI * 2.0f)), (float) (-0.2f * Math.sin(swingProgress * PI)));
|
||||
|
|
@ -87,13 +88,15 @@ public final class LaserPointerRenderer implements IItemRenderer {
|
|||
}
|
||||
|
||||
glPopMatrix();
|
||||
poseStack.popPose();
|
||||
|
||||
if(isOn) {
|
||||
poseStack.pushPose();
|
||||
//Actual laser
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.DST_ALPHA);
|
||||
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.DST_ALPHA);
|
||||
glColor4f(1.0f, 0.0f, 0.0f, 0.5f);
|
||||
RenderSystem.lineWidth(3.0f);
|
||||
|
||||
|
|
@ -108,6 +111,7 @@ public final class LaserPointerRenderer implements IItemRenderer {
|
|||
glDrawArrays(GL_LINES, 0, 2);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glPopMatrix();
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
RenderSystem.enableTexture(); //Fix for shitty minecraft fire
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
|||
import com.mojang.blaze3d.vertex.*;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.montoyo.wd.WebDisplays;
|
||||
import net.montoyo.wd.client.ClientProxy;
|
||||
|
|
@ -21,6 +22,13 @@ import static org.lwjgl.opengl.GL11.*;
|
|||
|
||||
public class ScreenRenderer implements BlockEntityRenderer<TileEntityScreen> {
|
||||
|
||||
public static class ScreenRendererProvider implements BlockEntityRendererProvider<TileEntityScreen> {
|
||||
@Override
|
||||
public @NotNull BlockEntityRenderer<TileEntityScreen> create(@NotNull Context arg) {
|
||||
return new ScreenRenderer();
|
||||
}
|
||||
}
|
||||
|
||||
private final Vector3f mid = new Vector3f();
|
||||
private final Vector3i tmpi = new Vector3i();
|
||||
private final Vector3f tmpf = new Vector3f();
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class TileEntityKeyboard extends TileEntityPeripheralBase {
|
|||
|
||||
Player owner = level.getPlayerByUUID(scr.owner.uuid);
|
||||
if(owner != null && owner instanceof ServerPlayer && ent instanceof Ocelot)
|
||||
WebDisplays.INSTANCE.criterionKeyboardCat.trigger(((ServerPlayer) owner).getAdvancements());
|
||||
new WebDisplays().criterionKeyboardCat.trigger(((ServerPlayer) owner).getAdvancements());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,16 +203,16 @@ public class TileEntityScreen extends BlockEntity{
|
|||
|
||||
|
||||
public void clampResolution() {
|
||||
if(resolution.x > WebDisplays.INSTANCE.maxResX) {
|
||||
float newY = ((float) resolution.y) * ((float) WebDisplays.INSTANCE.maxResX) / ((float) resolution.x);
|
||||
resolution.x = WebDisplays.INSTANCE.maxResX;
|
||||
if(resolution.x > new WebDisplays().maxResX) {
|
||||
float newY = ((float) resolution.y) * ((float) new WebDisplays().maxResX) / ((float) resolution.x);
|
||||
resolution.x = new WebDisplays().maxResX;
|
||||
resolution.y = (int) newY;
|
||||
}
|
||||
|
||||
if(resolution.y > WebDisplays.INSTANCE.maxResY) {
|
||||
float newX = ((float) resolution.x) * ((float) WebDisplays.INSTANCE.maxResY) / ((float) resolution.y);
|
||||
if(resolution.y > new WebDisplays().maxResY) {
|
||||
float newX = ((float) resolution.x) * ((float) new WebDisplays().maxResY) / ((float) resolution.y);
|
||||
resolution.x = (int) newX;
|
||||
resolution.y = WebDisplays.INSTANCE.maxResY;
|
||||
resolution.y = new WebDisplays().maxResY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -289,7 +289,7 @@ public class TileEntityScreen extends BlockEntity{
|
|||
Screen ret = new Screen();
|
||||
ret.side = side;
|
||||
ret.size = size;
|
||||
ret.url = WebDisplays.INSTANCE.homePage;
|
||||
ret.url = new WebDisplays().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 = WebDisplays.INSTANCE;
|
||||
final WebDisplays wd = new WebDisplays();
|
||||
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(WebDisplays.INSTANCE.soundTyping, soundPos, 0.25f, 1.f);
|
||||
playSoundAt( new WebDisplays().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(WebDisplays.INSTANCE.soundUpgradeAdd, getBlockPos(), 1.0f, 1.0f);
|
||||
playSoundAt(new WebDisplays().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(WebDisplays.INSTANCE.soundUpgradeDel, getBlockPos(), 1.0f, 1.0f);
|
||||
playSoundAt(new WebDisplays().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());
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class TileEntityServer extends BlockEntity {
|
|||
if(level.isClientSide)
|
||||
return;
|
||||
|
||||
if(WebDisplays.INSTANCE.miniservPort == 0)
|
||||
if( new WebDisplays().miniservPort == 0)
|
||||
Util.toast(ply, "noMiniserv");
|
||||
else if(owner != null && ply instanceof ServerPlayer)
|
||||
(new ServerData(getBlockPos(), owner)).sendTo((ServerPlayer) ply);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class ItemLinker extends Item implements WDItem {
|
|||
Util.toast(context.getPlayer(), ChatFormatting.AQUA, "linked");
|
||||
|
||||
if(context.getPlayer() instanceof ServerPlayer)
|
||||
WebDisplays.INSTANCE.criterionLinkPeripheral.trigger(((ServerPlayer) context.getPlayer()).getAdvancements());
|
||||
new WebDisplays().criterionLinkPeripheral.trigger(((ServerPlayer) context.getPlayer()).getAdvancements());
|
||||
} else
|
||||
Util.toast(context.getPlayer(), "linkError");
|
||||
|
||||
|
|
|
|||
|
|
@ -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 WebDisplays.INSTANCE.homePage;
|
||||
return new WebDisplays().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)
|
||||
WebDisplays.INSTANCE.criterionPadBreak.trigger(((ServerPlayer) ply).getAdvancements());
|
||||
new WebDisplays().criterionPadBreak.trigger(((ServerPlayer) ply).getAdvancements());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class ItemOwnershipThief extends Item implements WDItem {
|
|||
if(context.getLevel().isClientSide)
|
||||
return InteractionResult.SUCCESS;
|
||||
|
||||
if(WebDisplays.INSTANCE.disableOwnershipThief) {
|
||||
if( new WebDisplays().disableOwnershipThief) {
|
||||
Util.toast(context.getPlayer(), "otDisabled");
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import net.montoyo.wd.utilities.Log;
|
|||
import net.montoyo.wd.utilities.Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.SelectionKey;
|
||||
|
|
@ -79,13 +80,14 @@ public class Server implements Runnable {
|
|||
thread.start();
|
||||
}
|
||||
|
||||
public void stopServer() {
|
||||
public void stopServer() throws IOException {
|
||||
if(getRunning()) {
|
||||
Thread thread = this.thread;
|
||||
|
||||
synchronized(this) {
|
||||
running = false;
|
||||
selector.wakeup();
|
||||
server.close();
|
||||
}
|
||||
|
||||
while(thread.isAlive()) {
|
||||
|
|
@ -234,7 +236,7 @@ public class Server implements Runnable {
|
|||
}
|
||||
|
||||
public long getMaxQuota() {
|
||||
return WebDisplays.INSTANCE.miniservQuota;
|
||||
return new WebDisplays().miniservQuota;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,29 @@
|
|||
"forge_marker": 1,
|
||||
"uvlock": false,
|
||||
"variants": {
|
||||
"normal": { "model": "webdisplays:block/screen" },
|
||||
"inventory": { "model": "webdisplays:block/screen_item" }
|
||||
"emitting=true,facing=north,haste=true" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=true,facing=south,haste=true" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=true,facing=east,haste=true" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=true,facing=west,haste=true" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=true,facing=up,haste=true" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=true,facing=down,haste=true" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=false,facing=north,haste=true" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=false,facing=south,haste=true" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=false,facing=east,haste=true" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=false,facing=west,haste=true" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=false,facing=up,haste=true" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=false,facing=down,haste=true" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=true,facing=north,haste=false" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=true,facing=south,haste=false" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=true,facing=east,haste=false" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=true,facing=west,haste=false" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=true,facing=up,haste=false" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=true,facing=down,haste=false" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=false,facing=north,haste=false" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=false,facing=south,haste=false" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=false,facing=east,haste=false" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=false,facing=west,haste=false" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=false,facing=up,haste=false" : { "model": "webdisplays:block/screen" },
|
||||
"emitting=false,facing=down,haste=false" : { "model": "webdisplays:block/screen" }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user