Merge branch 'mc1.15/dev' of https://github.com/Creators-of-Create/Create into mc1.15/dev

This commit is contained in:
simibubi 2020-07-02 17:25:37 +02:00
commit 9e9dd8b507
10 changed files with 222 additions and 26 deletions

View file

@ -336,16 +336,16 @@ c77b46d8b459e5c7cc495393546f3fcca8a1fa1d assets\create\blockstates\weathered_lim
7f39521b211441f5c3e06d60c5978cebe16cacfb assets\create\blockstates\zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets\create\blockstates\zinc_ore.json
d6d4eaadc6f2c86dd69b8a818ca7352b85be52cd assets\create\lang\en_ud.json
56b1f1f0d28a4523ae1e2e57be7d58716edb54bf assets\create\lang\en_us.json
eceeb85745ce5b39d3fb0ab594641e7297e3dcee assets\create\lang\unfinished\de_de.json
514032f2f67fb4b4eeed311c9c3b7d0e36c31436 assets\create\lang\unfinished\fr_fr.json
1b4661d0e99bc26061b53817e5ad8c6a440d4b6a assets\create\lang\unfinished\it_it.json
2e7d9659f699f3c3bb4740c354dd4286ee2179cc assets\create\lang\unfinished\ja_jp.json
dfa78c83916cbd277ecdfb1783041470556d8399 assets\create\lang\unfinished\ko_kr.json
c6df53cb093090c2bfcccf910bb2261d1b0119c2 assets\create\lang\unfinished\nl_nl.json
2772dade72823ee9a174638afb5d9cec3834527b assets\create\lang\unfinished\pt_br.json
dd03b38344088dfd4517a380e9ed5052b20e4d90 assets\create\lang\unfinished\ru_ru.json
ef2f3a2b8c547821203d2f0487e7885bb2d6dcca assets\create\lang\unfinished\zh_cn.json
b149cd24e07fcadf25331bac859c313373617462 assets\create\lang\en_us.json
722910566426c6327d032fdf6f5a50abe4294002 assets\create\lang\unfinished\de_de.json
c29c0b2a0150e4d98ba293adb3fbe44bf9f6c8bb assets\create\lang\unfinished\fr_fr.json
4592d8a33170d4fa0f6a50ac179a0adf919ab5db assets\create\lang\unfinished\it_it.json
0b8d23672484d8a1d6d6660f304a8518e2441908 assets\create\lang\unfinished\ja_jp.json
65540c4cba02168f4fbef728cf03b7a5369995e7 assets\create\lang\unfinished\ko_kr.json
e7475d39ed0dba6fc16eec27f9eb7ca2feae8072 assets\create\lang\unfinished\nl_nl.json
023949e413e3be443e9155bc6ec8cf9259e20121 assets\create\lang\unfinished\pt_br.json
28b491b4c99de673f198b99949993df14d4002d5 assets\create\lang\unfinished\ru_ru.json
b9588b8e9b479b44683e32c61d5727c42514f80b assets\create\lang\unfinished\zh_cn.json
846200eb548d3bfa2e77b41039de159b4b6cfb45 assets\create\models\block\acacia_window.json
1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets\create\models\block\acacia_window_pane_noside.json
1763ea2c9b981d187f5031ba608f3d5d3be3986a assets\create\models\block\acacia_window_pane_noside_alt.json

View file

@ -815,6 +815,15 @@
"create.mechanical_mixer.min_ingredients": "Min. Ingredients",
"create.gui.config.overlay1": "Hi :)",
"create.gui.config.overlay2": "This is a sample overlay",
"create.gui.config.overlay3": "Click or drag with your mouse",
"create.gui.config.overlay4": "to move this preview",
"create.gui.config.overlay5": "Press ESC to exit this screen",
"create.gui.config.overlay6": "and save the new position",
"create.gui.config.overlay7": "Run /create overlay reset",
"create.gui.config.overlay8": "to reset to the default position",
"create.command.killTPSCommand": "killtps",
"create.command.killTPSCommand.status.slowed_by.0": "[Create]: Server tick is currently slowed by %s ms :o",
"create.command.killTPSCommand.status.slowed_by.1": "[Create]: Server tick is slowed by %s ms now >:)",

View file

