-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: wrappers for methods with coordinates from BlockBasePressurePlat…
…e, BlockBed, BlockBush, BlockButton, BlockCake, BlockCauldron, BlockChest, BlockCrops, BlockDispenser to BlockPos; add: wrappers for methods with coordinates from Item to ItemPos;
- Loading branch information
Showing
10 changed files
with
395 additions
and
41 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
.../java/io/github/mjaroslav/mjutils/asm/mixin/accessors/AccessorBlockBasePressurePlate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.github.mjaroslav.mjutils.asm.mixin.accessors; | ||
|
||
import net.minecraft.block.BlockBasePressurePlate; | ||
import net.minecraft.world.World; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(BlockBasePressurePlate.class) | ||
public interface AccessorBlockBasePressurePlate { | ||
@Invoker("func_150065_e") | ||
int getRedstonePowerByCollidedEntities(@NotNull World world, int x, int y, int z); | ||
|
||
@Invoker("func_150062_a") | ||
void updateAndPlayEffects(@NotNull World world, int x, int y, int z, int meta); | ||
|
||
@Invoker("func_150064_a_") | ||
void notifyBlocksOfNeighborChange(@NotNull World world, int x, int y, int z); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/io/github/mjaroslav/mjutils/asm/mixin/accessors/AccessorBlockBush.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.BlockBush; | ||
import net.minecraft.world.World; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(BlockBush.class) | ||
public interface AccessorBlockBush { | ||
@Invoker("checkAndDropBlock") | ||
void checkAndDropBlock(@NotNull World world, int x, int y, int z); | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/io/github/mjaroslav/mjutils/asm/mixin/accessors/AccessorBlockButton.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.github.mjaroslav.mjutils.asm.mixin.accessors; | ||
|
||
import net.minecraft.block.BlockButton; | ||
import net.minecraft.world.World; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(BlockButton.class) | ||
public interface AccessorBlockButton { | ||
@Invoker("func_150045_e") | ||
int getRotatedMetaByNeighbors(@NotNull World world, int x, int y, int z); | ||
|
||
@Invoker("func_150044_m") | ||
boolean checkAndDropBlock(@NotNull World world, int x, int y, int z); | ||
|
||
@Invoker("func_150046_n") | ||
void updateAndPlayEffects(@NotNull World world, int x, int y, int z); | ||
|
||
@Invoker("func_150042_a") | ||
void notifyBlocksOfNeighborChange(@NotNull World world, int x, int y, int z, int meta); | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/io/github/mjaroslav/mjutils/asm/mixin/accessors/AccessorBlockCake.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.github.mjaroslav.mjutils.asm.mixin.accessors; | ||
|
||
import net.minecraft.block.BlockCake; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.world.World; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(BlockCake.class) | ||
public interface AccessorBlockCake { | ||
@Invoker("func_150036_b") | ||
void eatCake(@NotNull World world, int x, int y, int z, @NotNull EntityPlayer eater); | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/io/github/mjaroslav/mjutils/asm/mixin/accessors/AccessorBlockChest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.BlockChest; | ||
import net.minecraft.inventory.IInventory; | ||
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(BlockChest.class) | ||
public interface AccessorBlockChest { | ||
@Invoker("func_149954_e") | ||
void rotateAndConnect(@NotNull World world, int x, int y, int z); | ||
|
||
@Invoker("func_149952_n") | ||
boolean isSameBlockAround(@NotNull World world, int x, int y, int z); | ||
|
||
@Invoker("func_149951_m") | ||
@Nullable IInventory getInventory(@NotNull World world, int x, int y, int z); | ||
|
||
@Invoker("func_149953_o") | ||
static boolean isOcelotSittingOnChest(@NotNull World world, int x, int y, int z) { | ||
throw new AssertionError(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/io/github/mjaroslav/mjutils/asm/mixin/accessors/AccessorBlockCrops.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.BlockCrops; | ||
import net.minecraft.world.World; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(BlockCrops.class) | ||
public interface AccessorBlockCrops { | ||
@Invoker("func_149864_n") | ||
float calculateGrowthChance(@NotNull World world, int x, int y, int z); | ||
|
||
@Invoker("func_149863_m") | ||
void tryGrowth(@NotNull World world, int x, int y, int z); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/io/github/mjaroslav/mjutils/asm/mixin/accessors/AccessorBlockDispenser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.BlockDispenser; | ||
import net.minecraft.world.World; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(BlockDispenser.class) | ||
public interface AccessorBlockDispenser { | ||
@Invoker("func_149941_e") | ||
void updateAndPlayEffects(@NotNull World world, int x, int y, int z); | ||
} |
251 changes: 211 additions & 40 deletions
251
src/main/java/io/github/mjaroslav/mjutils/pos/BlockPos.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,61 @@ | ||
package io.github.mjaroslav.mjutils.pos; | ||
|
||
import io.github.mjaroslav.sharedjava.tuple.Triplet; | ||
import lombok.experimental.UtilityClass; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.world.World; | ||
import net.minecraftforge.common.util.ForgeDirection; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
@UtilityClass | ||
public class ItemPos { | ||
// TODO: WIP | ||
//region Item | ||
//------------------------- | ||
public boolean onItemUse(@NotNull Item owner, @NotNull ItemStack stack, @NotNull EntityPlayer user, | ||
@NotNull World world, | ||
@NotNull Triplet<? extends Number, ? extends Number, ? extends Number> pos, | ||
@NotNull ForgeDirection side, | ||
@NotNull Triplet<? extends Number, ? extends Number, ? extends Number> hitPos) { | ||
return owner.onItemUse(stack, user, world, pos.getX().intValue(), pos.getY().intValue(), pos.getZ().intValue(), | ||
side.ordinal(), hitPos.getX().floatValue(), hitPos.getY().floatValue(), hitPos.getZ().floatValue()); | ||
} | ||
|
||
public boolean onBlockDestroyed(@NotNull Item owner, @NotNull ItemStack stack, @NotNull World world, | ||
@NotNull Block block, | ||
@NotNull Triplet<? extends Number, ? extends Number, ? extends Number> pos, | ||
@NotNull EntityLivingBase initiator) { | ||
return owner.onBlockDestroyed(stack, world, block, pos.getX().intValue(), pos.getY().intValue(), | ||
pos.getZ().intValue(), initiator); | ||
} | ||
|
||
public boolean onItemUseFirst(@NotNull Item owner, @NotNull ItemStack stack, @NotNull EntityPlayer user, | ||
@NotNull World world, | ||
@NotNull Triplet<? extends Number, ? extends Number, ? extends Number> pos, | ||
@NotNull ForgeDirection side, | ||
@NotNull Triplet<? extends Number, ? extends Number, ? extends Number> hitPos) { | ||
return owner.onItemUseFirst(stack, user, world, pos.getX().intValue(), pos.getY().intValue(), | ||
pos.getZ().intValue(), side.ordinal(), hitPos.getX().floatValue(), hitPos.getY().floatValue(), | ||
hitPos.getZ().floatValue()); | ||
} | ||
|
||
public boolean onBlockStartBreak(@NotNull Item owner, @NotNull ItemStack stack, | ||
@NotNull Triplet<? extends Number, ? extends Number, ? extends Number> pos, | ||
@NotNull EntityPlayer breaker) { | ||
return owner.onBlockStartBreak(stack, pos.getX().intValue(), pos.getY().intValue(), pos.getZ().intValue(), | ||
breaker); | ||
} | ||
|
||
public boolean doesSneakBypassUse(@NotNull Item owner, @NotNull World world, | ||
@NotNull Triplet<? extends Number, ? extends Number, ? extends Number> pos, | ||
@NotNull EntityPlayer user) { | ||
return owner.doesSneakBypassUse(world, pos.getX().intValue(), pos.getY().intValue(), pos.getZ().intValue(), | ||
user); | ||
} | ||
//------------------------- | ||
//endregion | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters