update to 24w33a
This commit is contained in:
1 parent
9940feb7d3
commit
d11586fdaf
58 files changed
+379
-875
No files matched your search
@@ -4,7 +4,7 @@ import carpet.CarpetSettings;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.cauldron.CauldronInteraction;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.ItemInteractionResult;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -21,14 +21,14 @@ public class AbstractCauldronBlock_stackableSBoxesMixin
|
||||
{
|
||||
@Redirect(method = "useItemOn", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/core/cauldron/CauldronInteraction;interact(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/item/ItemStack;)Lnet/minecraft/world/ItemInteractionResult;"
|
||||
target = "Lnet/minecraft/core/cauldron/CauldronInteraction;interact(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/item/ItemStack;)Lnet/minecraft/world/InteractionResult;"
|
||||
))
|
||||
private ItemInteractionResult wrapInteractor(final CauldronInteraction cauldronBehavior, final BlockState blockState, final Level world, final BlockPos blockPos, final Player playerEntity, final InteractionHand hand, final ItemStack itemStack)
|
||||
private InteractionResult wrapInteractor(final CauldronInteraction cauldronBehavior, final BlockState blockState, final Level world, final BlockPos blockPos, final Player playerEntity, final InteractionHand hand, final ItemStack itemStack)
|
||||
{
|
||||
int count = -1;
|
||||
if (CarpetSettings.shulkerBoxStackSize > 1 && itemStack.getItem() instanceof BlockItem && ((BlockItem)itemStack.getItem()).getBlock() instanceof ShulkerBoxBlock)
|
||||
count = itemStack.getCount();
|
||||
ItemInteractionResult result = cauldronBehavior.interact(blockState, world, blockPos, playerEntity, hand, itemStack);
|
||||
InteractionResult result = cauldronBehavior.interact(blockState, world, blockPos, playerEntity, hand, itemStack);
|
||||
if (count > 0 && result.consumesAction())
|
||||
{
|
||||
ItemStack current = playerEntity.getItemInHand(hand);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.fakes.AbstractContainerMenuInterface;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractCraftingMenu;
|
||||
import net.minecraft.world.inventory.RecipeBookMenu;
|
||||
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||
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.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(AbstractCraftingMenu.class)
|
||||
public class AbstractCraftingMenu_scarpetMixin
|
||||
{
|
||||
@Inject(method = "handlePlacement",at = @At("HEAD"), cancellable = true)
|
||||
private void selectRecipeCallback(boolean craftAll, boolean b, RecipeHolder<?> recipe, Inventory player, CallbackInfoReturnable<RecipeBookMenu.PostPlaceAction> cir) {
|
||||
if(((AbstractContainerMenuInterface) this).callSelectRecipeListener((ServerPlayer) player.player ,recipe,craftAll))
|
||||
cir.setReturnValue(RecipeBookMenu.PostPlaceAction.NOTHING);
|
||||
}
|
||||
}
|
||||
+9
-6
@@ -2,18 +2,21 @@ package carpet.mixins;
|
||||
|
||||
import carpet.fakes.AbstractContainerMenuInterface;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractFurnaceMenu;
|
||||
import net.minecraft.world.inventory.RecipeBookMenu;
|
||||
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||
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.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(RecipeBookMenu.class)
|
||||
public class RecipeBookMenu_scarpetMixin {
|
||||
@Mixin(AbstractFurnaceMenu.class)
|
||||
public class AbstractFurnaceMenu_scarpetMixin
|
||||
{
|
||||
@Inject(method = "handlePlacement",at = @At("HEAD"), cancellable = true)
|
||||
private void selectRecipeCallback(boolean craftAll, RecipeHolder<?> recipe, ServerPlayer player, CallbackInfo ci) {
|
||||
if(((AbstractContainerMenuInterface) this).callSelectRecipeListener(player,recipe,craftAll))
|
||||
ci.cancel();
|
||||
private void selectRecipeCallback(boolean craftAll, boolean b, RecipeHolder<?> recipe, Inventory player, CallbackInfoReturnable<RecipeBookMenu.PostPlaceAction> cir) {
|
||||
if(((AbstractContainerMenuInterface) this).callSelectRecipeListener((ServerPlayer) player.player ,recipe,craftAll))
|
||||
cir.setReturnValue(RecipeBookMenu.PostPlaceAction.NOTHING);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import carpet.CarpetSettings;
|
||||
import carpet.fakes.LevelInterface;
|
||||
import net.minecraft.world.level.redstone.NeighborUpdater;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.redstone.Orientation;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -29,10 +30,10 @@ public class BarrierBlock_updateSuppressionBlockMixin extends Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean notify) {
|
||||
public void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, Orientation fromPos, boolean notify) {
|
||||
if (CarpetSettings.updateSuppressionBlock != -1) {
|
||||
if (fromPos.equals(pos.above())) {
|
||||
BlockState stateAbove = level.getBlockState(fromPos);
|
||||
if (true/*fromPos.equals(pos.above())*/) { // todo neighbour updates don't have source
|
||||
BlockState stateAbove = level.getBlockState(pos.above());
|
||||
if (stateAbove.is(Blocks.ACTIVATOR_RAIL) && !stateAbove.getValue(PoweredRailBlock.POWERED)) {
|
||||
level.scheduleTick(pos, this, 1);
|
||||
NeighborUpdater updater = ((LevelInterface)level).getNeighborUpdater();
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
|
||||
import net.minecraft.client.multiplayer.ClientPacketListener;
|
||||
import net.minecraft.client.multiplayer.CommonListenerCookie;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.protocol.game.ClientboundExplodePacket;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
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.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ClientPacketListener.class)
|
||||
public abstract class ClientPacketListener_explosionMixin extends ClientCommonPacketListenerImpl
|
||||
{
|
||||
|
||||
private static Vec3 vec3dmem;
|
||||
private static long tickmem;
|
||||
// For disabling the explosion particles and sounds if explosions are stacking up
|
||||
|
||||
protected ClientPacketListener_explosionMixin(final Minecraft minecraft, final Connection connection, final CommonListenerCookie commonListenerCookie)
|
||||
{
|
||||
super(minecraft, connection, commonListenerCookie);
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "handleExplosion", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/multiplayer/ClientLevel;playLocalSound(DDDLnet/minecraft/sounds/SoundEvent;Lnet/minecraft/sounds/SoundSource;FFZ)V"
|
||||
), cancellable = true)
|
||||
private void onHandleExplosion(final ClientboundExplodePacket clientboundExplodePacket, final CallbackInfo ci)
|
||||
{
|
||||
|
||||
if (CarpetSettings.optimizedTNT)
|
||||
{
|
||||
Vec3 vec3d = clientboundExplodePacket.center();
|
||||
long tick = minecraft.level.getGameTime();
|
||||
if (vec3dmem == null || !vec3dmem.equals(vec3d) || tickmem != tick) {
|
||||
vec3dmem = vec3d;
|
||||
tickmem = tick;
|
||||
} else {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.fakes.DefaultRedstoneWireEvaluatorInferface;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.redstone.DefaultRedstoneWireEvaluator;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(DefaultRedstoneWireEvaluator.class)
|
||||
public abstract class DefaultRedstoneWireEvaluator_redstoneMixin implements DefaultRedstoneWireEvaluatorInferface
|
||||
{
|
||||
@Shadow protected abstract int calculateTargetStrength(final Level level, final BlockPos blockPos);
|
||||
|
||||
@Override
|
||||
public int calculateTargetStrengthCM(final Level level, final BlockPos pos)
|
||||
{
|
||||
return calculateTargetStrength(level, pos);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import net.minecraft.world.level.redstone.Orientation;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@@ -23,7 +24,7 @@ public class DispenserBlock_qcMixin {
|
||||
target = "Lnet/minecraft/world/level/Level;hasNeighborSignal(Lnet/minecraft/core/BlockPos;)Z"
|
||||
)
|
||||
)
|
||||
private boolean carpet_hasQuasiSignal(Level _level, BlockPos above, BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) {
|
||||
private boolean carpet_hasQuasiSignal(Level _level, BlockPos above, BlockState state, Level level, BlockPos pos, Block neighborBlock, Orientation neighborPos, boolean movedByPiston) {
|
||||
return QuasiConnectivity.hasQuasiSignal(level, pos);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,22 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.level.ServerExplosion;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
@Mixin(Explosion.class)
|
||||
@Mixin(ServerExplosion.class)
|
||||
public interface ExplosionAccessor {
|
||||
|
||||
@Accessor
|
||||
boolean isFire();
|
||||
ServerLevel getLevel();
|
||||
|
||||
@Accessor
|
||||
Explosion.BlockInteraction getBlockInteraction();
|
||||
|
||||
@Accessor
|
||||
Level getLevel();
|
||||
|
||||
@Accessor
|
||||
RandomSource getRandom();
|
||||
|
||||
@Accessor
|
||||
double getX();
|
||||
|
||||
@Accessor
|
||||
double getY();
|
||||
|
||||
@Accessor
|
||||
double getZ();
|
||||
Vec3 getCenter();
|
||||
|
||||
@Accessor
|
||||
float getRadius();
|
||||
|
||||
@@ -4,11 +4,12 @@ import carpet.helpers.OptimizedExplosion;
|
||||
import carpet.CarpetSettings;
|
||||
import carpet.logging.LoggerRegistry;
|
||||
import carpet.logging.logHelpers.ExplosionLogHelper;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.monster.breeze.Breeze;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.ServerExplosion;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -23,75 +24,68 @@ import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.ExplosionDamageCalculator;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(value = Explosion.class)
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Mixin(value = ServerExplosion.class)
|
||||
public abstract class Explosion_optimizedTntMixin
|
||||
{
|
||||
@Shadow
|
||||
@Final
|
||||
private ObjectArrayList<BlockPos> toBlow;
|
||||
|
||||
@Shadow @Final private Level level;
|
||||
@Shadow @Final private ServerLevel level;
|
||||
|
||||
@Shadow @Nullable public abstract LivingEntity getIndirectSourceEntity();
|
||||
|
||||
private ExplosionLogHelper eLogger;
|
||||
|
||||
@Inject(method = "explode", at = @At("HEAD"),
|
||||
@Inject(method = "calculateExplodedPositions", at = @At("HEAD"),
|
||||
cancellable = true)
|
||||
private void onExplosionA(CallbackInfo ci)
|
||||
private void calculateExplodedPositionsCM(final CallbackInfoReturnable<List<BlockPos>> cir)
|
||||
{
|
||||
if (CarpetSettings.optimizedTNT && !level.isClientSide && !(getIndirectSourceEntity() instanceof Breeze))
|
||||
{
|
||||
OptimizedExplosion.doExplosionA((Explosion) (Object) this, eLogger);
|
||||
ci.cancel();
|
||||
cir.setReturnValue(OptimizedExplosion.doExplosionA((Explosion) (Object) this, eLogger));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "finalizeExplosion", at = @At("HEAD"),
|
||||
cancellable = true)
|
||||
private void onExplosionB(boolean spawnParticles, CallbackInfo ci)
|
||||
@Inject(method = "interactWithBlocks", at = @At("HEAD"))
|
||||
private void interactWithBlocksCM(final List<BlockPos> list, final CallbackInfo ci)
|
||||
{
|
||||
if (eLogger != null)
|
||||
{
|
||||
eLogger.setAffectBlocks( ! toBlow.isEmpty());
|
||||
eLogger.setAffectBlocks( ! list.isEmpty());
|
||||
eLogger.onExplosionDone(this.level.getGameTime());
|
||||
}
|
||||
if (CarpetSettings.explosionNoBlockDamage)
|
||||
{
|
||||
toBlow.clear();
|
||||
list.clear();
|
||||
}
|
||||
if (CarpetSettings.optimizedTNT && !level.isClientSide && !(getIndirectSourceEntity() instanceof Breeze))
|
||||
{
|
||||
OptimizedExplosion.doExplosionB((Explosion) (Object) this, spawnParticles);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
//optional due to Overwrite in Lithium
|
||||
//should kill most checks if no block damage is requested
|
||||
@Redirect(method = "explode", require = 0, at = @At(value = "INVOKE",
|
||||
target ="Lnet/minecraft/world/level/Level;getBlockState(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/state/BlockState;"))
|
||||
private BlockState noBlockCalcsWithNoBLockDamage(Level world, BlockPos pos)
|
||||
{
|
||||
if (CarpetSettings.explosionNoBlockDamage) return Blocks.BEDROCK.defaultBlockState();
|
||||
return world.getBlockState(pos);
|
||||
}
|
||||
|
||||
@Inject(method = "<init>(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/damagesource/DamageSource;Lnet/minecraft/world/level/ExplosionDamageCalculator;DDDFZLnet/minecraft/world/level/Explosion$BlockInteraction;Lnet/minecraft/core/particles/ParticleOptions;Lnet/minecraft/core/particles/ParticleOptions;Lnet/minecraft/core/Holder;)V",
|
||||
//optional due to Overwrite in Lithium
|
||||
//should kill most checks if no block damage is requested
|
||||
@Redirect(method = "calculateExplodedPositions", require = 0, at = @At(value = "INVOKE",
|
||||
target ="Lnet/minecraft/world/level/ExplosionDamageCalculator;getBlockExplosionResistance(Lnet/minecraft/world/level/Explosion;Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/material/FluidState;)Ljava/util/Optional;"))
|
||||
private Optional<Float> noBlockCalcsWithNoBLockDamage(final ExplosionDamageCalculator instance, final Explosion explosion, final BlockGetter blockGetter, final BlockPos blockPos, final BlockState blockState, final FluidState fluidState)
|
||||
{
|
||||
if (CarpetSettings.explosionNoBlockDamage) return Optional.of(Blocks.BEDROCK.getExplosionResistance());
|
||||
return instance.getBlockExplosionResistance(explosion, blockGetter, blockPos, blockState, fluidState);
|
||||
}
|
||||
|
||||
@Inject(method = "<init>",
|
||||
at = @At(value = "RETURN"))
|
||||
private void onExplosionCreated(Level world, Entity entity, DamageSource damageSource, ExplosionDamageCalculator explosionBehavior, double x, double y, double z, float power, boolean createFire, Explosion.BlockInteraction destructionType, ParticleOptions particleOptions, ParticleOptions particleOptions2, Holder soundEvent, CallbackInfo ci)
|
||||
private void onExplostion(ServerLevel world, Entity entity, DamageSource damageSource, final ExplosionDamageCalculator explosionBehavior, final Vec3 vec3, final float power, final boolean createFire, final Explosion.BlockInteraction destructionType, final CallbackInfo ci)
|
||||
{
|
||||
if (LoggerRegistry.__explosions && ! world.isClientSide)
|
||||
{
|
||||
eLogger = new ExplosionLogHelper(x, y, z, power, createFire, destructionType, level.registryAccess());
|
||||
eLogger = new ExplosionLogHelper(vec3.x, vec3.y, vec3.z, power, createFire, destructionType, level.registryAccess());
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "explode",
|
||||
@Redirect(method = "hurtEntities",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;setDeltaMovement(Lnet/minecraft/world/phys/Vec3;)V"))
|
||||
private void setVelocityAndUpdateLogging(Entity entity, Vec3 velocity)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
import net.minecraft.world.level.ServerExplosion;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -14,66 +12,48 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.ExplosionDamageCalculator;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import static carpet.script.CarpetEventServer.Event.EXPLOSION_OUTCOME;
|
||||
|
||||
@Mixin(value = Explosion.class, priority = 990)
|
||||
@Mixin(value = ServerExplosion.class, priority = 990)
|
||||
public abstract class Explosion_scarpetEventMixin
|
||||
{
|
||||
@Shadow @Final private Level level;
|
||||
@Shadow @Final private double x;
|
||||
@Shadow @Final private double y;
|
||||
@Shadow @Final private double z;
|
||||
@Shadow @Final private ServerLevel level;
|
||||
@Shadow @Final private Vec3 center;
|
||||
@Shadow @Final private float radius;
|
||||
@Shadow @Final private boolean fire;
|
||||
@Shadow @Final private ObjectArrayList<BlockPos> toBlow;
|
||||
@Shadow @Final private Explosion.BlockInteraction blockInteraction;
|
||||
@Shadow @Final private @Nullable Entity source;
|
||||
|
||||
@Shadow /*@Nullable*/ public abstract /*@Nullable*/ LivingEntity getIndirectSourceEntity();
|
||||
|
||||
@Shadow public static float getSeenPercent(Vec3 source, Entity entity) {return 0.0f;}
|
||||
private List<Entity> affectedEntities = new ArrayList<>();
|
||||
|
||||
private List<Entity> affectedEntities;
|
||||
|
||||
@Inject(method = "<init>(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/damagesource/DamageSource;Lnet/minecraft/world/level/ExplosionDamageCalculator;DDDFZLnet/minecraft/world/level/Explosion$BlockInteraction;Lnet/minecraft/core/particles/ParticleOptions;Lnet/minecraft/core/particles/ParticleOptions;Lnet/minecraft/core/Holder;)V",
|
||||
at = @At(value = "RETURN"))
|
||||
private void onExplosionCreated(Level world, Entity entity, DamageSource damageSource, ExplosionDamageCalculator explosionBehavior, double x, double y, double z, float power, boolean createFire, Explosion.BlockInteraction destructionType, ParticleOptions particleOptions, ParticleOptions particleOptions2, Holder soundEvent, CallbackInfo ci)
|
||||
@Inject(method = "explode", at = @At("HEAD"))
|
||||
private void explodeCM(CallbackInfo ci)
|
||||
{
|
||||
if (EXPLOSION_OUTCOME.isNeeded() && !world.isClientSide())
|
||||
{
|
||||
affectedEntities = new ArrayList<>();
|
||||
}
|
||||
affectedEntities.clear();
|
||||
}
|
||||
|
||||
@Redirect(method = "explode", at=@At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/level/Explosion;getSeenPercent(Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/entity/Entity;)F")
|
||||
)
|
||||
private float onExplosion(Vec3 source, Entity entity)
|
||||
@Redirect(method = "hurtEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;onExplosionHit(Lnet/minecraft/world/entity/Entity;)V"))
|
||||
private void onEntityHit(Entity instance, Entity entity)
|
||||
{
|
||||
if (affectedEntities != null)
|
||||
{
|
||||
affectedEntities.add(entity);
|
||||
}
|
||||
return getSeenPercent(source, entity);
|
||||
affectedEntities.add(instance);
|
||||
instance.onExplosionHit(entity);
|
||||
}
|
||||
|
||||
@Inject(method = "finalizeExplosion", at = @At("HEAD"))
|
||||
private void onExplosion(boolean spawnParticles, CallbackInfo ci)
|
||||
@Inject(method = "explode", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/ServerExplosion;hurtEntities()V", shift = At.Shift.AFTER))
|
||||
private void onExplosionDone(CallbackInfo ci, List list)
|
||||
{
|
||||
if (EXPLOSION_OUTCOME.isNeeded() && !level.isClientSide())
|
||||
{
|
||||
EXPLOSION_OUTCOME.onExplosion((ServerLevel) level, source, this::getIndirectSourceEntity, x, y, z, radius, fire, toBlow, affectedEntities, blockInteraction);
|
||||
EXPLOSION_OUTCOME.onExplosion((ServerLevel) level, source, this::getIndirectSourceEntity, center, radius, fire, list, affectedEntities, blockInteraction);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,14 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
public class FlowingFluid_liquidDamageDisabledMixin
|
||||
{
|
||||
@Inject(
|
||||
method = "canHoldFluid",
|
||||
method = "canHoldAnyFluid",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/level/block/state/BlockState;blocksMotion()Z"
|
||||
),
|
||||
cancellable = true
|
||||
)
|
||||
private void stopBreakingBlock(BlockGetter world, BlockPos pos, BlockState state, Fluid fluid, CallbackInfoReturnable<Boolean> cir)
|
||||
private static void stopBreakingBlock(final BlockState state, final CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
if (CarpetSettings.liquidDamageDisabled)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.EntitySpawnReason;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LightningBolt;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
import net.minecraft.world.entity.SpawnGroupData;
|
||||
import net.minecraft.world.entity.monster.ElderGuardian;
|
||||
import net.minecraft.world.entity.monster.Guardian;
|
||||
import net.minecraft.world.entity.monster.Monster;
|
||||
@@ -28,7 +26,7 @@ public abstract class Guardian_renewableSpongesMixin extends Monster
|
||||
{
|
||||
ElderGuardian elderGuardian = new ElderGuardian(EntityType.ELDER_GUARDIAN ,this.level());
|
||||
elderGuardian.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
elderGuardian.finalizeSpawn(serverWorld ,this.level().getCurrentDifficultyAt(elderGuardian.blockPosition()), MobSpawnType.CONVERSION, null);
|
||||
elderGuardian.finalizeSpawn(serverWorld ,this.level().getCurrentDifficultyAt(elderGuardian.blockPosition()), EntitySpawnReason.CONVERSION, null);
|
||||
elderGuardian.setNoAi(this.isNoAi());
|
||||
|
||||
if (this.hasCustomName())
|
||||
|
||||
@@ -1,24 +1,11 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.fakes.IngredientInterface;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
|
||||
@Mixin(Ingredient.class)
|
||||
public class Ingredient_scarpetMixin implements IngredientInterface
|
||||
public class Ingredient_scarpetMixin// implements IngredientInterface
|
||||
{
|
||||
@Shadow @Final private Ingredient.Value[] values;
|
||||
|
||||
@Override
|
||||
public List<Collection<ItemStack>> getRecipeStacks()
|
||||
{
|
||||
return Arrays.stream(values).map(Ingredient.Value::getItems).toList();
|
||||
}
|
||||
}
|
||||
@@ -2,18 +2,20 @@ package carpet.mixins;
|
||||
|
||||
import carpet.network.CarpetClient;
|
||||
import carpet.script.utils.ShapesRenderer;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.framegraph.FrameGraphBuilder;
|
||||
import com.mojang.blaze3d.framegraph.FramePass;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.FogParameters;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
import net.minecraft.client.renderer.LevelTargetBundle;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.RenderBuffers;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||
import org.joml.Matrix4f;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
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;
|
||||
@@ -21,30 +23,25 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@Mixin(LevelRenderer.class)
|
||||
public class LevelRenderer_scarpetRenderMixin
|
||||
{
|
||||
@Shadow @Final private LevelTargetBundle targets;
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void addRenderers(Minecraft minecraft, EntityRenderDispatcher entityRenderDispatcher, BlockEntityRenderDispatcher blockEntityRenderDispatcher, RenderBuffers renderBuffers, CallbackInfo ci)
|
||||
{
|
||||
CarpetClient.shapes = new ShapesRenderer(minecraft);
|
||||
}
|
||||
|
||||
@Inject(method = "renderLevel", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/Sheets;translucentCullBlockSheet()Lnet/minecraft/client/renderer/RenderType;", shift = At.Shift.BEFORE
|
||||
//target = "Lnet/minecraft/client/render/RenderLayer;getWaterMask()Lnet/minecraft/client/render/RenderLayer;", shift = At.Shift.AFTER
|
||||
//target = "Lnet/minecraft/client/render/BufferBuilderStorage;getEffectVertexConsumers()Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;", shift = At.Shift.BEFORE
|
||||
//target = "Lnet/minecraft/client/render/WorldRenderer;renderChunkDebugInfo(Lnet/minecraft/client/render/Camera;)V", shift = At.Shift.AFTER
|
||||
//target = "Lnet/minecraft/client/render/BackgroundRenderer;method_23792()V", shift = At.Shift.AFTER
|
||||
//target = "Lnet/minecraft/client/render/BufferBuilderStorage;getEntityVertexConsumers()Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;", shift = At.Shift.AFTER
|
||||
//target = "Lnet/minecraft/client/render/WorldRenderer;renderChunkDebugInfo(Lnet/minecraft/client/render/Camera;)V", shift = At.Shift.AFTER // before return
|
||||
))
|
||||
private void renderScarpetThings(final DeltaTracker deltaTracker, final boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightmapTextureManager, Matrix4f modelViewMatrix, Matrix4f matrix4f, CallbackInfo ci)
|
||||
@Inject(method = "addParticlesPass", at = @At("RETURN"))
|
||||
private void renderScarpetThingsLate(FrameGraphBuilder frameGraphBuilder, Camera camera, LightTexture lightTexture, float f, FogParameters fogParameters, CallbackInfo ci)
|
||||
{
|
||||
// in normal circumstances we want to render shapes at the very end so it appears correctly behind stuff.
|
||||
// we might actually not need to play with render hooks here.
|
||||
//if (!FabricAPIHooks.WORLD_RENDER_EVENTS && CarpetClient.shapes != null )
|
||||
if (CarpetClient.shapes != null)
|
||||
{
|
||||
CarpetClient.shapes.render(modelViewMatrix, camera, deltaTracker.getGameTimeDeltaPartialTick(false));
|
||||
FramePass pass = frameGraphBuilder.addPass("scarpet_shapes");
|
||||
targets.main = pass.readsAndWrites(targets.main);
|
||||
pass.executes(() -> CarpetClient.shapes.render(null, camera, f));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import carpet.fakes.LevelInterface;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.FullChunkStatus;
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@@ -28,12 +27,6 @@ public abstract class Level_movableBEMixin implements LevelInterface, LevelAcces
|
||||
@Shadow
|
||||
public abstract LevelChunk getChunkAt(BlockPos blockPos_1);
|
||||
|
||||
@Shadow
|
||||
public abstract BlockState getBlockState(BlockPos blockPos_1);
|
||||
|
||||
//@Shadow
|
||||
//public abstract ChunkManager getChunkManager();
|
||||
|
||||
@Shadow
|
||||
public abstract void setBlocksDirty(BlockPos blockPos_1, BlockState s1, BlockState s2);
|
||||
|
||||
@@ -50,8 +43,6 @@ public abstract class Level_movableBEMixin implements LevelInterface, LevelAcces
|
||||
|
||||
@Shadow public abstract void updateNeighbourForOutputSignal(BlockPos pos, Block block);
|
||||
|
||||
//@Shadow public abstract boolean setBlockState(BlockPos pos, BlockState state, int flags);
|
||||
|
||||
@Shadow public abstract boolean isDebug();
|
||||
|
||||
/**
|
||||
@@ -86,7 +77,7 @@ public abstract class Level_movableBEMixin implements LevelInterface, LevelAcces
|
||||
{
|
||||
BlockState blockState_3 = this.getBlockState(blockPos_1);
|
||||
|
||||
if (blockState_3 != blockState_2 && (blockState_3.getLightBlock((BlockGetter) this, blockPos_1) != blockState_2.getLightBlock((BlockGetter) this, blockPos_1) || blockState_3.getLightEmission() != blockState_2.getLightEmission() || blockState_3.useShapeForLightOcclusion() || blockState_2.useShapeForLightOcclusion()))
|
||||
if (blockState_3 != blockState_2 && (blockState_3.getLightBlock() != blockState_2.getLightBlock() || blockState_3.getLightEmission() != blockState_2.getLightEmission() || blockState_3.useShapeForLightOcclusion() || blockState_2.useShapeForLightOcclusion()))
|
||||
{
|
||||
ProfilerFiller profiler = getProfiler();
|
||||
profiler.push("queueCheckLight");
|
||||
|
||||
@@ -25,8 +25,8 @@ public abstract class LivingEntity_creativeFlyMixin extends Entity
|
||||
super(type, world);
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "travel", constant = @Constant(floatValue = 0.91F), expect = 2)
|
||||
private float drag(float original)
|
||||
@ModifyConstant(method = "travelInAir", constant = @Constant(floatValue = 0.91F), expect = 1)
|
||||
private float dragAir(float original)
|
||||
{
|
||||
if (CarpetSettings.creativeFlyDrag != 0.09 && (Object)this instanceof Player)
|
||||
{
|
||||
@@ -37,7 +37,6 @@ public abstract class LivingEntity_creativeFlyMixin extends Entity
|
||||
return original;
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "getFrictionInfluencedSpeed(F)F", at = @At("HEAD"), cancellable = true)
|
||||
private void flyingAltSpeed(float slipperiness, CallbackInfoReturnable<Float> cir)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
public abstract class MinecraftServer_pingPlayerSampleLimit
|
||||
{
|
||||
|
||||
@ModifyConstant(method = "tickServer", constant = @Constant(intValue = 12), require = 0, allow = 1)
|
||||
@ModifyConstant(method = "buildPlayerStatus", constant = @Constant(intValue = 12), require = 1)
|
||||
private int modifyPlayerSampleLimit(int value)
|
||||
{
|
||||
return CarpetSettings.pingPlayerListLimit;
|
||||
|
||||
@@ -102,7 +102,7 @@ public abstract class MinecraftServer_scarpetMixin extends ReentrantBlockableEve
|
||||
@Override
|
||||
public void reloadAfterReload(RegistryAccess newRegs)
|
||||
{
|
||||
resources.managers().updateRegistryTags();
|
||||
resources.managers().updateStaticRegistryTags();
|
||||
getPlayerList().saveAll();
|
||||
getPlayerList().reloadResources();
|
||||
functionManager.replaceLibrary(this.resources.managers().getFunctionLibrary());
|
||||
|
||||
@@ -36,42 +36,34 @@ public abstract class MinecraftServer_tickspeedMixin extends ReentrantBlockableE
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "tickServer", at = @At(
|
||||
@Inject(method = "autoSave", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/MinecraftServer;saveEverything(ZZZ)Z", // save
|
||||
shift = At.Shift.BEFORE
|
||||
))
|
||||
private void startAutosave(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
private void startAutosave(final CallbackInfo ci)
|
||||
{
|
||||
currentSection = CarpetProfiler.start_section(null, "Autosave", CarpetProfiler.TYPE.GENERAL);
|
||||
}
|
||||
|
||||
@Inject(method = "tickServer", at = @At(
|
||||
@Inject(method = "autoSave", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/MinecraftServer;saveEverything(ZZZ)Z",
|
||||
shift = At.Shift.AFTER
|
||||
))
|
||||
private void finishAutosave(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
private void finishAutosave(final CallbackInfo ci)
|
||||
{
|
||||
CarpetProfiler.end_current_section(currentSection);
|
||||
}
|
||||
|
||||
@Inject(method = "tickChildren", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/MinecraftServer;getConnection()Lnet/minecraft/server/network/ServerConnectionListener;",
|
||||
shift = At.Shift.BEFORE
|
||||
))
|
||||
private void startNetwork(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
@Inject(method = "tickConnection", at = @At("HEAD"))
|
||||
private void startNetwork(final CallbackInfo ci)
|
||||
{
|
||||
currentSection = CarpetProfiler.start_section(null, "Network", CarpetProfiler.TYPE.GENERAL);
|
||||
}
|
||||
|
||||
@Inject(method = "tickChildren", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/players/PlayerList;tick()V",
|
||||
shift = At.Shift.AFTER
|
||||
))
|
||||
private void finishNetwork(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
@Inject(method = "tickConnection", at = @At("RETURN"))
|
||||
private void finishNetwork(final CallbackInfo ci)
|
||||
{
|
||||
CarpetProfiler.end_current_section(currentSection);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package carpet.mixins;
|
||||
import carpet.CarpetSettings;
|
||||
import carpet.fakes.LevelInterface;
|
||||
import carpet.utils.SpawnReporter;
|
||||
import net.minecraft.world.entity.EntitySpawnReason;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -12,9 +13,9 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
@@ -24,7 +25,6 @@ import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
import net.minecraft.world.entity.SpawnGroupData;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -133,9 +133,9 @@ public class NaturalSpawnerMixin
|
||||
|
||||
@Redirect(method = "getMobForSpawn", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/entity/EntityType;create(Lnet/minecraft/world/level/Level;)Lnet/minecraft/world/entity/Entity;"
|
||||
target = "Lnet/minecraft/world/entity/EntityType;create(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/EntitySpawnReason;)Lnet/minecraft/world/entity/Entity;"
|
||||
))
|
||||
private static Entity create(EntityType<?> entityType, Level world_1)
|
||||
private static Entity create(final EntityType entityType, final Level world_1, final EntitySpawnReason entitySpawnReason)
|
||||
{
|
||||
if (CarpetSettings.lagFreeSpawning)
|
||||
{
|
||||
@@ -143,11 +143,11 @@ public class NaturalSpawnerMixin
|
||||
if (precookedMobs.containsKey(entityType))
|
||||
//this mob has been <init>'s but not used yet
|
||||
return precookedMobs.get(entityType);
|
||||
Entity e = entityType.create(world_1);
|
||||
Entity e = entityType.create(world_1, entitySpawnReason);
|
||||
precookedMobs.put(entityType, e);
|
||||
return e;
|
||||
}
|
||||
return entityType.create(world_1);
|
||||
return entityType.create(world_1, entitySpawnReason);
|
||||
}
|
||||
|
||||
@Redirect(method = "spawnCategoryForPosition(Lnet/minecraft/world/entity/MobCategory;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkAccess;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/NaturalSpawner$SpawnPredicate;Lnet/minecraft/world/level/NaturalSpawner$AfterSpawnCallback;)V", at = @At(
|
||||
@@ -176,9 +176,9 @@ public class NaturalSpawnerMixin
|
||||
|
||||
@Redirect(method = "spawnCategoryForPosition(Lnet/minecraft/world/entity/MobCategory;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkAccess;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/NaturalSpawner$SpawnPredicate;Lnet/minecraft/world/level/NaturalSpawner$AfterSpawnCallback;)V", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/entity/Mob;finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/MobSpawnType;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;"
|
||||
target = "Lnet/minecraft/world/entity/Mob;finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;"
|
||||
))
|
||||
private static SpawnGroupData spawnEntity(Mob mobEntity, ServerLevelAccessor serverWorldAccess, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData)
|
||||
private static SpawnGroupData spawnEntity(Mob mobEntity, ServerLevelAccessor serverWorldAccess, DifficultyInstance difficulty, EntitySpawnReason spawnReason, SpawnGroupData entityData)
|
||||
{
|
||||
if (!SpawnReporter.mockSpawns) // WorldAccess
|
||||
return mobEntity.finalizeSpawn(serverWorldAccess, difficulty, spawnReason, entityData);
|
||||
@@ -271,17 +271,13 @@ public class NaturalSpawnerMixin
|
||||
@Inject(method = "spawnForChunk", at = @At("HEAD"))
|
||||
// allows to change mobcaps and captures each category try per dimension before it fails due to full mobcaps.
|
||||
private static void checkSpawns(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info,
|
||||
boolean spawnAnimals, boolean spawnMonsters, boolean shouldSpawnAnimals, CallbackInfo ci)
|
||||
List<MobCategory> list, CallbackInfo ci)
|
||||
{
|
||||
if (SpawnReporter.trackingSpawns())
|
||||
{
|
||||
MobCategory[] var6 = SPAWNING_CATEGORIES;
|
||||
int var7 = var6.length;
|
||||
for (MobCategory entityCategory: list)
|
||||
{
|
||||
|
||||
for(int var8 = 0; var8 < var7; ++var8) {
|
||||
MobCategory entityCategory = var6[var8];
|
||||
if ((spawnAnimals || !entityCategory.isFriendly()) && (spawnMonsters || entityCategory.isFriendly()) && (shouldSpawnAnimals || !entityCategory.isPersistent()) )
|
||||
{
|
||||
ResourceKey<Level> dim = world.dimension(); // getDimensionType;
|
||||
int newCap = entityCategory.getMaxInstancesPerChunk(); //(int) ((double)entityCategory.getCapacity()*(Math.pow(2.0,(SpawnReporter.mobcap_exponent/4))));
|
||||
int int_2 = SpawnReporter.chunkCounts.get(dim); // eligible chunks for spawning
|
||||
@@ -311,7 +307,6 @@ public class NaturalSpawnerMixin
|
||||
//else
|
||||
//full mobcaps - and key in local_spawns will be missing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.DiggerItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.PickaxeItem;
|
||||
import net.minecraft.world.item.Tier;
|
||||
import net.minecraft.world.item.ToolMaterial;
|
||||
import net.minecraft.world.item.component.Tool;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
@@ -18,8 +18,10 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||
public class PickaxeItem_missingToolsMixin extends DiggerItem
|
||||
{
|
||||
|
||||
protected PickaxeItem_missingToolsMixin(Tier material, TagKey<Block> tag, Properties settings) {
|
||||
super(material, tag, settings);
|
||||
|
||||
protected PickaxeItem_missingToolsMixin(final ToolMaterial toolMaterial, final TagKey<Block> tagKey, final float f, final float g, final Properties properties)
|
||||
{
|
||||
super(toolMaterial, tagKey, f, g, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@@ -42,9 +43,13 @@ public class RecipeManager_scarpetMixin implements RecipeManagerInterface
|
||||
Collection<RecipeHolder<?>> typeRecipes = byType.get(type);
|
||||
Registry<Item> regs = registryAccess.registryOrThrow(Registries.ITEM);
|
||||
Item item = regs.get(itemId);
|
||||
if (item == Items.AIR)
|
||||
{
|
||||
return List.of();
|
||||
}
|
||||
return typeRecipes.stream()
|
||||
.<Recipe<?>>map(RecipeHolder::value)
|
||||
.filter(r -> r.getResultItem(registryAccess).getItem() == item)
|
||||
.filter(r -> r.getResultItem(registryAccess).is(item))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import carpet.fakes.DefaultRedstoneWireEvaluatorInferface;
|
||||
import carpet.fakes.RedstoneWireBlockInterface;
|
||||
import carpet.helpers.RedstoneWireTurbo;
|
||||
import com.google.common.collect.Sets;
|
||||
import net.minecraft.world.level.redstone.DefaultRedstoneWireEvaluator;
|
||||
import net.minecraft.world.level.redstone.Orientation;
|
||||
import net.minecraft.world.level.redstone.RedstoneWireEvaluator;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
@@ -21,16 +25,15 @@ import net.minecraft.world.level.block.RedStoneWireBlock;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static net.minecraft.world.level.block.RedStoneWireBlock.POWER;
|
||||
|
||||
@Mixin(RedStoneWireBlock.class)
|
||||
public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockInterface {
|
||||
|
||||
@Shadow
|
||||
private void updatePowerStrength(Level world_1, BlockPos blockPos_1, BlockState blockState_1) { }
|
||||
|
||||
@Shadow
|
||||
private int calculateTargetStrength(Level world, BlockPos pos) { return 0; }
|
||||
private void updatePowerStrength(Level world_1, BlockPos blockPos_1, BlockState blockState_1, @Nullable final Orientation orientation) { }
|
||||
|
||||
@Override
|
||||
@Accessor("shouldSignal")
|
||||
@@ -40,6 +43,8 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn
|
||||
@Accessor("shouldSignal")
|
||||
public abstract boolean getWiresGivePower();
|
||||
|
||||
private RedstoneWireEvaluator legacy = new DefaultRedstoneWireEvaluator((RedStoneWireBlock)(Object) this);
|
||||
|
||||
// =
|
||||
|
||||
private RedstoneWireTurbo wireTurbo = null;
|
||||
@@ -52,20 +57,22 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn
|
||||
|
||||
// =
|
||||
|
||||
public void fastUpdate(Level world, BlockPos pos, BlockState state, BlockPos source) {
|
||||
public void fastUpdate(Level world, BlockPos pos, BlockState state, Orientation o) {
|
||||
// [CM] fastRedstoneDust -- update based on carpet rule
|
||||
if (CarpetSettings.fastRedstoneDust) {
|
||||
BlockPos source = null; // todo this probably removes all improvements from the original method
|
||||
// so needs to be evaluated if its worth keeping
|
||||
wireTurbo.updateSurroundingRedstone(world, pos, state, source);
|
||||
return;
|
||||
}
|
||||
updatePowerStrength(world, pos, state);
|
||||
updatePowerStrength(world, pos, state, o);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author theosib, soykaf, gnembon
|
||||
*/
|
||||
@Inject(method = "updatePowerStrength", at = @At("HEAD"), cancellable = true)
|
||||
private void updateLogicAlternative(Level world, BlockPos pos, BlockState state, CallbackInfo cir) {
|
||||
private void updateLogicAlternative(Level world, BlockPos pos, BlockState state, Orientation orientation, CallbackInfo cir) {
|
||||
if (CarpetSettings.fastRedstoneDust) {
|
||||
updateLogicPublic(world, pos, state);
|
||||
cir.cancel();
|
||||
@@ -74,7 +81,7 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn
|
||||
|
||||
@Override
|
||||
public BlockState updateLogicPublic(Level world_1, BlockPos blockPos_1, BlockState blockState_1) {
|
||||
int i = this.calculateTargetStrength(world_1, blockPos_1);
|
||||
int i = ((DefaultRedstoneWireEvaluatorInferface)legacy).calculateTargetStrengthCM(world_1, blockPos_1);
|
||||
BlockState blockState = blockState_1;
|
||||
if (blockState_1.getValue(POWER) != i) {
|
||||
blockState_1 = blockState_1.setValue(POWER, i);
|
||||
@@ -107,28 +114,33 @@ public abstract class RedstoneWireBlock_fastMixin implements RedstoneWireBlockIn
|
||||
// =
|
||||
|
||||
|
||||
@Redirect(method = "onPlace", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V"))
|
||||
private void redirectOnBlockAddedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1) {
|
||||
fastUpdate(world_1, blockPos_1, blockState_1, null);
|
||||
@Redirect(method = "onPlace", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V"))
|
||||
private void redirectOnBlockAddedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o) {
|
||||
fastUpdate(world_1, blockPos_1, blockState_1, o);
|
||||
}
|
||||
|
||||
@Redirect(method = "onRemove", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V"))
|
||||
private void redirectOnStateReplacedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1) {
|
||||
fastUpdate(world_1, blockPos_1, blockState_1, null);
|
||||
@Redirect(method = "onRemove", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V"))
|
||||
private void redirectOnStateReplacedUpdate(RedStoneWireBlock self, Level world_1, BlockPos blockPos_1, BlockState blockState_1, Orientation o) {
|
||||
fastUpdate(world_1, blockPos_1, blockState_1, o);
|
||||
}
|
||||
|
||||
@Redirect(method = "neighborChanged", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V"))
|
||||
@Redirect(method = "neighborChanged", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/RedStoneWireBlock;updatePowerStrength(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/redstone/Orientation;)V"))
|
||||
//private void red(final RedStoneWireBlock instance, final Level level,
|
||||
// final BlockPos blockPos, final BlockState blockState, final Orientation orientation)
|
||||
private void redirectNeighborUpdateUpdate(
|
||||
RedStoneWireBlock self,
|
||||
Level world_1,
|
||||
BlockPos blockPos_1,
|
||||
BlockState blockState_1,
|
||||
Orientation o,
|
||||
BlockState blockState_2,
|
||||
Level world_2,
|
||||
BlockPos blockPos_2,
|
||||
Block block_1,
|
||||
BlockPos blockPos_3,
|
||||
boolean boolean_1) {
|
||||
fastUpdate(world_1, blockPos_1, blockState_1, blockPos_3);
|
||||
Orientation o2,
|
||||
boolean b
|
||||
)
|
||||
{
|
||||
fastUpdate(world_1, blockPos_1, blockState_1, o);
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public abstract class ServerChunkCacheMixin
|
||||
|
||||
@Shadow @Final private DistanceManager distanceManager;
|
||||
|
||||
@Redirect(method = "tickChunks", at = @At(
|
||||
@Redirect(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/level/DistanceManager;getNaturalSpawnChunkCount()I"
|
||||
))
|
||||
@@ -54,7 +54,7 @@ public abstract class ServerChunkCacheMixin
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "tickChunks", at = @At("RETURN"))
|
||||
@Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At("RETURN"))
|
||||
private void onFinishSpawnWorldCycle(CallbackInfo ci)
|
||||
{
|
||||
LevelData levelData = this.level.getLevelData(); // levelProperies class
|
||||
|
||||
@@ -19,36 +19,13 @@ public abstract class ServerChunkCache_profilerMixin
|
||||
|
||||
CarpetProfiler.ProfilerToken currentSection;
|
||||
|
||||
@Inject(method = "tickChunks", at = @At("HEAD"))
|
||||
@Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At("HEAD"))
|
||||
private void startSpawningSection(CallbackInfo ci)
|
||||
{
|
||||
currentSection = CarpetProfiler.start_section(level, "Spawning", CarpetProfiler.TYPE.GENERAL);
|
||||
}
|
||||
|
||||
@Inject(method = "tickChunks", at = @At(
|
||||
value = "FIELD",
|
||||
target = "net/minecraft/server/level/ServerChunkCache.level:Lnet/minecraft/server/level/ServerLevel;",
|
||||
ordinal = 10
|
||||
))
|
||||
private void skipChunkTicking(CallbackInfo ci)
|
||||
{
|
||||
if (currentSection != null)
|
||||
{
|
||||
CarpetProfiler.end_current_section(currentSection);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "tickChunks", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "net/minecraft/server/level/ServerLevel.tickChunk(Lnet/minecraft/world/level/chunk/LevelChunk;I)V",
|
||||
shift = At.Shift.AFTER
|
||||
))
|
||||
private void resumeSpawningSection(CallbackInfo ci)
|
||||
{
|
||||
currentSection = CarpetProfiler.start_section(level, "Spawning", CarpetProfiler.TYPE.GENERAL);
|
||||
}
|
||||
|
||||
@Inject(method = "tickChunks", at = @At("RETURN"))
|
||||
@Inject(method = "tickChunks(Lnet/minecraft/util/profiling/ProfilerFiller;JLjava/util/List;)V", at = @At("RETURN"))
|
||||
private void stopSpawningSection(CallbackInfo ci)
|
||||
{
|
||||
if (currentSection != null)
|
||||
@@ -56,18 +33,4 @@ public abstract class ServerChunkCache_profilerMixin
|
||||
CarpetProfiler.end_current_section(currentSection);
|
||||
}
|
||||
}
|
||||
|
||||
//@Redirect(method = "tick", at = @At(
|
||||
// value = "INVOKE",
|
||||
// target = "Lnet/minecraft/server/level/DistanceManager;purgeStaleTickets()V"
|
||||
//))
|
||||
//private void pauseTicketSystem(DistanceManager distanceManager)
|
||||
//{
|
||||
// pausing expiry of tickets
|
||||
// that will prevent also chunks from unloading, so require a deep frozen state
|
||||
//ServerTickRateManager trm = ((MinecraftServerInterface) level.getServer()).getTickRateManager();
|
||||
//if (!trm.runsNormally() && trm.deeplyFrozen()) return;
|
||||
//distanceManager.purgeStaleTickets();
|
||||
//}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.fakes.EntityInterface;
|
||||
import net.minecraft.network.protocol.game.ServerboundChatCommandPacket;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@@ -51,9 +52,14 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin
|
||||
{
|
||||
@Shadow public ServerPlayer player;
|
||||
|
||||
@Inject(method = "handlePlayerInput", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;setPlayerInput(FFZZ)V"))
|
||||
@Inject(method = "handlePlayerInput", at = @At("HEAD"))
|
||||
private void checkMoves(ServerboundPlayerInputPacket p, CallbackInfo ci)
|
||||
{
|
||||
// todo this may not ride on the right thread moment, so needs to be checked
|
||||
|
||||
if (!((EntityInterface)player.getVehicle()).isPermanentVehicle()) // won't since that method makes sure its not null
|
||||
player.setShiftKeyDown(p.isShiftKeyDown());
|
||||
|
||||
if (PLAYER_RIDES.isNeeded() && (p.getXxa() != 0.0F || p.getZza() != 0.0F || p.isJumping() || p.isShiftKeyDown()))
|
||||
{
|
||||
PLAYER_RIDES.onMountControls(player, p.getXxa(), p.getZza(), p.isJumping(), p.isShiftKeyDown());
|
||||
@@ -246,7 +252,7 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin
|
||||
{
|
||||
if (PLAYER_CHOOSES_RECIPE.isNeeded())
|
||||
{
|
||||
if(PLAYER_CHOOSES_RECIPE.onRecipeSelected(player, packet.getRecipe(), packet.isShiftDown())) ci.cancel();
|
||||
if(PLAYER_CHOOSES_RECIPE.onRecipeSelected(player, packet.getRecipe(), packet.isUseMaxItems())) ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import net.minecraft.world.level.entity.LevelEntityGetter;
|
||||
import net.minecraft.world.level.entity.PersistentEntitySectionManager;
|
||||
import net.minecraft.world.level.storage.ServerLevelData;
|
||||
import net.minecraft.world.level.storage.WritableLevelData;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@@ -31,7 +32,6 @@ import org.spongepowered.asm.mixin.Unique;
|
||||
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 org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
@@ -65,8 +65,8 @@ public abstract class ServerLevel_scarpetMixin extends Level implements ServerWo
|
||||
return getGameRules().getBoolean(rule) ? Explosion.BlockInteraction.DESTROY_WITH_DECAY : Explosion.BlockInteraction.DESTROY;
|
||||
}
|
||||
|
||||
@Inject(method = "explode", at = @At("HEAD"))
|
||||
private void handleExplosion(/*@Nullable*/ Entity entity, /*@Nullable*/ DamageSource damageSource, /*@Nullable*/ ExplosionDamageCalculator explosionBehavior, double d, double e, double f, float g, boolean bl, ExplosionInteraction explosionInteraction, ParticleOptions particleOptions, ParticleOptions particleOptions2, Holder<SoundEvent> soundEvent, CallbackInfoReturnable<Explosion> cir)
|
||||
@Inject(method = "explode", at = @At("HEAD"), cancellable = true)
|
||||
private void handleExplosion(final Entity entity, final DamageSource damageSource, final ExplosionDamageCalculator explosionDamageCalculator, final double x, final double y, final double z, final float g, final boolean bl, final ExplosionInteraction explosionInteraction, final ParticleOptions particleOptions, final ParticleOptions particleOptions2, final Holder<SoundEvent> holder, final CallbackInfo ci)
|
||||
{
|
||||
if (EXPLOSION.isNeeded()) {
|
||||
Explosion.BlockInteraction var10000 = switch (explosionInteraction) {
|
||||
@@ -74,10 +74,12 @@ public abstract class ServerLevel_scarpetMixin extends Level implements ServerWo
|
||||
case BLOCK -> this.getCMDestroyType(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY);
|
||||
case MOB -> this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? this.getCMDestroyType(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY) : Explosion.BlockInteraction.KEEP;
|
||||
case TNT -> this.getCMDestroyType(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY);
|
||||
case TRIGGER -> Explosion.BlockInteraction.TRIGGER_BLOCK;
|
||||
default -> throw new IncompatibleClassChangeError();
|
||||
};
|
||||
|
||||
EXPLOSION.onExplosion((ServerLevel) (Object) this, entity, null, d, e, f, g, bl, null, null, var10000);
|
||||
boolean cancelled = EXPLOSION.onExplosion((ServerLevel) (Object) this, entity, null, new Vec3(x, y, z), g, bl, null, null, var10000);
|
||||
if (cancelled) ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package carpet.mixins;
|
||||
import carpet.helpers.BlockRotator;
|
||||
import net.minecraft.server.level.ServerPlayerGameMode;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.ItemInteractionResult;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -19,13 +19,13 @@ public class ServerPlayerGameMode_cactusMixin
|
||||
|
||||
@Redirect(method = "useItemOn", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/level/block/state/BlockState;useItemOn(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/phys/BlockHitResult;)Lnet/minecraft/world/ItemInteractionResult;"
|
||||
target = "Lnet/minecraft/world/level/block/state/BlockState;useItemOn(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/phys/BlockHitResult;)Lnet/minecraft/world/InteractionResult;"
|
||||
))
|
||||
private ItemInteractionResult activateWithOptionalCactus(final BlockState blockState, final ItemStack itemStack, final Level world_1, final Player playerEntity_1, final InteractionHand hand_1, final BlockHitResult blockHitResult_1)
|
||||
private InteractionResult activateWithOptionalCactus(final BlockState blockState, final ItemStack itemStack, final Level world_1, final Player playerEntity_1, final InteractionHand hand_1, final BlockHitResult blockHitResult_1)
|
||||
{
|
||||
boolean flipped = BlockRotator.flipBlockWithCactus(blockState, world_1, playerEntity_1, hand_1, blockHitResult_1);
|
||||
if (flipped)
|
||||
return ItemInteractionResult.SUCCESS;
|
||||
return InteractionResult.SUCCESS;
|
||||
|
||||
return blockState.useItemOn(itemStack, world_1, playerEntity_1, hand_1, blockHitResult_1);
|
||||
}
|
||||
|
||||
@@ -83,16 +83,6 @@ public abstract class ServerPlayer_scarpetEventMixin extends Player implements S
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "setPlayerInput", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/level/ServerPlayer;setShiftKeyDown(Z)V"
|
||||
))
|
||||
private void setSneakingConditionally(ServerPlayer serverPlayerEntity, boolean sneaking)
|
||||
{
|
||||
if (!((EntityInterface)serverPlayerEntity.getVehicle()).isPermanentVehicle()) // won't since that method makes sure its not null
|
||||
serverPlayerEntity.setShiftKeyDown(sneaking);
|
||||
}
|
||||
|
||||
private Vec3 previousLocation;
|
||||
private ResourceKey<Level> previousDimension;
|
||||
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
package carpet.mixins;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import net.minecraft.client.model.ShulkerModel;
|
||||
|
||||
@Mixin(net.minecraft.client.renderer.blockentity.ShulkerBoxRenderer.class)
|
||||
public interface ShulkerBoxAccessMixin {
|
||||
@Accessor("model")
|
||||
ShulkerModel getModel();
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.server.commands.SummonCommand;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.DifficultyInstance;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntitySpawnReason;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LightningBolt;
|
||||
import net.minecraft.world.entity.animal.horse.SkeletonHorse;
|
||||
@@ -31,7 +32,7 @@ public class SummonCommand_lightningMixin
|
||||
DifficultyInstance localDifficulty_1 = world.getCurrentDifficultyAt(at);
|
||||
boolean boolean_2 = world.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && world.random.nextDouble() < (double)localDifficulty_1.getEffectiveDifficulty() * 0.01D;
|
||||
if (boolean_2) {
|
||||
SkeletonHorse skeletonHorseEntity_1 = EntityType.SKELETON_HORSE.create(world);
|
||||
SkeletonHorse skeletonHorseEntity_1 = EntityType.SKELETON_HORSE.create(world, EntitySpawnReason.EVENT);
|
||||
skeletonHorseEntity_1.setTrap(true);
|
||||
skeletonHorseEntity_1.setAge(0);
|
||||
skeletonHorseEntity_1.setPos(entity.getX(), entity.getY(), entity.getZ());
|
||||
|
||||
Reference in new issue
Block a user