@ -0,0 +1,86 @@
package com.simibubi.create.content.contraptions.goggles;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
import com.simibubi.create.foundation.gui.GuiGameElement;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import java.util.ArrayList;
import java.util.List;
public class GoggleConfigScreen extends AbstractSimiScreen {
private int offsetX;
private int offsetY;
private final List<String> tooltip;
public GoggleConfigScreen() {
String spacing = " ";
tooltip = new ArrayList<>();
tooltip.add(spacing + Lang.translate("gui.config.overlay1"));
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay2"));
tooltip.add("");
tooltip.add(spacing + Lang.translate("gui.config.overlay3"));
tooltip.add(spacing + Lang.translate("gui.config.overlay4"));
tooltip.add("");
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay5"));
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.config.overlay6"));
tooltip.add("");
tooltip.add(spacing + Lang.translate("gui.config.overlay7"));
tooltip.add(spacing + Lang.translate("gui.config.overlay8"));
}
@Override
protected void init() {
Minecraft mc = Minecraft.getInstance();
this.width = mc.getWindow().getScaledWidth();
this.height = mc.getWindow().getScaledHeight();
offsetX = AllConfigs.CLIENT.overlayOffsetX.get();
offsetY = AllConfigs.CLIENT.overlayOffsetY.get();
}
@Override
public void removed() {
AllConfigs.CLIENT.overlayOffsetX.set(offsetX);
AllConfigs.CLIENT.overlayOffsetY.set(offsetY);
}
@Override
public boolean mouseClicked(double x, double y, int button) {
updateOffset(x, y);
return true;
}
@Override
public boolean mouseDragged(double p_mouseDragged_1_, double p_mouseDragged_3_, int p_mouseDragged_5_, double p_mouseDragged_6_, double p_mouseDragged_8_) {
updateOffset(p_mouseDragged_1_, p_mouseDragged_3_);
return true;
}
private void updateOffset(double windowX, double windowY) {
offsetX = (int) (windowX - (this.width / 2));
offsetY = (int) (windowY - (this.height / 2));
}
@Override
protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
RenderSystem.pushMatrix();
int posX = this.width / 2 + offsetX;
int posY = this.height / 2 + offsetY;
//tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2);
renderTooltip(tooltip, posX, posY);
ItemStack item = AllItems.GOGGLES.asStack();
//GuiGameElement.of(item).at(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16).render();
GuiGameElement.of(item).at(posX + 10, posY - 16).render();
RenderSystem.popMatrix();
}
}

View file

@ -1,12 +1,9 @@
package com.simibubi.create.content.contraptions.goggles;
import java.util.ArrayList;
import java.util.List;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.gui.GuiGameElement;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.world.ClientWorld;
@ -23,6 +20,9 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import java.util.ArrayList;
import java.util.List;
@EventBusSubscriber(value = Dist.CLIENT)
public class GoggleOverlayRenderer {
@ -76,10 +76,14 @@ public class GoggleOverlayRenderer {
RenderSystem.pushMatrix();
Screen tooltipScreen = new TooltipScreen(null);
tooltipScreen.init(mc, mc.getWindow().getScaledWidth(), mc.getWindow().getScaledHeight());
tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2);
int posX = tooltipScreen.width / 2 + AllConfigs.CLIENT.overlayOffsetX.get();
int posY = tooltipScreen.height / 2 + AllConfigs.CLIENT.overlayOffsetY.get();
//tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2);
tooltipScreen.renderTooltip(tooltip, posX, posY);
ItemStack item = AllItems.GOGGLES.asStack();
GuiGameElement.of(item).at(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16).render();
//GuiGameElement.of(item).at(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16).render();
GuiGameElement.of(item).at(posX + 10, posY - 16).render();
RenderSystem.popMatrix();
}

View file

