Skip to content

Commit

Permalink
edit SeatBlockMixin round 2
Browse files Browse the repository at this point in the history
  • Loading branch information
a0a7 committed Nov 14, 2023
1 parent 6405e8a commit 0a4e48b
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import com.simibubi.create.content.contraptions.components.actors.SeatBlock;
import com.simibubi.create.content.contraptions.components.actors.SeatEntity;
import com.sudolev.interiors.content.block.seat.BigChairBlock;
import com.sudolev.interiors.content.entity.BigSeatEntity;

import net.minecraft.core.BlockPos;
Expand All @@ -25,12 +27,12 @@ private static void sitDown(Level world, BlockPos pos, CallbackInfoReturnable<Bo
cir.setReturnValue(true);
}

// @Redirect(method = "sitDown", at = @At(value = "NEW", target = "(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Lcom/simibubi/create/content/contraptions/actors/seat/SeatEntity;"), remap = false)
// private static SeatEntity createSeatEntity(Level world, BlockPos pos) {
// return world.getBlockState(pos).getBlock() instanceof BigChairBlock
// ? new BigSeatEntity(world, pos)
// : new SeatEntity(world, pos);
// }
@Redirect(method = "sitDown", at = @At(value = "NEW", target = "(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Lcom/simibubi/create/content/contraptions/components/actors/SeatEntity;"), remap = false)
private static SeatEntity createSeatEntity(Level world, BlockPos pos) {
return world.getBlockState(pos).getBlock() instanceof BigChairBlock
? new BigSeatEntity(world, pos)
: new SeatEntity(world, pos);
}

@Inject(method = "sitDown", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addFreshEntity(Lnet/minecraft/world/entity/Entity;)Z"), locals = LocalCapture.CAPTURE_FAILHARD)
private static void getY(Level world, BlockPos pos, Entity entity, CallbackInfo ci, SeatEntity seat) {
Expand Down

0 comments on commit 0a4e48b

Please sign in to comment.