Skip to content

Commit

Permalink
add: wrappers for methods with coordinates from BlockFalling, BlockFa…
Browse files Browse the repository at this point in the history
…rmland, BlockFire, BlockFlowerPot, BlockFurnace, BlockHopper, BlockJukebox, BlockLeaves, BlockLever, BlockMushroom, BlockPane, BlockPistonBase, BlockPistonMoving, BlockPortal, BlockRailBase and BlockRailDetector to BlockPos;
  • Loading branch information
MJaroslav committed Apr 28, 2024
1 parent 4f1b83d commit cf36049
Show file tree
Hide file tree
Showing 14 changed files with 553 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.github.mjaroslav.mjutils.asm.mixin.accessors;

import net.minecraft.block.BlockFalling;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(BlockFalling.class)
public interface AccessorBlockFalling {
@Invoker("func_149830_m")
void tryFall(@NotNull World world, int x, int y, int z);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.github.mjaroslav.mjutils.asm.mixin.accessors;

import net.minecraft.block.BlockFarmland;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(BlockFarmland.class)
public interface AccessorBlockFarmland {
@Invoker("func_149822_e")
boolean isEmpty(@NotNull World world, int x, int y, int z);

@Invoker("func_149821_m")
boolean isMoistened(@NotNull World world, int x, int y, int z);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.github.mjaroslav.mjutils.asm.mixin.accessors;

import net.minecraft.block.BlockFire;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

import java.util.Random;

@Mixin(BlockFire.class)
public interface AccessorBlockFire {
@Invoker("tryCatchFire")
void tryCatchFire(@NotNull World world, int x, int y, int z, int chance, @NotNull Random rand, int meta);

@Invoker("tryCatchFire")
void tryCatchFire(@NotNull World world, int x, int y, int z, int chance, @NotNull Random rand, int meta,
@NotNull ForgeDirection side);

@Invoker("canNeighborBurn")
boolean canNeighborBurn(@NotNull World world, int x, int y, int z);

@Invoker("getChanceOfNeighborsEncouragingFire")
int getChanceOfNeighborsEncouragingFire(@NotNull World world, int x, int y, int z);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.github.mjaroslav.mjutils.asm.mixin.accessors;

import net.minecraft.block.BlockFlowerPot;
import net.minecraft.tileentity.TileEntityFlowerPot;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(BlockFlowerPot.class)
public interface AccessorBlockFlowerPot {
@Invoker("func_149929_e")
@Nullable
TileEntityFlowerPot getFlowerPotTileEntity(@NotNull World world, int x, int y, int z);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.github.mjaroslav.mjutils.asm.mixin.accessors;

import net.minecraft.block.BlockFurnace;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(BlockFurnace.class)
public interface AccessorBlockFurnace {
@Invoker("func_149930_e")
void rotateFaceToFreeSide(@NotNull World world, int x, int y, int z);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.github.mjaroslav.mjutils.asm.mixin.accessors;

import net.minecraft.block.BlockHopper;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(BlockHopper.class)
public interface AccessorBlockHopper {
@Invoker("func_149919_e")
void updateHopperBlockState(@NotNull World world, int x, int y, int z);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.github.mjaroslav.mjutils.asm.mixin.accessors;

import net.minecraft.block.BlockLeaves;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(BlockLeaves.class)
public interface AccessorBlockLeaves {
@Invoker("removeLeaves")
void removeLeaves(@NotNull World world, int x, int y, int z);

@Invoker("func_150124_c")
void dropExtra(@NotNull World world, int x, int y, int z, int meta, int chance);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.github.mjaroslav.mjutils.asm.mixin.accessors;

import net.minecraft.block.BlockLever;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(BlockLever.class)
public interface AccessorBlockLever {
@Invoker("func_149820_e")
boolean checkAndDropBlock(@NotNull World world, int x, int y, int z);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package io.github.mjaroslav.mjutils.asm.mixin.accessors;

import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(BlockPistonBase.class)
public interface AccessorBlockPistonBase {
@Invoker("updatePistonState")
void updatePistonState(@NotNull World world, int x, int y, int z);

@Invoker("isIndirectlyPowered")
boolean isIndirectlyPowered(@NotNull World world, int x, int y, int z, int orientation);

@Invoker("canPushBlock")
static boolean canPushBlock(@NotNull Block blockToPush, @NotNull World world, int x, int y, int z,
boolean moveFlag) {
throw new AssertionError();
}

@Invoker("canExtend")
static boolean canExtend(@NotNull World world, int x, int y, int z, int orientation) {
throw new AssertionError();
}

@Invoker("tryExtend")
boolean tryExtend(@NotNull World world, int x, int y, int z, int orientation);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.github.mjaroslav.mjutils.asm.mixin.accessors;

import net.minecraft.block.BlockPistonMoving;
import net.minecraft.tileentity.TileEntityPiston;
import net.minecraft.world.IBlockAccess;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(BlockPistonMoving.class)
public interface AccessorBlockPistonMoving {
@Invoker("func_149963_e")
@Nullable
TileEntityPiston getPistonMovingTileEntity(@NotNull IBlockAccess world, int x, int y, int z);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.github.mjaroslav.mjutils.asm.mixin.accessors;

import net.minecraft.block.Block;
import net.minecraft.block.BlockRailBase;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(BlockRailBase.class)
public interface AccessorBlockRailBase {
@Invoker("func_150048_a")
void onRailNeighborBlockChange(@NotNull World p_150048_1_, int x, int y, int z, int meta, int baseMeta,
@NotNull Block block);

@Invoker("func_150052_a")
void updateRailBaseBlockState(@NotNull World world, int x, int y, int z, boolean forceUpdate);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.github.mjaroslav.mjutils.asm.mixin.accessors;

import net.minecraft.block.BlockRailDetector;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(BlockRailDetector.class)
public interface AccessorBlockRailDetector {
@Invoker("func_150054_a")
void updateRailDetectorBlockState(@NotNull World world, int x, int y, int z, int meta);
}
Loading

0 comments on commit cf36049

Please sign in to comment.