24w06a
This commit is contained in:
1 parent
0a64a66d64
commit
3b6ada52f8
5 files changed
+15
-8
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.core.Direction;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -29,22 +30,26 @@ public abstract class HopperBlockEntity_counterMixin extends RandomizableContain
|
||||
super(blockEntityType, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Shadow public abstract int getContainerSize();
|
||||
//@Shadow public abstract int getContainerSize();
|
||||
|
||||
@Shadow public abstract void setItem(int slot, ItemStack stack);
|
||||
//@Shadow public abstract void setItem(int slot, ItemStack stack);
|
||||
|
||||
@Shadow private Direction facing;
|
||||
|
||||
/**
|
||||
* A method to remove items from hoppers pointing into wool and count them via {@link HopperCounter#add} method
|
||||
*/
|
||||
@Inject(method = "ejectItems", at = @At("HEAD"), cancellable = true)
|
||||
private static void onInsert(Level world, BlockPos blockPos, BlockState blockState, Container inventory, CallbackInfoReturnable<Boolean> cir)
|
||||
private static void onInsert(Level world, BlockPos blockPos, HopperBlockEntity hopperBlockEntity, CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
if (CarpetSettings.hopperCounters) {
|
||||
Direction hopperFacing = world.getBlockState(blockPos).getValue(HopperBlock.FACING);
|
||||
DyeColor woolColor = WoolTool.getWoolColorAtPosition(
|
||||
world,
|
||||
blockPos.relative(blockState.getValue(HopperBlock.FACING)));
|
||||
blockPos.relative(hopperFacing));
|
||||
if (woolColor != null)
|
||||
{
|
||||
Container inventory = HopperBlockEntity.getContainerAt(world, blockPos);
|
||||
for (int i = 0; i < inventory.getContainerSize(); ++i)
|
||||
{
|
||||
if (!inventory.getItem(i).isEmpty())
|
||||
|
||||
@@ -84,7 +84,7 @@ public abstract class PrimedTntMixin extends Entity implements TntEntityInterfac
|
||||
|
||||
@Inject(method = "tick", at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/entity/item/PrimedTnt;setDeltaMovement(Lnet/minecraft/world/phys/Vec3;)V",
|
||||
ordinal = 2))
|
||||
ordinal = 1))
|
||||
private void tryMergeTnt(CallbackInfo ci)
|
||||
{
|
||||
// Merge code for combining tnt into a single entity if they happen to exist in the same spot, same fuse, no motion CARPET-XCOM
|
||||
|
||||
Reference in new issue
Block a user