Compare commits

..

No commits in common. "76c7f45d781accfb5c0409ae2e0865e8717d5059" and "0f391bb92ebfc39134638b485afdd0f4e25987dc" have entirely different histories.

6 changed files with 13 additions and 88 deletions

View File

@ -18,16 +18,14 @@ public class MainMod implements ModInitializer {
if (ModConfig.ENABLE_WHITE_WOOL_RECIPE.get()) { if (ModConfig.ENABLE_WHITE_WOOL_RECIPE.get()) {
for (int colorId = 0; colorId < 16; ++colorId) { for (int colorId = 0; colorId < 16; ++colorId) {
WyHelper.addShapelessRecipe(new ItemInstance(Tile.WOOL, 1, 0), new ItemInstance(Tile.WOOL, 1, WoolTile.method_2(colorId)), WyHelper.addShapelessRecipe(new ItemInstance(Tile.WOOL, 1, 0), new Object[]{
new ItemInstance(ItemType.dyePowder, 1, 15)); new ItemInstance(Tile.WOOL, 1, WoolTile.method_2(colorId)), new ItemInstance(ItemType.dyePowder, 1, 15)});
} }
} }
if (ModConfig.ENABLE_COAL_AND_REDSTONE_BLOCKS_RECIPE.get()) { if (ModConfig.ENABLE_COAL_AND_REDSTONE_BLOCKS_RECIPE.get()) {
WyHelper.addShapedRecipe(new ItemInstance(ModTile.COAL_BLOCK, 1, 0), "###", "###", "###", '#', ItemType.coal); WyHelper.addShapedRecipe(new ItemInstance(ModTile.COAL_BLOCK, 1, 0), "###", "###", "###", '#', ItemType.coal);
WyHelper.addShapelessRecipe(new ItemInstance(ItemType.coal, 9), new ItemInstance(ModTile.COAL_BLOCK, 1));
WyHelper.addShapedRecipe(new ItemInstance(ModTile.REDSTONE_BLOCK, 1, 0), "###", "###", "###", '#', ItemType.redstone); WyHelper.addShapedRecipe(new ItemInstance(ModTile.REDSTONE_BLOCK, 1, 0), "###", "###", "###", '#', ItemType.redstone);
WyHelper.addShapelessRecipe(new ItemInstance(ItemType.redstone, 9), new ItemInstance(ModTile.REDSTONE_BLOCK, 1));
} }
} }
} }

View File

@ -6,7 +6,6 @@ import java.util.HashMap;
import net.minecraft.entity.player.Player; import net.minecraft.entity.player.Player;
import net.minecraft.item.ItemInstance; import net.minecraft.item.ItemInstance;
import net.minecraft.item.ItemType;
import net.minecraft.recipe.RecipeRegistry; import net.minecraft.recipe.RecipeRegistry;
import xyz.pixelatedw.finalbeta.mixin.MinecraftAccessorMixin; import xyz.pixelatedw.finalbeta.mixin.MinecraftAccessorMixin;
import xyz.pixelatedw.finalbeta.mixin.RecipeRegistryAccessorMixin; import xyz.pixelatedw.finalbeta.mixin.RecipeRegistryAccessorMixin;
@ -65,11 +64,10 @@ public class WyHelper {
// player.level.entities.stream().filter(e -> !(e instanceof Player)).forEach((e) -> ((net.minecraft.entity.Entity)e).remove()); // player.level.entities.stream().filter(e -> !(e instanceof Player)).forEach((e) -> ((net.minecraft.entity.Entity)e).remove());
// player.dropItem(new ItemInstance(Tile.STONE_SLAB, 64)); // player.dropItem(new ItemInstance(Tile.LADDER, 64));
// player.dropItem(new ItemInstance(Tile.SLAB, 64));
// player.dropItem(new ItemInstance(ItemType.minecart, 1)); // player.dropItem(new ItemInstance(ItemType.minecart, 1));
// player.dropItem(new ItemInstance(ItemType.minecartFurnace, 1)); // player.dropItem(new ItemInstance(ItemType.minecartFurnace, 1));
player.dropItem(new ItemInstance(ItemType.hatchetDiamond, 1)); // player.dropItem(new ItemInstance(ItemType.coal, 64));
// player.dropItem(new ItemInstance(Tile.GOLDEN_RAIL, 64)); // player.dropItem(new ItemInstance(Tile.GOLDEN_RAIL, 64));
// player.dropItem(new ItemInstance(Tile.COBBLESTONE, 64)); // player.dropItem(new ItemInstance(Tile.COBBLESTONE, 64));
@ -83,10 +81,10 @@ public class WyHelper {
// player.level.setTile(x + i, y, z, Tile.REDSTONE_TORCH_LIT.id); // player.level.setTile(x + i, y, z, Tile.REDSTONE_TORCH_LIT.id);
// } // }
player.level.setLevelTime(0); // player.level.setLevelTime(0);
player.level.getProperties().setRaining(false); // player.level.getProperties().setRaining(false);
player.level.getProperties().setRainTime(0); // player.level.getProperties().setRainTime(0);
player.level.getProperties().setThundering(false); // player.level.getProperties().setThundering(false);
player.level.getProperties().setThunderTime(0); // player.level.getProperties().setThunderTime(0);
} }
} }

