diff --git a/gradle.properties b/gradle.properties index d8e2f8c..05925e1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,14 +2,14 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://modmuss50.me/fabric.html -minecraft_version=1.19 -yarn_mappings=1.19+build.4 +minecraft_version=1.19.1 +yarn_mappings=1.19.1+build.5 loader_version=0.14.8 # Mod Properties -mod_version=1.19-1.4.0 +mod_version=1.19.1-1.5.0 maven_group=rubyboat archives_base_name=ghost # Dependencies # check this on https://modmuss50.me/fabric.html -fabric_version=0.56.0+1.19 +fabric_version=0.58.5+1.19.1 clothconfig_version=7.0.72 \ No newline at end of file diff --git a/src/main/java/rubyboat/clothconfigextensions/builders/ButtonBuilder.java b/src/main/java/rubyboat/clothconfigextensions/builders/ButtonBuilder.java new file mode 100644 index 0000000..99b38b6 --- /dev/null +++ b/src/main/java/rubyboat/clothconfigextensions/builders/ButtonBuilder.java @@ -0,0 +1,31 @@ +package rubyboat.clothconfigextensions.builders; + +import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.text.Text; +import rubyboat.clothconfigextensions.entries.ButtonEntry; + +public class ButtonBuilder { + Text value; + Text id; + ButtonWidget.PressAction onPress; + int xbuffer = 0; + + public ButtonBuilder(Text component, Text value) { + this.id = component; + this.value = value; + } + + public ButtonBuilder setOnPress(ButtonWidget.PressAction onPress) { + this.onPress = onPress; + return this; + } + + public ButtonBuilder setWidthBuffer(int xbuffer) { + this.xbuffer = xbuffer; + return this; + } + + public ButtonEntry build() { + return new ButtonEntry(id, value, onPress, xbuffer); + } +} \ No newline at end of file diff --git a/src/main/java/rubyboat/clothconfigextensions/configEntryBuilderExtension.java b/src/main/java/rubyboat/clothconfigextensions/configEntryBuilderExtension.java new file mode 100644 index 0000000..e8cbf44 --- /dev/null +++ b/src/main/java/rubyboat/clothconfigextensions/configEntryBuilderExtension.java @@ -0,0 +1,140 @@ +package rubyboat.clothconfigextensions; + +import me.shedaniel.clothconfig2.api.AbstractConfigListEntry; +import me.shedaniel.clothconfig2.api.ConfigEntryBuilder; +import me.shedaniel.clothconfig2.api.ModifierKeyCode; +import me.shedaniel.clothconfig2.gui.entries.DropdownBoxEntry; +import me.shedaniel.clothconfig2.impl.ConfigEntryBuilderImpl; +import me.shedaniel.clothconfig2.impl.builders.*; +import net.minecraft.text.Text; +import rubyboat.clothconfigextensions.builders.ButtonBuilder; + +import java.util.List; +import java.util.UUID; + +public class configEntryBuilderExtension implements ConfigEntryBuilder { + + @Override + public Text getResetButtonKey() { + return null; + } + + @Override + public ConfigEntryBuilder setResetButtonKey(Text text) { + return null; + } + + @Override + public IntListBuilder startIntList(Text text, List list) { + return null; + } + + @Override + public LongListBuilder startLongList(Text text, List list) { + return null; + } + + @Override + public FloatListBuilder startFloatList(Text text, List list) { + return null; + } + + @Override + public DoubleListBuilder startDoubleList(Text text, List list) { + return null; + } + + @Override + public StringListBuilder startStrList(Text text, List list) { + return null; + } + + @Override + public SubCategoryBuilder startSubCategory(Text text) { + return null; + } + + @Override + public SubCategoryBuilder startSubCategory(Text text, List list) { + return null; + } + + @Override + public BooleanToggleBuilder startBooleanToggle(Text text, boolean b) { + return null; + } + + @Override + public StringFieldBuilder startStrField(Text text, String s) { + return null; + } + + @Override + public ColorFieldBuilder startColorField(Text text, int i) { + return null; + } + + @Override + public TextFieldBuilder startTextField(Text text, String s) { + return null; + } + + @Override + public TextDescriptionBuilder startTextDescription(Text text) { + return null; + } + + @Override + public > EnumSelectorBuilder startEnumSelector(Text text, Class aClass, T t) { + return null; + } + + @Override + public SelectorBuilder startSelector(Text text, T[] ts, T t) { + return null; + } + + public ButtonBuilder startButtonBuilder(Text value) { + return new ButtonBuilder(Text.of(UUID.randomUUID().toString()), value); + } + + @Override + public IntFieldBuilder startIntField(Text text, int i) { + return null; + } + + @Override + public LongFieldBuilder startLongField(Text text, long l) { + return null; + } + + @Override + public FloatFieldBuilder startFloatField(Text text, float v) { + return null; + } + + @Override + public DoubleFieldBuilder startDoubleField(Text text, double v) { + return null; + } + + @Override + public IntSliderBuilder startIntSlider(Text text, int i, int i1, int i2) { + return null; + } + + @Override + public LongSliderBuilder startLongSlider(Text text, long l, long l1, long l2) { + return null; + } + + @Override + public KeyCodeBuilder startModifierKeyCodeField(Text text, ModifierKeyCode modifierKeyCode) { + return null; + } + + @Override + public DropdownMenuBuilder startDropdownMenu(Text text, DropdownBoxEntry.SelectionTopCellElement selectionTopCellElement, DropdownBoxEntry.SelectionCellCreator selectionCellCreator) { + return null; + } +} diff --git a/src/main/java/rubyboat/clothconfigextensions/entries/ButtonEntry.java b/src/main/java/rubyboat/clothconfigextensions/entries/ButtonEntry.java new file mode 100644 index 0000000..c74ddf3 --- /dev/null +++ b/src/main/java/rubyboat/clothconfigextensions/entries/ButtonEntry.java @@ -0,0 +1,126 @@ +package rubyboat.clothconfigextensions.entries; + +import com.google.common.collect.Lists; +import me.shedaniel.clothconfig2.gui.AbstractConfigScreen; +import me.shedaniel.clothconfig2.gui.entries.TooltipListEntry; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.Element; +import net.minecraft.client.gui.Selectable; +import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.text.OrderedText; +import net.minecraft.text.Style; +import net.minecraft.text.Text; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.function.Supplier; + +@Environment(EnvType.CLIENT) +public class ButtonEntry extends TooltipListEntry { + public static final int LINE_HEIGHT = 12; + private final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer; + Text buttonInnerText; + private int savedWidth = -1; + private int savedX = -1; + private int savedY = -1; + + public int xbuffer; + public int ybuffer; + + private final List widgets; + private ButtonWidget button; + private List wrappedLines; + @ApiStatus.Internal + @Deprecated + public ButtonEntry(Text fieldName, Text text, ButtonWidget.PressAction onPress, int xbuffer) { + this(fieldName, text, null, onPress, xbuffer); + } + + @ApiStatus.Internal + @Deprecated + public ButtonEntry(Text fieldName, Text text, Supplier> tooltipSupplier, ButtonWidget.PressAction onPress, int xbuffer) { + super(fieldName, tooltipSupplier); + this.buttonInnerText = text; + this.wrappedLines = Collections.emptyList(); + this.button = new ButtonWidget(0, 0, MinecraftClient.getInstance().textRenderer.getWidth(text) + 6 + xbuffer, 20, text, onPress); + widgets = Lists.newArrayList(button); + } + + @Override + public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isHovered, float delta) { + super.render(matrices, index, y, x, entryWidth, entryHeight, mouseX, mouseY, isHovered, delta); + if (this.savedWidth != entryWidth || this.savedX != x || this.savedY != y) { + this.wrappedLines = this.textRenderer.wrapLines(this.buttonInnerText, entryWidth); + this.savedWidth = entryWidth; + this.savedX = x; + this.savedY = y; + } + button.x = getConfigScreen().width / 2 - button.getWidth() / 2; + button.y = y; + button.render(matrices, mouseX, mouseY, delta); + + + Style style = this.getTextAt(mouseX, mouseY); + AbstractConfigScreen configScreen = this.getConfigScreen(); + if (style != null && configScreen != null) { + configScreen.renderTextHoverEffect(matrices, style, mouseX, mouseY); + } + } + + @Override + public int getItemHeight() { + if (savedWidth == -1) return LINE_HEIGHT; + int lineCount = this.wrappedLines.size(); + return lineCount == 0 ? 0 : 15 + lineCount * LINE_HEIGHT; + } + + @Override + public List narratables() { + return null; + } + + @Nullable + private Style getTextAt(double x, double y) { + int lineCount = this.wrappedLines.size(); + + if (lineCount > 0) { + int textX = (int) Math.floor(x - this.savedX); + int textY = (int) Math.floor(y - 4 - this.savedY); + if (textX >= 0 && textY >= 0 && textX <= this.savedWidth && textY < LINE_HEIGHT * lineCount + lineCount) { + int line = textY / LINE_HEIGHT; + if (line < this.wrappedLines.size()) { + OrderedText orderedText = this.wrappedLines.get(line); + return this.textRenderer.getTextHandler().getStyleAt(orderedText, textX); + } + } + } + return null; + } + + @Override + public Object getValue() { + return null; + } + + @Override + public Optional getDefaultValue() { + return Optional.empty(); + } + + @Override + public void save() { + + } + + @Override + public List children() { + return widgets; + } +} \ No newline at end of file diff --git a/src/main/java/rubyboat/ghost/config/Config.java b/src/main/java/rubyboat/ghost/config/Config.java index fe14d58..bc49ef3 100644 --- a/src/main/java/rubyboat/ghost/config/Config.java +++ b/src/main/java/rubyboat/ghost/config/Config.java @@ -7,15 +7,20 @@ import me.shedaniel.clothconfig2.impl.builders.ColorFieldBuilder; import me.shedaniel.clothconfig2.impl.builders.DropdownMenuBuilder; import net.fabricmc.fabric.api.lookup.v1.item.ItemApiLookup; +import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; import net.minecraft.text.Text; import net.minecraft.text.TranslatableTextContent; +import rubyboat.clothconfigextensions.builders.ButtonBuilder; +import rubyboat.clothconfigextensions.configEntryBuilderExtension; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Arrays; +import java.util.UUID; public class Config { /* @@ -30,10 +35,10 @@ public class Config { static String block = "diamond_block"; static String camera_type = ""; - static int camera_distance = 10; + static int camera_distance = 4; static String path = "ghost_config.json"; static boolean is_slippery = false; - static String player_texture = "none"; + static String player_texture = ""; static boolean is_sleeve = true; static int zoom_strength = 75; static boolean is_cyrus_mode = true; @@ -44,7 +49,7 @@ public class Config { static Integer fog = 000000; static String title = "Minecraft"; static Integer color = 0; - static Integer time = 0; + static Integer time = -1; static Integer leaf = 0; static Integer grass = 0; static boolean render_arms = true; @@ -52,10 +57,6 @@ public class Config { static boolean render_body = true; static boolean render_head = true; static boolean technoblade = true; - static float arms_size = 1; - static float legs_size = 1; - static float body_size = 1; - static float head_size = 1; static float model_offset = 0; static String weather = ""; static Integer water = 0; @@ -63,18 +64,6 @@ public class Config { static String version = ""; static int distance = 0; //getters for size changers - public static float getArms_size() { - return arms_size; - } - public static float getLegs_size() { - return legs_size; - } - public static float getBody_size() { - return body_size; - } - public static float getHead_size() { - return head_size; - } public static String[] blocks = { @@ -219,30 +208,29 @@ public static SerializedConfig getConfig() return config; } + public static void save() { + SerializedConfig config = new SerializedConfig(); + MinecraftClient.getInstance().worldRenderer.reload(); + MinecraftClient.getInstance().reloadResources(); + try { + Files.writeString(Path.of(path), config.serialized()); + } catch (IOException e) { + e.printStackTrace(); + } + Config.config = loadConfig(); + } + public static ConfigBuilder MakeConfig() { - SerializedConfig sc = getConfig(); - ConfigBuilder builder = ConfigBuilder.create() .setParentScreen(MinecraftClient.getInstance().currentScreen) .setTitle(Text.translatable("title.ghost.config")); - builder.setSavingRunnable(() -> { - SerializedConfig config = new SerializedConfig(); - MinecraftClient.getInstance().worldRenderer.reload(); - MinecraftClient.getInstance().reloadResources(); - try { - Files.writeString(Path.of(path), config.serialized()); - } catch (IOException e) { - e.printStackTrace(); - } - Config.config = loadConfig(); - }); + builder.setSavingRunnable(Config::save); ConfigCategory general = builder.getOrCreateCategory(Text.translatable("config_category.ghost.general")); ConfigCategory experimental = builder.getOrCreateCategory(Text.translatable("config_category.ghost.experimental")); ConfigCategory texture = builder.getOrCreateCategory(Text.translatable("config_category.ghost.texture")); - ConfigCategory biome = builder.getOrCreateCategory(Text.translatable("config_category.ghost.biome")); - ConfigCategory time = builder.getOrCreateCategory(Text.translatable("config_category.ghost.time")); + ConfigCategory world = builder.getOrCreateCategory(Text.translatable("config_category.ghost.world")); ConfigCategory gamemodes = builder.getOrCreateCategory(Text.translatable("config_category.ghost.gamemodes")); ConfigEntryBuilder entryBuilder = builder.entryBuilder(); //---ENTRIES @@ -256,12 +244,7 @@ public static ConfigBuilder MakeConfig() .setSuggestionMode(false) .setSaveConsumer(newValue -> Config.camera_type = newValue ); - - DropdownMenuBuilder weather = entryBuilder.startStringDropdownMenu(Text.translatable("entry.ghost.weather"), Config.weather) - .setSelections(Arrays.asList(downfall)) - .setSuggestionMode(false) - .setSaveConsumer(newValue -> Config.weather = newValue - ); + general.addEntry(entryBuilder.startTextDescription(Text.of("test")).build()); general.addEntry(blockmenu.build()); gamemodes.addEntry(cameramenu.build()); if(camera_type.equalsIgnoreCase("topdown")) @@ -303,15 +286,17 @@ public static ConfigBuilder MakeConfig() );*/ texture.addEntry(entryBuilder.startBooleanToggle(Text.translatable("entry.ghost.is_sleeve"), Config.is_sleeve).setSaveConsumer(newValue -> Config.is_sleeve = newValue).build()); general.addEntry(entryBuilder.startStrField(Text.translatable("entry.ghost.title"), Config.title).setSaveConsumer(newValue -> Config.title = newValue).build()); - biome.addEntry(entryBuilder.startColorField(Text.translatable("entry.ghost.color"), Config.color) + world.addEntry(entryBuilder.startColorField(Text.translatable("entry.ghost.color"), Config.color) .setSaveConsumer(newValue -> Config.color = newValue) .setTooltip(Text.translatable("tooltip.ghost.color")) .build()); + world.addEntry(entryBuilder.startTextDescription(Text.translatable("label.ghost.world_presets")).build()); + experimental.addEntry(entryBuilder.startBooleanToggle(Text.translatable("entry.ghost.cyrus_mode"), Config.is_cyrus_mode) .setSaveConsumer(newValue -> Config.is_cyrus_mode = newValue) .build() ); - biome.addEntry(entryBuilder.startColorField(Text.translatable("entry.ghost.fog"), Config.fog) + world.addEntry(entryBuilder.startColorField(Text.translatable("entry.ghost.fog"), Config.fog) .setSaveConsumer(newValue -> Config.fog = newValue) .setTooltip(Text.translatable("tooltip.ghost.fog")) .build()); @@ -321,11 +306,11 @@ public static ConfigBuilder MakeConfig() .setSaveConsumer(newValue -> Config.inPowderSnowEffect = newValue ); - biome.addEntry(entryBuilder.startColorField(Text.translatable("entry.ghost.leaf"), Config.leaf) + world.addEntry(entryBuilder.startColorField(Text.translatable("entry.ghost.leaf"), Config.leaf) .setSaveConsumer(newValue -> Config.leaf = newValue) .setTooltip(Text.translatable("tooltip.ghost.leaf")) .build()); - biome.addEntry(entryBuilder.startColorField(Text.translatable("entry.ghost.grass"), Config.grass) + world.addEntry(entryBuilder.startColorField(Text.translatable("entry.ghost.grass"), Config.grass) .setSaveConsumer(newValue -> Config.grass = newValue) .setTooltip(Text.translatable("tooltip.ghost.grass")) .build()); @@ -335,7 +320,7 @@ public static ConfigBuilder MakeConfig() .build() ); texture.addEntry(snow.build()); - time.addEntry(entryBuilder.startIntSlider(Text.translatable("entry.ghost.time"), Config.time, -1 , 24000) + world.addEntry(entryBuilder.startIntSlider(Text.translatable("entry.ghost.time"), Config.time, -1 , 24000) .setDefaultValue(0) .setMin(-1) .setMax(24000) @@ -353,11 +338,11 @@ public static ConfigBuilder MakeConfig() texture.addEntry(entryBuilder.startFloatField(Text.translatable("entry.ghost.player_model_offset"), Config.model_offset) .setSaveConsumer(newValue -> Config.model_offset = newValue) .build()); - biome.addEntry(entryBuilder.startColorField(Text.translatable("entry.ghost.water"), Config.water) + world.addEntry(entryBuilder.startColorField(Text.translatable("entry.ghost.water"), Config.water) .setSaveConsumer(newValue -> Config.water = newValue) .setTooltip(Text.translatable("tooltip.ghost.water")) .build()); - biome.addEntry(entryBuilder.startColorField(Text.translatable("entry.ghost.waterfog"), Config.waterfog) + world.addEntry(entryBuilder.startColorField(Text.translatable("entry.ghost.waterfog"), Config.waterfog) .setSaveConsumer(newValue -> Config.waterfog = newValue) .setTooltip(Text.translatable("tooltip.ghost.waterfog")) .build()); @@ -367,6 +352,49 @@ public static ConfigBuilder MakeConfig() general.addEntry(entryBuilder.startIntField(Text.translatable("entry.ghost.distance"), Config.distance) .setSaveConsumer(newValue -> Config.distance = newValue) .build()); + world.addEntry(new ButtonBuilder(Text.of(UUID.randomUUID().toString()), Text.translatable("entry.ghost.plains_color")).setOnPress(button -> { + Config.grass = 0x7aca60; + config.grass = 0x7aca60; + MinecraftClient.getInstance().setScreen(null); + save(); + }).build()); + + world.addEntry(new ButtonBuilder(Text.of(UUID.randomUUID().toString()), Text.translatable("entry.ghost.ocean_color")).setOnPress(button -> { + Config.water = 0x00ccaa; + config.water = 0x00ccaa; + Config.waterfog = 0x00ccaa; + config.waterfog = 0x00ccaa; + MinecraftClient.getInstance().setScreen(null); + save(); + }).build()); + + world.addEntry(new ButtonBuilder(Text.of(UUID.randomUUID().toString()), Text.translatable("entry.ghost.jungle_color")).setOnPress(button -> { + Config.grass = 0x40cf00; + config.grass = 0x40cf00; + Config.leaf = 0x40cf00; + config.leaf = 0x40cf00; + MinecraftClient.getInstance().setScreen(null); + save(); + }).build()); + //12700 + world.addEntry(new ButtonBuilder(Text.of(UUID.randomUUID().toString()), Text.translatable("entry.ghost.sunset")).setOnPress(button -> { + Config.time = 12700; + config.time = 12700; + MinecraftClient.getInstance().setScreen(null); + save(); + }).build()); + texture.addEntry(new ButtonBuilder(Text.of(UUID.randomUUID().toString()), Text.translatable("entry.ghost.moleman")).setOnPress(button -> { + Config.render_arms = false; + Config.render_legs = false; + Config.render_body = false; + Config.model_offset = -1.4f; + config.render_arms = false; + config.render_legs = false; + config.render_body = false; + config.model_offset = -1.4f; + MinecraftClient.getInstance().setScreen(null); + save(); + }).build()); //Build return builder; } @@ -393,10 +421,6 @@ public static class SerializedConfig public boolean render_body; public boolean render_head; public boolean technoblade; - float arms_size; - float legs_size; - float body_size; - float head_size; public boolean bouncy; public boolean antfarm; public float model_offset; @@ -430,10 +454,6 @@ public SerializedConfig() this.render_legs = Config.render_legs; this.render_body = Config.render_body; this.render_head = Config.render_head; - this.arms_size = Config.arms_size; - this.legs_size = Config.legs_size; - this.body_size = Config.body_size; - this.head_size = Config.head_size; this.model_offset = Config.model_offset; this.water = Config.water; this.waterfog = Config.waterfog; diff --git a/src/main/java/rubyboat/ghost/mixin/BiomeMixin.java b/src/main/java/rubyboat/ghost/mixin/BiomeMixin.java index a7eb2d0..c97958b 100644 --- a/src/main/java/rubyboat/ghost/mixin/BiomeMixin.java +++ b/src/main/java/rubyboat/ghost/mixin/BiomeMixin.java @@ -1,7 +1,6 @@ package rubyboat.ghost.mixin; import net.minecraft.world.biome.Biome; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -9,8 +8,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import rubyboat.ghost.config.Config; -import java.util.Objects; - @Mixin(Biome.class) public abstract class BiomeMixin { @Shadow public abstract int getSkyColor(); diff --git a/src/main/java/rubyboat/ghost/mixin/BlockMixin.java b/src/main/java/rubyboat/ghost/mixin/BlockMixin.java index 9e6d126..fd1ed06 100644 --- a/src/main/java/rubyboat/ghost/mixin/BlockMixin.java +++ b/src/main/java/rubyboat/ghost/mixin/BlockMixin.java @@ -2,30 +2,20 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; -import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import rubyboat.ghost.config.Config; -import java.util.logging.Logger; - @Environment(EnvType.CLIENT) @Mixin(Block.class) public class BlockMixin { diff --git a/src/main/java/rubyboat/ghost/mixin/CameraMixin.java b/src/main/java/rubyboat/ghost/mixin/CameraMixin.java index e821d2c..1e538a7 100644 --- a/src/main/java/rubyboat/ghost/mixin/CameraMixin.java +++ b/src/main/java/rubyboat/ghost/mixin/CameraMixin.java @@ -1,14 +1,12 @@ package rubyboat.ghost.mixin; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.Camera; import net.minecraft.client.render.CameraSubmersionType; -import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.*; -import net.minecraft.util.registry.Registry; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.BlockView; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -16,7 +14,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import rubyboat.ghost.client.GhostClient; import rubyboat.ghost.config.Config; @Mixin(Camera.class) diff --git a/src/main/java/rubyboat/ghost/mixin/ClientPlayerEntityMixin.java b/src/main/java/rubyboat/ghost/mixin/ClientPlayerEntityMixin.java index d06830b..22fb654 100644 --- a/src/main/java/rubyboat/ghost/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/rubyboat/ghost/mixin/ClientPlayerEntityMixin.java @@ -1,17 +1,10 @@ package rubyboat.ghost.mixin; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.input.Input; import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.text.Text; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import rubyboat.ghost.client.GhostClient; import rubyboat.ghost.config.Config; @Mixin(ClientPlayerEntity.class) diff --git a/src/main/java/rubyboat/ghost/mixin/ClientWorldMixin.java b/src/main/java/rubyboat/ghost/mixin/ClientWorldMixin.java index 4e2ff46..9fcb465 100644 --- a/src/main/java/rubyboat/ghost/mixin/ClientWorldMixin.java +++ b/src/main/java/rubyboat/ghost/mixin/ClientWorldMixin.java @@ -1,18 +1,12 @@ package rubyboat.ghost.mixin; -import me.shedaniel.autoconfig.AutoConfig; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.block.entity.BeaconBlockEntityRenderer; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.world.ClientChunkManager; import net.minecraft.client.world.ClientWorld; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.mob.CreeperEntity; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.registry.Registry; @@ -25,8 +19,6 @@ import rubyboat.ghost.client.GhostClient; import rubyboat.ghost.config.Config; -import java.util.Random; - @Environment(EnvType.CLIENT) @Mixin(ClientWorld.class) public abstract class ClientWorldMixin { diff --git a/src/main/java/rubyboat/ghost/mixin/ClientWorldPropertiesMixin.java b/src/main/java/rubyboat/ghost/mixin/ClientWorldPropertiesMixin.java index 9737969..e8921ce 100644 --- a/src/main/java/rubyboat/ghost/mixin/ClientWorldPropertiesMixin.java +++ b/src/main/java/rubyboat/ghost/mixin/ClientWorldPropertiesMixin.java @@ -1,11 +1,9 @@ package rubyboat.ghost.mixin; -import net.minecraft.client.render.block.entity.EndPortalBlockEntityRenderer; import net.minecraft.client.world.ClientWorld; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import rubyboat.ghost.config.Config; diff --git a/src/main/java/rubyboat/ghost/mixin/DebugHudMixin.java b/src/main/java/rubyboat/ghost/mixin/DebugHudMixin.java index da50a79..fe7bd36 100644 --- a/src/main/java/rubyboat/ghost/mixin/DebugHudMixin.java +++ b/src/main/java/rubyboat/ghost/mixin/DebugHudMixin.java @@ -5,15 +5,11 @@ import it.unimi.dsi.fastutil.longs.LongSet; import it.unimi.dsi.fastutil.longs.LongSets; import it.unimi.dsi.fastutil.objects.Object2IntMap; - -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - import net.minecraft.SharedConstants; import net.minecraft.client.ClientBrandRetriever; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gl.ShaderEffect; +import net.minecraft.client.gui.hud.DebugHud; import net.minecraft.entity.Entity; import net.minecraft.entity.SpawnGroup; import net.minecraft.network.ClientConnection; @@ -21,23 +17,21 @@ import net.minecraft.server.world.ServerChunkManager; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.ChunkPos; -import net.minecraft.util.math.ChunkSectionPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.*; import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.RegistryEntry; -import net.minecraft.world.*; import net.minecraft.world.Heightmap.Type; +import net.minecraft.world.LightType; +import net.minecraft.world.LocalDifficulty; +import net.minecraft.world.SpawnHelper; +import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.BiomeSource; +import net.minecraft.world.biome.source.util.MultiNoiseUtil; import net.minecraft.world.chunk.WorldChunk; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.noise.NoiseConfig; import org.jetbrains.annotations.Nullable; -import net.minecraft.client.gui.hud.DebugHud; -import net.minecraft.world.biome.source.util.MultiNoiseUtil; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -47,6 +41,13 @@ import rubyboat.ghost.client.GhostClient; import rubyboat.ghost.config.Config; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import java.util.stream.Stream; + @Mixin(DebugHud.class) public abstract class DebugHudMixin { diff --git a/src/main/java/rubyboat/ghost/mixin/EndPortalRendererMixin.java b/src/main/java/rubyboat/ghost/mixin/EndPortalRendererMixin.java deleted file mode 100644 index b1121e7..0000000 --- a/src/main/java/rubyboat/ghost/mixin/EndPortalRendererMixin.java +++ /dev/null @@ -1,18 +0,0 @@ -package rubyboat.ghost.mixin; - -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.block.entity.EndPortalBlockEntityRenderer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(EndPortalBlockEntityRenderer.class) -public class EndPortalRendererMixin { - - @Inject(at = @At("HEAD"), method = "getLayer", cancellable = true) - protected void getLayer(CallbackInfoReturnable cir) { - cir.setReturnValue(RenderLayer.getEndGateway()); - } - -} diff --git a/src/main/java/rubyboat/ghost/mixin/InGameHudMixin.java b/src/main/java/rubyboat/ghost/mixin/InGameHudMixin.java deleted file mode 100644 index 8dc28d2..0000000 --- a/src/main/java/rubyboat/ghost/mixin/InGameHudMixin.java +++ /dev/null @@ -1,42 +0,0 @@ -package rubyboat.ghost.mixin; - - -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; -import net.minecraft.client.gui.hud.InGameHud; -import net.minecraft.client.render.block.entity.EndPortalBlockEntityRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.player.PlayerEntity; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import rubyboat.ghost.client.GhostClient; -import rubyboat.ghost.config.Config; - -@Mixin(InGameHud.class) -public abstract class InGameHudMixin { - @Shadow protected abstract PlayerEntity getCameraPlayer(); - - @Shadow public abstract TextRenderer getTextRenderer(); - - @Shadow private int scaledWidth; - - @Shadow private int scaledHeight; - - @Inject(at = @At("HEAD"), method = "renderStatusBars") - public void renderStatusBars(MatrixStack matrices, CallbackInfo ci){ - PlayerEntity playerEntity = this.getCameraPlayer(); - if (playerEntity != null) { - /*if(Config.is_thirst()) - { - String to_print = "Thirst: "; - //MatrixStack matrices, TextRenderer textRenderer, String text, int centerX, int y, int color - int k = (this.scaledWidth - this.getTextRenderer().getWidth(to_print)) / 2; - this.getTextRenderer().draw(matrices, "Thirst: ", k, this.scaledHeight - 100, 0x00aaff); - }*/ - } - } -} diff --git a/src/main/java/rubyboat/ghost/mixin/PigEntityModelMixin.java b/src/main/java/rubyboat/ghost/mixin/PigEntityModelMixin.java index 2600b6d..cee4137 100644 --- a/src/main/java/rubyboat/ghost/mixin/PigEntityModelMixin.java +++ b/src/main/java/rubyboat/ghost/mixin/PigEntityModelMixin.java @@ -1,11 +1,8 @@ package rubyboat.ghost.mixin; import net.minecraft.client.model.*; -import net.minecraft.client.network.AbstractClientPlayerEntity; -import net.minecraft.client.render.entity.PlayerEntityRenderer; import net.minecraft.client.render.entity.model.PigEntityModel; import net.minecraft.client.render.entity.model.QuadrupedEntityModel; -import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; diff --git a/src/main/java/rubyboat/ghost/mixin/PlayerRenderMixin.java b/src/main/java/rubyboat/ghost/mixin/PlayerRenderMixin.java index 059d45c..dfea566 100644 --- a/src/main/java/rubyboat/ghost/mixin/PlayerRenderMixin.java +++ b/src/main/java/rubyboat/ghost/mixin/PlayerRenderMixin.java @@ -5,15 +5,11 @@ import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.EndPortalBlockEntityRenderer; import net.minecraft.client.render.entity.PlayerEntityRenderer; -import net.minecraft.client.render.entity.feature.PlayerHeldItemFeatureRenderer; import net.minecraft.client.render.entity.model.PlayerEntityModel; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.Identifier; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3f; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; diff --git a/src/main/resources/assets/ghost/icon.png b/src/main/resources/assets/ghost/icon.png index f5019cb..e69de29 100644 Binary files a/src/main/resources/assets/ghost/icon.png and b/src/main/resources/assets/ghost/icon.png differ diff --git a/src/main/resources/assets/ghost/lang/en_us.json b/src/main/resources/assets/ghost/lang/en_us.json index 06585b0..232d81f 100644 --- a/src/main/resources/assets/ghost/lang/en_us.json +++ b/src/main/resources/assets/ghost/lang/en_us.json @@ -1,7 +1,7 @@ { "category.ghost.general": "Ghost Keybinds", "ghost.general": "Ghost Options", - "key.ghost.createghostblock": "Create Ghost block", + "key.ghostforge.createghostblock": "Create Ghost block", "key.ghost.menu": "Open Menu", "title.ghost.config": "Ghost Config", "config_category.ghost.general": "General Options", @@ -18,14 +18,13 @@ "tooltip.ghost.snow": "Effects like Powder Snow, Lava, and Water", "entry.ghost.is_portal": "Nether Portal Texture on Camera", "entry.ghost.title": "Minecraft Menu Title", - "config_category.ghost.biome": "Biome Options", + "config_category.ghost.world": "World Options", "entry.ghost.color": "Sky Color", "tooltip.ghost.color": "Base value: 000000", "entry.ghost.fog": "Fog Color", "tooltip.ghost.fog": "Base value: 000000", "entry.ghost.snow": "Screen Texture:", "entry.ghost.cyrus_mode": "Remove Negative Y Coordinates", - "config_category.ghost.time" : "Time Settings", "tooltip.ghost.time": "Set to -1 to turn off custom time", "entry.ghost.time":"Time of Day", "entry.ghost.leaf": "Leave Color", @@ -48,5 +47,11 @@ "entry.ghost.player_model_offset":"Player Model Offset", "tooltip.ghost.technoblade": "Adds crowns to all pigs, RIP Techno", "entry.ghost.version": "Minecraft Version", - "entry.ghost.distance": "Zoom Out Camera Distance" + "entry.ghost.distance": "Zoom Out Camera Distance", + "config_category.ghost.gamemodes": "Gamemodes", + "label.ghost.world_presets": "Presets", + "entry.ghost.plains_color": "Grass Color Always Plains", + "entry.ghost.ocean_color": "Water Color Always Ocean", + "entry.ghost.jungle_color": "Grass Color Always Jungle", + "entry.ghost.sunset": "Time always sunset" } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 6039e1d..c10492f 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -20,6 +20,6 @@ "depends": { "fabricloader": ">=0.12.12", "fabric": "*", - "minecraft": "1.19.x" + "minecraft": ">=1.19.1" } } diff --git a/src/main/resources/ghost.mixins.json b/src/main/resources/ghost.mixins.json index 60e5ca5..f0de013 100644 --- a/src/main/resources/ghost.mixins.json +++ b/src/main/resources/ghost.mixins.json @@ -10,13 +10,11 @@ "ClientPlayerEntityMixin", "ClientWorldMixin", "DebugHudMixin", - "EndPortalRendererMixin", "gameRendererMixin", "MinecraftClientMixin", "PigEntityModelMixin", "PlayerRenderMixin", "ClientWorldPropertiesMixin" - ], "injectors": { "defaultRequire": 1