@ -1,19 +1,23 @@
package com.simibubi.create.foundation.command;
import java.util.function.Supplier;
import com.simibubi.create.content.contraptions.goggles.GoggleConfigScreen;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.networking.SimplePacketBase;
import net.minecraft.network.PacketBuffer;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.network.NetworkEvent;
import org.apache.logging.log4j.LogManager;
import java.util.function.Consumer;
import java.util.function.Supplier;
public class ConfigureConfigPacket extends SimplePacketBase {
private String option;
private String value;
private final String option;
private final String value;
public ConfigureConfigPacket(String option, String value) {
this.option = option;
@ -34,11 +38,44 @@ public class ConfigureConfigPacket extends SimplePacketBase {
@Override
public void handle(Supplier<NetworkEvent.Context> ctx) {
ctx.get().enqueueWork(() -> DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
if (option.equals("rainbowDebug")) {
AllConfigs.CLIENT.rainbowDebug.set(Boolean.parseBoolean(value));
try {
Actions.valueOf(option).performAction(value);
} catch (IllegalArgumentException e) {
LogManager.getLogger().warn("Received ConfigureConfigPacket with invalid Option: " + option);
}
}));
ctx.get().setPacketHandled(true);
}
enum Actions {
rainbowDebug((value) -> {
AllConfigs.CLIENT.rainbowDebug.set(Boolean.parseBoolean(value));
}),
overlayScreen((value) -> {
overlayScreenAction();
}),
overlayReset((value) -> {
AllConfigs.CLIENT.overlayOffsetX.set(0);
AllConfigs.CLIENT.overlayOffsetY.set(0);
}),
;
private final Consumer<String> consumer;
Actions(Consumer<String> action) {
this.consumer = action;
}
void performAction(String value){
consumer.accept(value);
}
@OnlyIn(Dist.CLIENT)
private static void overlayScreenAction(){
//this doesn't work if i move it into the enum constructor like the other two. if there's a proper way to do this, please let me know
ScreenOpener.open(new GoggleConfigScreen());
}
}
}

View file

@ -10,6 +10,7 @@ public class CreateCommand {
public CreateCommand(CommandDispatcher<CommandSource> dispatcher) {
dispatcher.register(Commands.literal("create")
.then(ToggleDebugCommand.register())
.then(OverlayConfigCommand.register())
.then(ClearBufferCacheCommand.register())
//.then(KillTPSCommand.register()) //Commented out for release
);

View file

@ -0,0 +1,46 @@
package com.simibubi.create.foundation.command;
import com.mojang.brigadier.builder.ArgumentBuilder;
import com.simibubi.create.foundation.networking.AllPackets;
import net.minecraft.command.CommandSource;
import net.minecraft.command.Commands;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.network.PacketDistributor;
public class OverlayConfigCommand {
public static ArgumentBuilder<CommandSource, ?> register() {
return Commands.literal("overlay")
.requires(cs -> cs.hasPermissionLevel(0))
.then(Commands.literal("reset")
.executes(ctx -> {
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> ConfigureConfigPacket.Actions.overlayReset.performAction(""));
DistExecutor.runWhenOn(Dist.DEDICATED_SERVER, () -> () ->
AllPackets.channel.send(
PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) ctx.getSource().getEntity()),
new ConfigureConfigPacket(ConfigureConfigPacket.Actions.overlayReset.name(), "")));
ctx.getSource().sendFeedback(new StringTextComponent("reset overlay offset"), true);
return 1;
})
)
.executes(ctx -> {
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> ConfigureConfigPacket.Actions.overlayScreen.performAction(""));
DistExecutor.runWhenOn(Dist.DEDICATED_SERVER, () -> () ->
AllPackets.channel.send(
PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) ctx.getSource().getEntity()),
new ConfigureConfigPacket(ConfigureConfigPacket.Actions.overlayScreen.name(), "")));
ctx.getSource().sendFeedback(new StringTextComponent("window opened"), true);
return 1;
});
}
}

View file

@ -21,12 +21,13 @@ public class ToggleDebugCommand {
.then(Commands.argument("value", BoolArgumentType.bool())
.executes(ctx -> {
boolean value = BoolArgumentType.getBool(ctx, "value");
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> AllConfigs.CLIENT.rainbowDebug.set(value));
//DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> AllConfigs.CLIENT.rainbowDebug.set(value));
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> ConfigureConfigPacket.Actions.rainbowDebug.performAction(String.valueOf(value)));
DistExecutor.runWhenOn(Dist.DEDICATED_SERVER, () -> () ->
AllPackets.channel.send(
PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) ctx.getSource().getEntity()),
new ConfigureConfigPacket("rainbowDebug", String.valueOf(value))));
new ConfigureConfigPacket(ConfigureConfigPacket.Actions.rainbowDebug.name(), String.valueOf(value))));
ctx.getSource().sendFeedback(new StringTextComponent((value ? "enabled" : "disabled") + " rainbow debug"), true);

View file

@ -13,6 +13,9 @@ public class CClient extends ConfigBase {
public ConfigBool rainbowDebug =
b(true, "enableRainbowDebug", "Show colourful debug information while the F3-Menu is open.");
public ConfigInt overlayOffsetX = i(0, Integer.MIN_VALUE, Integer.MAX_VALUE, "overlayOffsetX", "Offset the overlay from goggle- and hover- information by this many pixels on the X axis; Use /create overlay");
public ConfigInt overlayOffsetY = i(0, Integer.MIN_VALUE, Integer.MAX_VALUE, "overlayOffsetY", "Offset the overlay from goggle- and hover- information by this many pixels on the Y axis; Use /create overlay");
@Override
public String getName() {
return "client";

View file

@ -343,6 +343,15 @@
"create.tooltip.analogStrength": "Analog Strength: %1$s/15",
"create.mechanical_mixer.min_ingredients": "Min. Ingredients",
"create.gui.config.overlay1": "Hi :)",
"create.gui.config.overlay2": "This is a sample overlay",
"create.gui.config.overlay3": "Click or drag with your mouse",
"create.gui.config.overlay4": "to move this preview",
"create.gui.config.overlay5": "Press ESC to exit this screen",
"create.gui.config.overlay6": "and save the new position",
"create.gui.config.overlay7": "Run /create overlay reset",
"create.gui.config.overlay8": "to reset to the default position",
"create.command.killTPSCommand": "killtps",
"create.command.killTPSCommand.status.slowed_by.0": "[Create]: Server tick is currently slowed by %s ms :o",
"create.command.killTPSCommand.status.slowed_by.1": "[Create]: Server tick is slowed by %s ms now >:)",