View File

@ -37,8 +37,6 @@ public class FenceTileMixin extends Tile {
} }
private Box createFenceBox(Level level, int x, int y, int z, boolean isOutline) { private Box createFenceBox(Level level, int x, int y, int z, boolean isOutline) {
Tile tile = ((FenceTile)(Object)this);
boolean eastCheck = level.getMaterial(x + 1, y, z).isSolid(); boolean eastCheck = level.getMaterial(x + 1, y, z).isSolid();
boolean westCheck = level.getMaterial(x - 1, y, z).isSolid(); boolean westCheck = level.getMaterial(x - 1, y, z).isSolid();
boolean southCheck = level.getMaterial(x, y, z + 1).isSolid(); boolean southCheck = level.getMaterial(x, y, z + 1).isSolid();
@ -46,13 +44,6 @@ public class FenceTileMixin extends Tile {
Box box = Box.create(westCheck ? 0 : 0.375f, 0.0f, northCheck ? 0.0f : 0.375f, eastCheck ? 1.0f : 0.625f, 1.0F, southCheck ? 1.0f : 0.625f); Box box = Box.create(westCheck ? 0 : 0.375f, 0.0f, northCheck ? 0.0f : 0.375f, eastCheck ? 1.0f : 0.625f, 1.0F, southCheck ? 1.0f : 0.625f);
tile.minX = westCheck ? 0 : 0.375f;
tile.minY = 0.0;
tile.minZ = northCheck ? 0.0f : 0.375f;
tile.maxX = eastCheck ? 1.0f : 0.625f;
tile.maxY = 1.0f;
tile.maxZ = southCheck ? 1.0f : 0.625f;
box.minX += x; box.minX += x;
box.minY += y; box.minY += y;
box.minZ += z; box.minZ += z;

View File

@ -5,21 +5,15 @@ import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.entity.FurnaceEntity; import net.minecraft.entity.FurnaceEntity;
import net.minecraft.item.ItemInstance; import net.minecraft.item.ItemInstance;
import net.minecraft.item.ItemType; import net.minecraft.item.ItemType;
import net.minecraft.util.io.CompoundTag;
import xyz.pixelatedw.finalbeta.ModConfig; import xyz.pixelatedw.finalbeta.ModConfig;
import xyz.pixelatedw.finalbeta.ModTile;
@Mixin(FurnaceEntity.class) @Mixin(FurnaceEntity.class)
public class FurnaceEntityMixin { public class FurnaceEntityMixin {
@Shadow
public int fuelTime;
@Shadow @Shadow
private ItemInstance[] contents; private ItemInstance[] contents;
@ -32,34 +26,4 @@ public class FurnaceEntityMixin {
} }
} }
} }
@Inject(method = "getFuelTime", at = @At("HEAD"), cancellable = true)
private void getFuelTime(ItemInstance stack, CallbackInfoReturnable<Integer> cir) {
if (stack == null) {
cir.setReturnValue(0);
return;
}
if (stack.getType().id == ModTile.COAL_BLOCK.id) {
cir.setReturnValue(16000);
return;
}
}
/*
* Properly saving and loading the fuelTime as otherwise minecraft tries to
* get it from the fuel item slot, which can be empty...and so the fuel time
* defaults to 200. By saving it we make sure the fuel time is always
* correct regardless of the fuel slot contents.
*/
@Inject(method = "writeIdentifyingData", at = @At("TAIL"))
public void writeIdentifyingData(CompoundTag tag, CallbackInfo ci) {
tag.put("FuelTime", this.fuelTime);
}
@Inject(method = "readIdentifyingData", at = @At("TAIL"))
public void readIdentifyingData(CompoundTag tag, CallbackInfo ci) {
this.fuelTime = tag.getInt("FuelTime");
}
} }

