Fixed slabs hell and fences being raycasted outside of their new boxes
parent
737d8d66f8
commit
76c7f45d78
|
@ -6,8 +6,8 @@ import java.util.HashMap;
|
|||
|
||||
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 xyz.pixelatedw.finalbeta.mixin.MinecraftAccessorMixin;
|
||||
import xyz.pixelatedw.finalbeta.mixin.RecipeRegistryAccessorMixin;
|
||||
|
||||
|
@ -65,10 +65,11 @@ public class WyHelper {
|
|||
|
||||
// player.level.entities.stream().filter(e -> !(e instanceof Player)).forEach((e) -> ((net.minecraft.entity.Entity)e).remove());
|
||||
|
||||
player.dropItem(new ItemInstance(Tile.GOLD_ORE, 64));
|
||||
// player.dropItem(new ItemInstance(Tile.STONE_SLAB, 64));
|
||||
// player.dropItem(new ItemInstance(Tile.SLAB, 64));
|
||||
// player.dropItem(new ItemInstance(ItemType.minecart, 1));
|
||||
// player.dropItem(new ItemInstance(ItemType.minecartFurnace, 1));
|
||||
// player.dropItem(new ItemInstance(ItemType.coal, 64));
|
||||
player.dropItem(new ItemInstance(ItemType.hatchetDiamond, 1));
|
||||
// player.dropItem(new ItemInstance(Tile.GOLDEN_RAIL, 64));
|
||||
// player.dropItem(new ItemInstance(Tile.COBBLESTONE, 64));
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ public class FenceTileMixin extends Tile {
|
|||
}
|
||||
|
||||
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 westCheck = level.getMaterial(x - 1, y, z).isSolid();
|
||||
boolean southCheck = level.getMaterial(x, y, z + 1).isSolid();
|
||||
|
@ -44,6 +46,13 @@ 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);
|
||||
|
||||
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.minY += y;
|
||||
box.minZ += z;
|
||||
|
|
|
@ -7,9 +7,13 @@ 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 net.minecraft.entity.Entity;
|
||||
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;
|
||||
|
||||
@Mixin(ItemInstance.class)
|
||||
|
@ -20,6 +24,9 @@ public class ItemInstanceMixin {
|
|||
@Shadow
|
||||
private int damage;
|
||||
|
||||
@Shadow
|
||||
public int itemId;
|
||||
|
||||
@Inject(method = "applyDamage", at = @At("HEAD"))
|
||||
public void applyDamage(int i, Entity arg, CallbackInfo ci) {
|
||||
if(ModConfig.ADD_MORE_SOUNDS.get()) {
|
||||
|
@ -29,4 +36,15 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,12 @@ import xyz.pixelatedw.finalbeta.ModTile;
|
|||
@Mixin(ToolItem.class)
|
||||
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,
|
||||
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,
|
||||
|
@ -26,7 +32,7 @@ public class ToolItemMixin {
|
|||
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};
|
||||
|
||||
private static final Tile[] HATCHET_BLOCKS = new Tile[]{Tile.WOOD, Tile.BOOKSHELF, Tile.LOG, Tile.CHEST,
|
||||
private static final Tile[] HATCHET_BLOCKS = new Tile[]{Tile.WOOD, Tile.BOOKSHELF, Tile.LOG, Tile.CHEST, Tile.STONE_SLAB,
|
||||
// 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.STANDING_SIGN, Tile.WALL_SIGN, Tile.TRAPDOOR, Tile.LADDER, Tile.WORKBENCH, Tile.FENCE};
|
||||
|
@ -37,11 +43,13 @@ public class ToolItemMixin {
|
|||
Tile.SOUL_SAND};
|
||||
|
||||
@Shadow
|
||||
public Tile[] field_2712;
|
||||
public Tile[] field_2712; // list of tiles the tool is effective against
|
||||
|
||||
@Shadow
|
||||
public float field_2713; // bonus mining speed
|
||||
|
||||
@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) {
|
||||
|
||||
ToolItem tool = ((ToolItem) (Object) this);
|
||||
if (tool instanceof PickaxeItem && ModConfig.FIX_PICKAXE_EFFECTIVENESS.get()) {
|
||||
this.field_2712 = PICKAXE_BLOCKS;
|
||||
|
|
Loading…
Reference in New Issue