Compare commits
4 Commits
7242ef63ec
...
4a76c0fc82
Author | SHA1 | Date |
---|---|---|
Wynd | 4a76c0fc82 | |
Wynd | 8e7c3b4b13 | |
Wynd | f22e87ce8b | |
Wynd | 32c529e391 |
12
README.md
12
README.md
|
@ -71,6 +71,18 @@ Real life days are calculated differently from the world time but are stored in
|
|||
|
||||
</details>
|
||||
|
||||
<details><summary>Items can now be repaired at crafting tables</summary>
|
||||
|
||||
<video controls src="https://i.imgur.com/UrLHQDh.mp4" />
|
||||
|
||||
</details>
|
||||
|
||||
<details><summary>Dyed wool can be turned back into white wool using bone meal</summary>
|
||||
|
||||
<video controls src="https://i.imgur.com/Uwk3K2t.mp4" />
|
||||
|
||||
</details>
|
||||
|
||||
### Fixes
|
||||
|
||||
<details><summary>Fixes selected blocks being rendered under text in containers</summary>
|
||||
|
|
|
@ -9,6 +9,6 @@ plasma_build=22
|
|||
api_version=1.1.0.1
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0.0
|
||||
mod_version = 1.1.0
|
||||
maven_group = xyz.pixelatedw.finalbeta
|
||||
archives_base_name = finalbeta
|
||||
|
|
|
@ -32,6 +32,10 @@ public class ModConfig {
|
|||
"Allows the player to drop the entire stack they're holding using Shift + Q (or whatever drop key they have set)");
|
||||
public static final Option<Boolean> ENABLE_TIME_TRACKING = make("Enable Time Tracking", true,
|
||||
"Adds a Days Played entry in the F3 overlay displaying number of ingame days and real life days played in that world");
|
||||
public static final Option<Boolean> ENABLE_REPAIR = make("Enable Item Repair", true,
|
||||
"Allows 2 or more items of the same type to be repaired using a crafting table using the same formula as modern day vanilla uses");
|
||||
public static final Option<Boolean> ENABLE_WHITE_WOOL_RECIPE = make("Enable White Wool Recipe", true,
|
||||
"Allows dyed wool to be dyed back white using bone meal");
|
||||
|
||||
public static final Option<Boolean> FIX_BOW_MODEL = make("Fix bow model", true,
|
||||
"Makes the box model held by players and skeletons bigger and facing forward");
|
||||
|
|
|
@ -2,11 +2,17 @@ package xyz.pixelatedw.finalbeta;
|
|||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.Player;
|
||||
import net.minecraft.item.ItemInstance;
|
||||
import net.minecraft.item.ItemType;
|
||||
import net.minecraft.recipe.RecipeRegistry;
|
||||
import net.minecraft.tile.Tile;
|
||||
import net.minecraft.tile.WoolTile;
|
||||
|
||||
public class WyHelper {
|
||||
|
||||
|
@ -31,10 +37,10 @@ public class WyHelper {
|
|||
return INSTANCE;
|
||||
} else {
|
||||
try {
|
||||
Field f = Minecraft.class.getDeclaredField("instance");
|
||||
Field f = Minecraft.class.getDeclaredFields()[1];
|
||||
f.setAccessible(true);
|
||||
return (Minecraft) f.get(null);
|
||||
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
|
||||
} catch (SecurityException | IllegalArgumentException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
|
@ -63,54 +69,25 @@ public class WyHelper {
|
|||
return val < min ? min : Math.min(val, max);
|
||||
}
|
||||
|
||||
public static void registerWhiteWoolRecipe() {
|
||||
Method method = RecipeRegistry.class.getDeclaredMethods()[2];
|
||||
method.setAccessible(true);
|
||||
try {
|
||||
// Makes new recipes for all colored wools so they can be dyed back white using bone meal
|
||||
for (int colorId = 0; colorId < 16; ++colorId) {
|
||||
method.invoke(RecipeRegistry.getInstance(), new ItemInstance(Tile.WOOL, 1, 0), new Object[]{
|
||||
new ItemInstance(Tile.WOOL, 1, WoolTile.method_2(colorId)), new ItemInstance(ItemType.dyePowder, 1, 15)});
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void cheatCommand(Player player) {
|
||||
|
||||
// player.dropItem(new ItemInstance(Tile.LEVER, 1));
|
||||
|
||||
// int x = MathsHelper.floor(player.x);
|
||||
// int y = MathsHelper.floor(player.boundingBox.minY);
|
||||
// int z = MathsHelper.floor(player.z);
|
||||
// int lightLevel = player.level.getLightLevel(x, y, z);
|
||||
// System.out.println(lightLevel);
|
||||
|
||||
// player.dropItem(new ItemInstance(ItemType.swordDiamond, 1));
|
||||
// player.dropItem(new ItemInstance(Tile.TORCH, 64));
|
||||
// player.dropItem(new ItemInstance(Tile.BED, 64));
|
||||
|
||||
// player.dropItem(new ItemInstance(Tile.FENCE, 64));
|
||||
// player.dropItem(new ItemInstance(Tile.BUTTON, 64));
|
||||
|
||||
// player.dropItem(new ItemInstance(Tile.BOOKSHELF, 64));
|
||||
|
||||
// player.dropItem(new ItemInstance(Tile.SNOW));
|
||||
// Random rand = new Random();
|
||||
// player.level.playSound(player, "random.break", 1, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
|
||||
|
||||
// player.dropItem(new ItemInstance(ItemType.hatchetDiamond, 1), false);
|
||||
// player.dropItem(new ItemInstance(ItemType.shovelDiamond, 1), false);
|
||||
// player.dropItem(new ItemInstance(Tile.CLAY, 128), false);
|
||||
// player.dropItem(new ItemInstance(Tile.GOLD_ORE, 64), false);
|
||||
|
||||
// player.dropItem(new ItemInstance(ItemType.bow, 1), false);
|
||||
// player.dropItem(new ItemInstance(ItemType.arrow, 64), false);
|
||||
// player.dropItem(new ItemInstance(Tile.STONE, 64), false);
|
||||
|
||||
// player.level.playLevelEvent((Player)null, 1005, (int)player.x, (int)player.y, (int)player.z, 0);
|
||||
|
||||
// player.dropItem(new ItemInstance(Tile.REDSTONE_TORCH_LIT, 64), false);
|
||||
// player.dropItem(new ItemInstance(Tile.RAIL, 64), false);
|
||||
// player.dropItem(new ItemInstance(Tile.GOLDEN_RAIL, 64), false);
|
||||
|
||||
// player.dropItem(new ItemInstance(ItemType.saddle, 1));
|
||||
//
|
||||
// Pig animal = new Pig(player.level);
|
||||
// animal.setPositionAndAngles(player.x + 2, player.y, player.z, 0.0f, 0.0f);
|
||||
// player.level.spawnEntity(animal);
|
||||
|
||||
player.level.setLevelTime(0);
|
||||
player.level.getProperties().setRaining(false);
|
||||
player.level.getProperties().setRainTime(0);
|
||||
player.level.getProperties().setThundering(false);
|
||||
player.level.getProperties().setThunderTime(0);
|
||||
// player.level.setLevelTime(0);
|
||||
// player.level.getProperties().setRaining(false);
|
||||
// player.level.getProperties().setRainTime(0);
|
||||
// player.level.getProperties().setThundering(false);
|
||||
// player.level.getProperties().setThunderTime(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package xyz.pixelatedw.finalbeta.mixin;
|
||||
|
||||
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 net.minecraft.container.CraftingContainer;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.item.ItemInstance;
|
||||
import xyz.pixelatedw.finalbeta.ModConfig;
|
||||
|
||||
@Mixin(CraftingContainer.class)
|
||||
public class CraftingContainerMixin {
|
||||
|
||||
@Inject(method = "onContentsChanged", at = @At("HEAD"), cancellable = true)
|
||||
public void onContentsChanged(Inventory inventory, CallbackInfo ci) {
|
||||
if (!ModConfig.ENABLE_REPAIR.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CraftingContainer container = ((CraftingContainer)(Object)this);
|
||||
|
||||
ItemInstance resultItem = null;
|
||||
int defaultDamage = 0;
|
||||
int damage = 0;
|
||||
|
||||
for (int i = 0; i < inventory.getInvSize(); i++) {
|
||||
ItemInstance item = inventory.getInvItem(i);
|
||||
if (item != null && item.method_723() > 0) {
|
||||
if (resultItem == null) {
|
||||
resultItem = new ItemInstance(item.itemId, 1, item.getDamage());
|
||||
defaultDamage = item.method_723() - item.getDamage();
|
||||
} else if (item.itemId == resultItem.itemId) {
|
||||
damage += item.method_723() - item.getDamage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (resultItem != null && damage > 0) {
|
||||
int newDurability = (int) (defaultDamage + damage + Math.floor(resultItem.method_723() / 20));
|
||||
newDurability = Math.min(newDurability, resultItem.method_723());
|
||||
|
||||
if (newDurability != defaultDamage) {
|
||||
resultItem.setDamage(resultItem.method_723() - newDurability);
|
||||
container.result.setInvItem(0, resultItem);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package xyz.pixelatedw.finalbeta.mixin;
|
||||
|
||||
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 net.minecraft.container.Container;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import xyz.pixelatedw.finalbeta.ModConfig;
|
||||
import xyz.pixelatedw.finalbeta.WyHelper;
|
||||
|
||||
@Mixin(CraftingInventory.class)
|
||||
public class CraftingInventoryMixin {
|
||||
|
||||
private static boolean hasCustomRecipesRegistered = false;
|
||||
|
||||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
public void init(Container container, int x, int y, CallbackInfo ci) {
|
||||
if (ModConfig.ENABLE_WHITE_WOOL_RECIPE.get() && !hasCustomRecipesRegistered) {
|
||||
WyHelper.registerWhiteWoolRecipe();
|
||||
hasCustomRecipesRegistered = true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ import xyz.pixelatedw.finalbeta.WyHelper;
|
|||
@Mixin(Level.class)
|
||||
public class LevelMixin {
|
||||
|
||||
@Inject(method = "method_242", at = @At(value = "INVOKE", target = "Lnet/minecraft/level/LevelMonsterSpawner;method_1870"))
|
||||
@Inject(method = "method_242", at = @At(value = "INVOKE", target = "Lnet/minecraft/level/LevelMonsterSpawner;method_1870(Lnet/minecraft/level/Level;ZZ)V"))
|
||||
public void tick(CallbackInfo ci) {
|
||||
WyHelper.playTime++;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import xyz.pixelatedw.finalbeta.ModConfig;
|
|||
@Mixin(Minecraft.class)
|
||||
public class MinecraftMixin {
|
||||
|
||||
@Redirect(method = "init()V", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/Display;create()V"))
|
||||
@Redirect(method = "init()V", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/Display;create()V"), remap = false)
|
||||
public void createDisplay() throws LWJGLException {
|
||||
// Why the fuck is this even a thing ? What was its intended purpose ? I NEED TO KNOW
|
||||
Minecraft.field_2800 = null;
|
||||
|
|
|
@ -25,16 +25,17 @@ public class OverlayMixin extends DrawableHelper {
|
|||
method = "render(FZII)V",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lorg/lwjgl/opengl/GL11;glPopMatrix()V"
|
||||
target = "Lorg/lwjgl/opengl/GL11;glPopMatrix()V",
|
||||
remap = false
|
||||
),
|
||||
slice = @Slice(
|
||||
from = @At(
|
||||
value = "INVOKE",
|
||||
target = "drawTextWithShadow(Lnet/minecraft/client/render/TextRenderer;Ljava/lang/String;III)V"
|
||||
target = "Lnet/minecraft/client/gui/Overlay;drawTextWithShadow(Lnet/minecraft/client/render/TextRenderer;Ljava/lang/String;III)V"
|
||||
),
|
||||
to = @At(
|
||||
value = "FIELD",
|
||||
target = "jukeboxMessageTime:I",
|
||||
target = "Lnet/minecraft/client/gui/Overlay;jukeboxMessageTime:I",
|
||||
opcode = Opcodes.GETFIELD
|
||||
)
|
||||
)
|
||||
|
|
|
@ -36,7 +36,9 @@
|
|||
"BoatMixin",
|
||||
"LevelPropertiesMixin",
|
||||
"LevelMixin",
|
||||
"DoorTileMixin"
|
||||
"DoorTileMixin",
|
||||
"CraftingContainerMixin",
|
||||
"CraftingInventoryMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": -1
|
||||
|
|
Loading…
Reference in New Issue