View File

@ -7,13 +7,9 @@ import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.item.ItemInstance; import net.minecraft.item.ItemInstance;
import net.minecraft.item.ItemType;
import net.minecraft.item.tool.HatchetItem;
import net.minecraft.tile.Tile;
import xyz.pixelatedw.finalbeta.ModConfig; import xyz.pixelatedw.finalbeta.ModConfig;
@Mixin(ItemInstance.class) @Mixin(ItemInstance.class)
@ -24,9 +20,6 @@ public class ItemInstanceMixin {
@Shadow @Shadow
private int damage; private int damage;
@Shadow
public int itemId;
@Inject(method = "applyDamage", at = @At("HEAD")) @Inject(method = "applyDamage", at = @At("HEAD"))
public void applyDamage(int i, Entity arg, CallbackInfo ci) { public void applyDamage(int i, Entity arg, CallbackInfo ci) {
if(ModConfig.ADD_MORE_SOUNDS.get()) { if(ModConfig.ADD_MORE_SOUNDS.get()) {
@ -36,15 +29,4 @@ public class ItemInstanceMixin {
} }
} }
} }
@Inject(method = "isEffectiveOn", at = @At("HEAD"), cancellable = true)
public void isEffectiveOn(Tile tile, CallbackInfoReturnable<Boolean> cir) {
ItemType item = ItemType.byId[this.itemId];
if (item instanceof HatchetItem && Tile.STONE_SLAB.id == tile.id) {
cir.setReturnValue(true);
return;
}
}
} }

View File

