Added recipe reflection so dyed wool can be turned back to white
parent
f22e87ce8b
commit
8e7c3b4b13
|
@ -1,11 +1,33 @@
|
|||
package xyz.pixelatedw.finalbeta;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
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 MainMod implements ModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
ModConfig.instance();
|
||||
this.addWhiteWoolRecipe();
|
||||
}
|
||||
|
||||
private void addWhiteWoolRecipe() {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,60 +65,10 @@ public class WyHelper {
|
|||
|
||||
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.dropItem(new ItemInstance(Tile.WORKBENCH, 1));
|
||||
// player.dropItem(new ItemInstance(ItemType.chestplateDiamond, 3));
|
||||
|
||||
// ItemInstance item = player.inventory.getHeldItem();
|
||||
// if (item != null) {
|
||||
// item.setDamage(item.method_723() - 200);
|
||||
// }
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue