+ Added screen size limit

* Changed screen recipe: screens are a bit more expensive now
* Fixed wrong dropped/picked item for peripheral block
* Fixed wrong default state for screen block
* Updated README
This commit is contained in:
Nicolas BARBOTIN 2018-02-11 23:42:39 +01:00
parent e11bfed9fd
commit c266b6c1f4
8 changed files with 20 additions and 6 deletions

View File

@ -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. This is the unfinished port of the WebDisplays mod for Minecraft 1.12.2. The text below is my "TODO" list.
### Bugs to fix ### Bugs to fix
* Middle-click bug
* Limit screen size
* Bugged friend list * 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?!?) * Memory leak (screens aren't deleted?!?)
* GUIs are not closed blocks gets destroyed * GUIs are not closed blocks gets destroyed

View File

@ -110,6 +110,8 @@ public class WebDisplays {
public double loadDistance2; public double loadDistance2;
public int maxResX; public int maxResX;
public int maxResY; public int maxResY;
public int maxScreenX;
public int maxScreenY;
public int miniservPort; public int miniservPort;
public long miniservQuota; public long miniservQuota;
@ -127,6 +129,8 @@ public class WebDisplays {
Property maxResY = cfg.get("main", "maxResolutionY", 1080); Property maxResY = cfg.get("main", "maxResolutionY", 1080);
Property miniservPort = cfg.get("main", "miniservPort", 25566); Property miniservPort = cfg.get("main", "miniservPort", 25566);
Property miniservQuota = cfg.get("main", "miniservQuota", 1024); //It's stored as a string anyway 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 loadDistance = cfg.get("client", "loadDistance", 30.0);
Property unloadDistance = cfg.get("client", "unloadDistance", 32.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.setComment("The port used by miniserv. 0 to disable.");
miniservPort.setMaxValue(Short.MAX_VALUE); miniservPort.setMaxValue(Short.MAX_VALUE);
miniservQuota.setComment("The amount of data that can be uploaded to miniserv, in KiB (so 1024 = 1 MiO)"); 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) if(unloadDistance.getDouble() < loadDistance.getDouble() + 2.0)
unloadDistance.set(loadDistance.getDouble() + 2.0); unloadDistance.set(loadDistance.getDouble() + 2.0);
@ -158,6 +164,8 @@ public class WebDisplays {
this.maxResY = maxResY.getInt(); this.maxResY = maxResY.getInt();
this.miniservPort = miniservPort.getInt(); this.miniservPort = miniservPort.getInt();
this.miniservQuota = miniservQuota.getLong() * 1024L; this.miniservQuota = miniservQuota.getLong() * 1024L;
this.maxScreenX = maxScreenX.getInt();
this.maxScreenY = maxScreenY.getInt();
CREATIVE_TAB = new WDCreativeTab(); CREATIVE_TAB = new WDCreativeTab();

View File

@ -122,7 +122,7 @@ public class BlockPeripheral extends WDBlockContainer {
@Override @Override
public int damageDropped(IBlockState state) { public int damageDropped(IBlockState state) {
return state.getValue(type).ordinal(); return state.getValue(type).toMetadata(0);
} }
@Override @Override

View File

@ -62,6 +62,7 @@ public class BlockScreen extends WDBlockContainer {
setResistance(10.f); setResistance(10.f);
setCreativeTab(WebDisplays.CREATIVE_TAB); setCreativeTab(WebDisplays.CREATIVE_TAB);
setName("screen"); setName("screen");
setDefaultState(blockState.getBaseState().withProperty(hasTE, false).withProperty(emitting, false));
} }
@Override @Override
@ -185,6 +186,11 @@ public class BlockScreen extends WDBlockContainer {
return true; 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); Vector3i err = Multiblock.check(world, pos, size, side);
if(err != null) { if(err != null) {
Util.toast(player, "invalid", err.toString()); Util.toast(player, "invalid", err.toString());

View File

@ -182,7 +182,7 @@ public class ClientProxy extends SharedProxy implements IResourceManagerReloadLi
if(track) { if(track) {
if(idx < 0) if(idx < 0)
screenTracking.add(tes); screenTracking.add(tes);
} else } else if(idx >= 0)
screenTracking.remove(idx); screenTracking.remove(idx);
} }

View File

@ -33,6 +33,7 @@ item.webdisplays.advicon.wd.name=WebDisplays
item.webdisplays.advicon.brokenpad.name=Broken minePad item.webdisplays.advicon.brokenpad.name=Broken minePad
item.webdisplays.advicon.pigeon.name=Pigeon item.webdisplays.advicon.pigeon.name=Pigeon
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.invalid=Structure is invalid; look at %s. webdisplays.message.invalid=Structure is invalid; look at %s.
webdisplays.message.turnOn=You need to turn the screen on first! webdisplays.message.turnOn=You need to turn the screen on first!
webdisplays.message.screenSet=Screen set! Now give the item to the new owner... webdisplays.message.screenSet=Screen set! Now give the item to the new owner...

View File

@ -33,6 +33,7 @@ item.webdisplays.advicon.wd.name=WebDisplays
item.webdisplays.advicon.brokenpad.name=minePad cassé item.webdisplays.advicon.brokenpad.name=minePad cassé
item.webdisplays.advicon.pigeon.name=Pigeon item.webdisplays.advicon.pigeon.name=Pigeon
webdisplays.message.tooSmall=Trop petit ! La taille minimale est de 2x2. 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.invalid=La structure est invalide; regardez vers %s.
webdisplays.message.turnOn=Vous devez d'abord allumer l'écran webdisplays.message.turnOn=Vous devez d'abord allumer l'écran
webdisplays.message.screenSet=Ecran sélectionné ! Donnez l'item à quelqu'un... webdisplays.message.screenSet=Ecran sélectionné ! Donnez l'item à quelqu'un...

View File

@ -28,6 +28,6 @@
}, },
"result": { "result": {
"item": "webdisplays:screen", "item": "webdisplays:screen",
"count": 16 "count": 8
} }
} }