optimize minepad model and texture
This commit is contained in:
parent
7c89d3a9b8
commit
f9a7649b0e
|
|
@ -76,7 +76,7 @@ public class BlockServer extends WDBlockContainer{
|
|||
|
||||
if(te instanceof TileEntityServer) {
|
||||
((TileEntityServer) te).onPlayerRightClick(player);
|
||||
return InteractionResult.PASS;
|
||||
return InteractionResult.SUCCESS;
|
||||
} else
|
||||
return InteractionResult.FAIL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class GuiServer extends WDScreen {
|
|||
private final Vector3i serverPos;
|
||||
private final NameUUIDPair owner;
|
||||
private final ArrayList<String> lines = new ArrayList<>();
|
||||
private String prompt = "<";
|
||||
private String prompt = "";
|
||||
private String userPrompt;
|
||||
private int blinkTime;
|
||||
private String lastCmd;
|
||||
|
|
@ -87,7 +87,7 @@ public class GuiServer extends WDScreen {
|
|||
lines.add(tr("info"));
|
||||
uploadCD(FileSystemView.getFileSystemView().getDefaultDirectory());
|
||||
}
|
||||
|
||||
|
||||
private static String tr(String key, Object ... args) {
|
||||
return I18n.get("webdisplays.server." + key, args);
|
||||
}
|
||||
|
|
@ -118,8 +118,12 @@ public class GuiServer extends WDScreen {
|
|||
}
|
||||
|
||||
if(!promptLocked) {
|
||||
x = font.drawShadow(poseStack, userPrompt, x, y, 0xFFFFFFFF, false);
|
||||
x = font.drawShadow(poseStack, prompt, x, y, 0xFFFFFFFF, false);
|
||||
if (queue.isEmpty()) {
|
||||
x = font.drawShadow(poseStack, userPrompt, x, y, 0xFFFFFFFF, false);
|
||||
x = font.drawShadow(poseStack, prompt, x, y, 0xFFFFFFFF, false);
|
||||
} else {
|
||||
x = font.drawShadow(poseStack, "<Press DOWN to show more>", x, y, 0xFFFFFFFF, false);
|
||||
}
|
||||
}
|
||||
|
||||
if(!uploadWizard && blinkTime < 5)
|
||||
|
|
@ -198,6 +202,19 @@ public class GuiServer extends WDScreen {
|
|||
uploadFilter = "";
|
||||
}
|
||||
}
|
||||
|
||||
final int maxl = uploadWizard ? MAX_LINES : (MAX_LINES - 1); //Cuz prompt is hidden
|
||||
if (!queue.isEmpty()) {
|
||||
while (!queue.isEmpty()) {
|
||||
if (lines.size() >= maxl) {
|
||||
break;
|
||||
}
|
||||
writeLine(queue.remove(0));
|
||||
}
|
||||
}
|
||||
while (lines.size() > maxl) {
|
||||
lines.remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -205,7 +222,7 @@ public class GuiServer extends WDScreen {
|
|||
Supplier<Boolean> predicate = () -> super.keyReleased(keyCode, scanCode, modifiers);
|
||||
|
||||
try {
|
||||
return handleKeyboardInput(keyCode, true, predicate);
|
||||
return handleKeyboardInput(keyCode, false, predicate);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
|
|
@ -214,6 +231,11 @@ public class GuiServer extends WDScreen {
|
|||
|
||||
@Override
|
||||
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
||||
if (keyCode == GLFW.GLFW_KEY_ESCAPE) {
|
||||
Minecraft.getInstance().setScreen(null);
|
||||
return true;
|
||||
}
|
||||
|
||||
getChar(keyCode, scanCode).ifPresent(c -> {
|
||||
try {
|
||||
keyTyped(c, keyCode, modifiers);
|
||||
|
|
@ -231,6 +253,9 @@ public class GuiServer extends WDScreen {
|
|||
}
|
||||
|
||||
public boolean handleKeyboardInput(int keyCode, boolean keyState, Supplier<Boolean> booleanSupplier) throws IOException {
|
||||
if (!queue.isEmpty())
|
||||
return false;
|
||||
|
||||
if(uploadWizard) {
|
||||
if(keyState) {
|
||||
if(keyCode == GLFW.GLFW_KEY_UP) {
|
||||
|
|
@ -315,42 +340,51 @@ public class GuiServer extends WDScreen {
|
|||
|
||||
protected void keyTyped(char typedChar, int keyCode, int modifier) throws IOException {
|
||||
//this.charTyped(typedChar, modifier);
|
||||
|
||||
if(uploadWizard) {
|
||||
|
||||
if (keyCode == GLFW.GLFW_KEY_DOWN) {
|
||||
if (!queue.isEmpty()) {
|
||||
writeLine(queue.remove(0));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!queue.isEmpty())
|
||||
return;
|
||||
|
||||
if (uploadWizard) {
|
||||
boolean found = false;
|
||||
uploadFilter += Character.toLowerCase(typedChar);
|
||||
uploadFilterTime = System.currentTimeMillis();
|
||||
|
||||
for(int i = uploadFirstIsParent ? 1 : 0; i < uploadFiles.size(); i++) {
|
||||
if(uploadFiles.get(i).getName().toLowerCase().startsWith(uploadFilter)) {
|
||||
|
||||
for (int i = uploadFirstIsParent ? 1 : 0; i < uploadFiles.size(); i++) {
|
||||
if (uploadFiles.get(i).getName().toLowerCase().startsWith(uploadFilter)) {
|
||||
selectFile(i);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found && uploadFilter.length() == 1)
|
||||
|
||||
if (!found && uploadFilter.length() == 1)
|
||||
uploadFilter = "";
|
||||
|
||||
|
||||
return;
|
||||
} else if(promptLocked)
|
||||
} else if (promptLocked)
|
||||
return;
|
||||
|
||||
if(keyCode == GLFW.GLFW_KEY_BACKSPACE) {
|
||||
if(prompt.length() > 0)
|
||||
|
||||
if (keyCode == GLFW.GLFW_KEY_BACKSPACE) {
|
||||
if (prompt.length() > 0)
|
||||
prompt = prompt.substring(0, prompt.length() - 1);
|
||||
} else if(keyCode == GLFW.GLFW_KEY_ENTER || keyCode == GLFW.GLFW_KEY_KP_ENTER) {
|
||||
if(prompt.length() > 0) {
|
||||
} else if (keyCode == GLFW.GLFW_KEY_ENTER || keyCode == GLFW.GLFW_KEY_KP_ENTER) {
|
||||
if (prompt.length() > 0) {
|
||||
writeLine(userPrompt + prompt);
|
||||
evaluateCommand(prompt);
|
||||
lastCmd = prompt;
|
||||
prompt = "";
|
||||
} else
|
||||
writeLine(userPrompt);
|
||||
} else if(prompt.length() + 1 < MAX_LINE_LEN && typedChar >= 32 && typedChar <= 126)
|
||||
|
||||
} else if (prompt.length() + 1 < MAX_LINE_LEN && typedChar >= 32 && typedChar <= 126)
|
||||
|
||||
prompt = prompt + typedChar;
|
||||
|
||||
|
||||
blinkTime = 0;
|
||||
}
|
||||
|
||||
|
|
@ -453,16 +487,18 @@ public class GuiServer extends WDScreen {
|
|||
|
||||
@CommandHandler("help")
|
||||
public void commandHelp(String[] args) {
|
||||
queueRead = lines.size();
|
||||
|
||||
if(args.length > 0) {
|
||||
String cmd = args[0].toLowerCase();
|
||||
|
||||
if(COMMAND_MAP.containsKey(cmd))
|
||||
writeLine(tr("help." + cmd));
|
||||
queueLine(tr("help." + cmd));
|
||||
else
|
||||
writeLine(tr("unknowncmd"));
|
||||
queueLine(tr("unknowncmd"));
|
||||
} else {
|
||||
for(String c : COMMAND_MAP.keySet())
|
||||
writeLine(c + " - " + tr("help." + c));
|
||||
queueLine(c + " - " + tr("help." + c));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -744,5 +780,14 @@ public class GuiServer extends WDScreen {
|
|||
public String getWikiPageName() {
|
||||
return "Server";
|
||||
}
|
||||
|
||||
|
||||
int queueRead = 0;
|
||||
ArrayList<String> queue = new ArrayList<>();
|
||||
|
||||
private void queueLine(String line) {
|
||||
if (queueRead > 1) {
|
||||
writeLine(line);
|
||||
queueRead -= 1;
|
||||
} else queue.add(line);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public final class ModelMinePad {
|
|||
t.end();
|
||||
|
||||
int width = 32;
|
||||
int height = 16;
|
||||
int height = 32;
|
||||
|
||||
float padding = 1f / 23;
|
||||
float padding1 = 1f / 21;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import net.minecraftforge.registries.DeferredRegister;
|
|||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.montoyo.wd.block.*;
|
||||
import net.montoyo.wd.core.DefaultPeripheral;
|
||||
|
||||
public class BlockInit {
|
||||
|
||||
|
|
@ -18,14 +17,14 @@ public class BlockInit {
|
|||
|
||||
public static DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "webdisplays");
|
||||
|
||||
public static final RegistryObject<Block> blockScreen = BLOCKS.register("screen", () -> new BlockScreen(BlockBehaviour.Properties.of(Material.STONE)));
|
||||
public static final RegistryObject<BlockScreen> blockScreen = BLOCKS.register("screen", () -> new BlockScreen(BlockBehaviour.Properties.of(Material.STONE)));
|
||||
|
||||
public static final RegistryObject<Block> blockKeyBoard = BlockInit.BLOCKS.register("kb_left", BlockKeyboardLeft::new);
|
||||
public static final RegistryObject<Block> blockKbRight = BLOCKS.register("kb_right", BlockKeyboardRight::new);
|
||||
public static final RegistryObject<BlockKeyboardLeft> blockKeyBoard = BlockInit.BLOCKS.register("kb_left", BlockKeyboardLeft::new);
|
||||
public static final RegistryObject<BlockKeyboardRight> blockKbRight = BLOCKS.register("kb_right", BlockKeyboardRight::new);
|
||||
|
||||
public static final RegistryObject<Block> blockRedControl = BlockInit.BLOCKS.register("redctrl", BlockRedCTRL::new);
|
||||
public static final RegistryObject<BlockRedCTRL> blockRedControl = BlockInit.BLOCKS.register("redctrl", BlockRedCTRL::new);
|
||||
|
||||
public static final RegistryObject<Block> blockRControl = BlockInit.BLOCKS.register("rctrl", BlockRCTRL::new);
|
||||
public static final RegistryObject<BlockRCTRL> blockRControl = BlockInit.BLOCKS.register("rctrl", BlockRCTRL::new);
|
||||
|
||||
public static final RegistryObject<Block> blockServer = BlockInit.BLOCKS.register("server", BlockServer::new);
|
||||
public static final RegistryObject<BlockServer> blockServer = BlockInit.BLOCKS.register("server", BlockServer::new);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"credit":"Made with Blockbench","texture_size":[64,32],"textures":{"0":"webdisplays:models/minepad"},"elements":[{"from":[1,0,0],"to":[15,1,9],"rotation":{"angle":0,"axis":"y","origin":[1,0,3.5]},"faces":{"north":{"uv":[2.25,4.5,5.75,5],"texture":"#0"},"east":{"uv":[0,4.5,2.25,5],"texture":"#0"},"south":{"uv":[8,4.5,11.5,5],"texture":"#0"},"west":{"uv":[5.75,4.5,8,5],"texture":"#0"},"up":{"uv":[5.75,4.5,2.25,0],"texture":"#0"},"down":{"uv":[9.25,0,5.75,4.5],"texture":"#0"}}},{"from":[0,0,1],"to":[1,1,8],"rotation":{"angle":0,"axis":"y","origin":[0,0,4.5]},"faces":{"north":{"uv":[1.75,8.5,2,9],"texture":"#0"},"east":{"uv":[0,8.5,1.75,9],"texture":"#0"},"south":{"uv":[3.75,8.5,4,9],"texture":"#0"},"west":{"uv":[2,8.5,3.75,9],"texture":"#0"},"up":{"uv":[2,8.5,1.75,5],"texture":"#0"},"down":{"uv":[2.25,5,2,8.5],"texture":"#0"}}},{"from":[15,0,1],"to":[16,1,8],"rotation":{"angle":0,"axis":"y","origin":[15,0,4.5]},"faces":{"north":{"uv":[9.25,8.5,9.5,9],"texture":"#0"},"east":{"uv":[7.5,8.5,9.25,9],"texture":"#0"},"south":{"uv":[11.25,8.5,11.5,9],"texture":"#0"},"west":{"uv":[9.5,8.5,11.25,9],"texture":"#0"},"up":{"uv":[9.5,8.5,9.25,5],"texture":"#0"},"down":{"uv":[9.75,5,9.5,8.5],"texture":"#0"}}}],"display":{"thirdperson_righthand":{"rotation":[95.5,-180,0],"translation":[0,6.75,9]},"thirdperson_lefthand":{"rotation":[95.5,-180,0],"translation":[0,6.75,9]},"ground":{"rotation":[-90,0,0],"translation":[0,11.5,-7.6]},"gui":{"rotation":[90,0,0],"translation":[0,-3.5,0]},"head":{"rotation":[-90,0,0],"translation":[0,14.25,-0.75]},"fixed":{"rotation":[-90,0,0],"translation":[0,0,-7.5]}},"groups":[{"name":"bone","origin":[0,0,0],"color":0,"children":[0,1,2]}]}
|
||||
{"credit":"Made with Blockbench","texture_size":[32,16],"textures":{"1":"webdisplays:models/minepad","particle":"webdisplays:models/minepad"},"elements":[{"from":[1,0,0],"to":[15,1,9],"rotation":{"angle":0,"axis":"y","origin":[1,0,3.5]},"faces":{"north":{"uv":[0,9,7,10],"texture":"#1"},"east":{"uv":[13.5,0,14,9],"rotation":270,"texture":"#1"},"south":{"uv":[7,9,14,10],"texture":"#1"},"west":{"uv":[7,0,7.5,9],"rotation":90,"texture":"#1"},"up":{"uv":[7,9,0,0],"texture":"#1"},"down":{"uv":[13.5,0,7.5,9],"texture":"#1"}}},{"from":[15,0,1],"to":[16,1,8],"rotation":{"angle":0,"axis":"y","origin":[15,0,4.5]},"faces":{"north":{"uv":[8.5,13,8,14],"texture":"#1"},"east":{"uv":[9,12,5.5,11],"texture":"#1"},"south":{"uv":[9,13,8.5,14],"texture":"#1"},"up":{"uv":[9,11,5.5,10],"texture":"#1"},"down":{"uv":[9,13,5.5,12],"texture":"#1"}}},{"from":[0,0,1],"to":[1,1,8],"rotation":{"angle":0,"axis":"y","origin":[15,0,4.5]},"faces":{"north":{"uv":[5,13,4.5,14],"texture":"#1"},"south":{"uv":[5.5,13,5,14],"texture":"#1"},"west":{"uv":[5.5,12,2,11],"texture":"#1"},"up":{"uv":[5.5,11,2,10],"texture":"#1"},"down":{"uv":[5.5,13,2,12],"texture":"#1"}}}],"display":{"thirdperson_righthand":{"rotation":[95.5,-180,0],"translation":[0,6.75,9]},"thirdperson_lefthand":{"rotation":[95.5,-180,0],"translation":[0,6.75,9]},"ground":{"rotation":[-90,0,0],"translation":[0,11.5,-7.6]},"gui":{"rotation":[90,0,0],"translation":[0,-3.5,0]},"head":{"rotation":[-90,0,0],"translation":[0,14.25,-0.75]},"fixed":{"rotation":[-90,0,0],"translation":[0,0,-7.5]}},"groups":[{"name":"bone","origin":[0,0,0],"color":0,"children":[0,1,2]}]}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 341 B After Width: | Height: | Size: 255 B |
Binary file not shown.
|
Before Width: | Height: | Size: 123 B After Width: | Height: | Size: 290 B |
Loading…
Reference in New Issue
Block a user