diff --git a/README.md b/README.md index 66d3086..4a8a3cf 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,8 @@ This is the unfinished port of the WebDisplays mod for Minecraft 1.12.2. The text below is my "TODO" list. ### Bugs to fix -* Middle-click bug -* Limit screen size * Bugged friend list -* Multiply volume by game volume +* Multiply volume by game volume (and add a config option to disable distance<->volume thingy) * Memory leak (screens aren't deleted?!?) * GUIs are not closed blocks gets destroyed diff --git a/src/main/java/net/montoyo/wd/WebDisplays.java b/src/main/java/net/montoyo/wd/WebDisplays.java index cb22c6e..f243c7b 100644 --- a/src/main/java/net/montoyo/wd/WebDisplays.java +++ b/src/main/java/net/montoyo/wd/WebDisplays.java @@ -110,6 +110,8 @@ public class WebDisplays { public double loadDistance2; public int maxResX; public int maxResY; + public int maxScreenX; + public int maxScreenY; public int miniservPort; public long miniservQuota; @@ -127,6 +129,8 @@ public class WebDisplays { Property maxResY = cfg.get("main", "maxResolutionY", 1080); Property miniservPort = cfg.get("main", "miniservPort", 25566); Property miniservQuota = cfg.get("main", "miniservQuota", 1024); //It's stored as a string anyway + Property maxScreenX = cfg.get("main", "maxScreenSizeX", 16); + Property maxScreenY = cfg.get("main", "maxScreenSizeY", 16); Property loadDistance = cfg.get("client", "loadDistance", 30.0); Property unloadDistance = cfg.get("client", "unloadDistance", 32.0); @@ -142,6 +146,8 @@ public class WebDisplays { miniservPort.setComment("The port used by miniserv. 0 to disable."); miniservPort.setMaxValue(Short.MAX_VALUE); miniservQuota.setComment("The amount of data that can be uploaded to miniserv, in KiB (so 1024 = 1 MiO)"); + maxScreenX.setComment("Maximum screen width, in blocks. Resolution will be clamped by maxResolutionX."); + maxScreenY.setComment("Maximum screen height, in blocks. Resolution will be clamped by maxResolutionY."); if(unloadDistance.getDouble() < loadDistance.getDouble() + 2.0) unloadDistance.set(loadDistance.getDouble() + 2.0); @@ -158,6 +164,8 @@ public class WebDisplays { this.maxResY = maxResY.getInt(); this.miniservPort = miniservPort.getInt(); this.miniservQuota = miniservQuota.getLong() * 1024L; + this.maxScreenX = maxScreenX.getInt(); + this.maxScreenY = maxScreenY.getInt(); CREATIVE_TAB = new WDCreativeTab(); diff --git a/src/main/java/net/montoyo/wd/block/BlockPeripheral.java b/src/main/java/net/montoyo/wd/block/BlockPeripheral.java index 239e9b4..28e14b7 100644 --- a/src/main/java/net/montoyo/wd/block/BlockPeripheral.java +++ b/src/main/java/net/montoyo/wd/block/BlockPeripheral.java @@ -122,7 +122,7 @@ public class BlockPeripheral extends WDBlockContainer { @Override public int damageDropped(IBlockState state) { - return state.getValue(type).ordinal(); + return state.getValue(type).toMetadata(0); } @Override diff --git a/src/main/java/net/montoyo/wd/block/BlockScreen.java b/src/main/java/net/montoyo/wd/block/BlockScreen.java index 87cac9d..230dd26 100644 --- a/src/main/java/net/montoyo/wd/block/BlockScreen.java +++ b/src/main/java/net/montoyo/wd/block/BlockScreen.java @@ -62,6 +62,7 @@ public class BlockScreen extends WDBlockContainer { setResistance(10.f); setCreativeTab(WebDisplays.CREATIVE_TAB); setName("screen"); + setDefaultState(blockState.getBaseState().withProperty(hasTE, false).withProperty(emitting, false)); } @Override @@ -185,6 +186,11 @@ public class BlockScreen extends WDBlockContainer { return true; } + if(size.x > WebDisplays.INSTANCE.maxScreenX || size.y > WebDisplays.INSTANCE.maxScreenY) { + Util.toast(player, "tooBig", WebDisplays.INSTANCE.maxScreenX, WebDisplays.INSTANCE.maxScreenY); + return true; + } + Vector3i err = Multiblock.check(world, pos, size, side); if(err != null) { Util.toast(player, "invalid", err.toString()); diff --git a/src/main/java/net/montoyo/wd/client/ClientProxy.java b/src/main/java/net/montoyo/wd/client/ClientProxy.java index 2ef4dff..0fb90aa 100644 --- a/src/main/java/net/montoyo/wd/client/ClientProxy.java +++ b/src/main/java/net/montoyo/wd/client/ClientProxy.java @@ -182,7 +182,7 @@ public class ClientProxy extends SharedProxy implements IResourceManagerReloadLi if(track) { if(idx < 0) screenTracking.add(tes); - } else + } else if(idx >= 0) screenTracking.remove(idx); } diff --git a/src/main/resources/assets/webdisplays/lang/en_us.lang b/src/main/resources/assets/webdisplays/lang/en_us.lang index be9c912..06057cd 100644 --- a/src/main/resources/assets/webdisplays/lang/en_us.lang +++ b/src/main/resources/assets/webdisplays/lang/en_us.lang @@ -33,6 +33,7 @@ item.webdisplays.advicon.wd.name=WebDisplays item.webdisplays.advicon.brokenpad.name=Broken minePad item.webdisplays.advicon.pigeon.name=Pigeon webdisplays.message.tooSmall=Too small! Minimum size is 2x2. +webdisplays.message.tooBig=Too big! Maximum size is %dx%d. webdisplays.message.invalid=Structure is invalid; look at %s. webdisplays.message.turnOn=You need to turn the screen on first! webdisplays.message.screenSet=Screen set! Now give the item to the new owner... diff --git a/src/main/resources/assets/webdisplays/lang/fr_fr.lang b/src/main/resources/assets/webdisplays/lang/fr_fr.lang index f914432..4c0da48 100644 --- a/src/main/resources/assets/webdisplays/lang/fr_fr.lang +++ b/src/main/resources/assets/webdisplays/lang/fr_fr.lang @@ -33,6 +33,7 @@ item.webdisplays.advicon.wd.name=WebDisplays item.webdisplays.advicon.brokenpad.name=minePad cassé item.webdisplays.advicon.pigeon.name=Pigeon webdisplays.message.tooSmall=Trop petit ! La taille minimale est de 2x2. +webdisplays.message.tooBig=Trop grand ! La taille maximale est de %dx%d. webdisplays.message.invalid=La structure est invalide; regardez vers %s. webdisplays.message.turnOn=Vous devez d'abord allumer l'écran webdisplays.message.screenSet=Ecran sélectionné ! Donnez l'item à quelqu'un... diff --git a/src/main/resources/assets/webdisplays/recipes/screen.json b/src/main/resources/assets/webdisplays/recipes/screen.json index f895dac..53373cf 100644 --- a/src/main/resources/assets/webdisplays/recipes/screen.json +++ b/src/main/resources/assets/webdisplays/recipes/screen.json @@ -28,6 +28,6 @@ }, "result": { "item": "webdisplays:screen", - "count": 16 + "count": 8 } }