@ -18,12 +18,6 @@ import xyz.pixelatedw.finalbeta.ModTile;
@Mixin(ToolItem.class) @Mixin(ToolItem.class)
public class ToolItemMixin { public class ToolItemMixin {
/*
* Note that "STONE_SLAB" is actually all 4 variations of slabs in 1 block...which is stupid as fuck
* because there's no easy to check for the block and its metadata on breaking time for the bonus the
* absolute easiest and laziest way out of this is to make both pickaxes and axes effective against slabs.
*/
private static final Tile[] PICKAXE_BLOCKS = new Tile[]{Tile.COBBLESTONE, Tile.DOUBLE_STONE_SLAB, Tile.STONE_SLAB, Tile.STONE, private static final Tile[] PICKAXE_BLOCKS = new Tile[]{Tile.COBBLESTONE, Tile.DOUBLE_STONE_SLAB, Tile.STONE_SLAB, Tile.STONE,
Tile.SANDSTONE, Tile.MOSSY_COBBLESTONE, Tile.IRON_ORE, Tile.BLOCK_IRON, Tile.COAL_ORE, Tile.BLOCK_GOLD, Tile.GOLD_ORE, Tile.SANDSTONE, Tile.MOSSY_COBBLESTONE, Tile.IRON_ORE, Tile.BLOCK_IRON, Tile.COAL_ORE, Tile.BLOCK_GOLD, Tile.GOLD_ORE,
Tile.DIAMOND_ORE, Tile.BLOCK_DIAMOND, Tile.ICE, Tile.NETHERRACK, Tile.LAPIS_LAZULI_ORE, Tile.LAPIS_LAZULI_BLOCK, Tile.DIAMOND_ORE, Tile.BLOCK_DIAMOND, Tile.ICE, Tile.NETHERRACK, Tile.LAPIS_LAZULI_ORE, Tile.LAPIS_LAZULI_BLOCK,
@ -32,7 +26,7 @@ public class ToolItemMixin {
Tile.DISPENSER, Tile.STONE_PRESSURE_PLATE, Tile.RAIL, Tile.DETECTOR_RAIL, Tile.GOLDEN_RAIL, Tile.PISTON, Tile.STICKY_PISTON, Tile.DISPENSER, Tile.STONE_PRESSURE_PLATE, Tile.RAIL, Tile.DETECTOR_RAIL, Tile.GOLDEN_RAIL, Tile.PISTON, Tile.STICKY_PISTON,
ModTile.COAL_BLOCK, ModTile.REDSTONE_BLOCK}; ModTile.COAL_BLOCK, ModTile.REDSTONE_BLOCK};
private static final Tile[] HATCHET_BLOCKS = new Tile[]{Tile.WOOD, Tile.BOOKSHELF, Tile.LOG, Tile.CHEST, Tile.STONE_SLAB, private static final Tile[] HATCHET_BLOCKS = new Tile[]{Tile.WOOD, Tile.BOOKSHELF, Tile.LOG, Tile.CHEST,
// Here starts the list of blocks that are not affected by default // Here starts the list of blocks that are not affected by default
Tile.STAIRS_WOOD, Tile.DOOR_WOOD, Tile.WOODEN_PRESSURE_PLATE, Tile.JUKEBOX, Tile.NOTEBLOCK, Tile.PUMPKIN, Tile.LIT_PUMPKIN, Tile.STAIRS_WOOD, Tile.DOOR_WOOD, Tile.WOODEN_PRESSURE_PLATE, Tile.JUKEBOX, Tile.NOTEBLOCK, Tile.PUMPKIN, Tile.LIT_PUMPKIN,
Tile.STANDING_SIGN, Tile.WALL_SIGN, Tile.TRAPDOOR, Tile.LADDER, Tile.WORKBENCH, Tile.FENCE}; Tile.STANDING_SIGN, Tile.WALL_SIGN, Tile.TRAPDOOR, Tile.LADDER, Tile.WORKBENCH, Tile.FENCE};
@ -43,13 +37,11 @@ public class ToolItemMixin {
Tile.SOUL_SAND}; Tile.SOUL_SAND};
@Shadow @Shadow
public Tile[] field_2712; // list of tiles the tool is effective against public Tile[] field_2712;
@Shadow
public float field_2713; // bonus mining speed
@Inject(method = "<init>(IILnet/minecraft/item/tool/ToolMaterial;[Lnet/minecraft/tile/Tile;)V", at = @At("TAIL")) @Inject(method = "<init>(IILnet/minecraft/item/tool/ToolMaterial;[Lnet/minecraft/tile/Tile;)V", at = @At("TAIL"))
public void init(int i, int j, ToolMaterial arg, Tile[] args, CallbackInfo ci) { public void init(int i, int j, ToolMaterial arg, Tile[] args, CallbackInfo ci) {
ToolItem tool = ((ToolItem) (Object) this); ToolItem tool = ((ToolItem) (Object) this);
if (tool instanceof PickaxeItem && ModConfig.FIX_PICKAXE_EFFECTIVENESS.get()) { if (tool instanceof PickaxeItem && ModConfig.FIX_PICKAXE_EFFECTIVENESS.get()) {
this.field_2712 = PICKAXE_BLOCKS; this.field_2712 = PICKAXE_BLOCKS;