Merge branch 'master' into 1.16
# Conflicts: # src/main/java/carpet/CarpetSettings.java # src/main/java/carpet/script/CarpetScriptServer.java # src/main/java/carpet/script/bundled/Module.java
This commit is contained in:
commit
f29153c3d2
21 files changed
+601
-74
No files matched your search
@@ -2,9 +2,13 @@ package carpet.mixins;
|
||||
|
||||
import carpet.helpers.OptimizedExplosion;
|
||||
import carpet.CarpetSettings;
|
||||
import carpet.logging.LoggerRegistry;
|
||||
import carpet.logging.logHelpers.ExplosionLogHelper;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.explosion.Explosion;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@@ -24,13 +28,17 @@ public abstract class ExplosionMixin
|
||||
@Final
|
||||
private List<BlockPos> affectedBlocks;
|
||||
|
||||
@Shadow @Final private World world;
|
||||
|
||||
private ExplosionLogHelper eLogger;
|
||||
|
||||
@Inject(method = "collectBlocksAndDamageEntities", at = @At("HEAD"),
|
||||
cancellable = true)
|
||||
private void onExplosionA(CallbackInfo ci)
|
||||
{
|
||||
if (CarpetSettings.optimizedTNT)
|
||||
{
|
||||
OptimizedExplosion.doExplosionA((Explosion) (Object) this);
|
||||
OptimizedExplosion.doExplosionA((Explosion) (Object) this, eLogger);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
@@ -39,6 +47,11 @@ public abstract class ExplosionMixin
|
||||
cancellable = true)
|
||||
private void onExplosionB(boolean spawnParticles, CallbackInfo ci)
|
||||
{
|
||||
if (eLogger != null)
|
||||
{
|
||||
eLogger.setAffectBlocks( ! affectedBlocks.isEmpty());
|
||||
eLogger.onExplosionDone(this.world.getTime());
|
||||
}
|
||||
if (CarpetSettings.explosionNoBlockDamage)
|
||||
{
|
||||
affectedBlocks.clear();
|
||||
@@ -58,4 +71,24 @@ public abstract class ExplosionMixin
|
||||
if (CarpetSettings.explosionNoBlockDamage) return Blocks.BEDROCK.getDefaultState();
|
||||
return world.getBlockState(pos);
|
||||
}
|
||||
|
||||
@Inject(method = "<init>(Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;DDDFZLnet/minecraft/world/explosion/Explosion$DestructionType;)V",
|
||||
at = @At(value = "RETURN"))
|
||||
private void onExplosionCreated(World world, Entity entity, double x, double y, double z, float power, boolean createFire, Explosion.DestructionType blockDestructionType, CallbackInfo ci)
|
||||
{
|
||||
if (LoggerRegistry.__explosions && ! world.isClient)
|
||||
{
|
||||
eLogger = new ExplosionLogHelper(entity, x, y, z, power, createFire, blockDestructionType);
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "collectBlocksAndDamageEntities",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setVelocity(Lnet/minecraft/util/math/Vec3d;)V"))
|
||||
private void setVelocityAndUpdateLogging(Entity entity, Vec3d velocity)
|
||||
{
|
||||
if (eLogger != null) {
|
||||
eLogger.onEntityImpacted(entity, velocity.subtract(entity.getVelocity()));
|
||||
}
|
||||
entity.setVelocity(velocity);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import carpet.fakes.PistonBlockEntityInterface;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.piston.PistonBehavior;
|
||||
import net.minecraft.block.piston.PistonHandler;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@@ -62,6 +63,17 @@ public abstract class PistonBlock_movableTEMixin extends FacingBlock
|
||||
return !(CarpetSettings.movableBlockEntities && isPushableBlockEntity(block));
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "isMovable", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/block/BlockState;getPistonBehavior()Lnet/minecraft/block/piston/PistonBehavior;"
|
||||
))
|
||||
private static PistonBehavior moveGrindstones(BlockState blockState)
|
||||
{
|
||||
if (CarpetSettings.movableBlockEntities && blockState.getBlock() == Blocks.GRINDSTONE) return PistonBehavior.NORMAL;
|
||||
return blockState.getPistonBehavior();
|
||||
}
|
||||
|
||||
@Inject(method = "move", at = @At(value = "INVOKE", shift = At.Shift.BEFORE,
|
||||
target = "Ljava/util/List;size()I", ordinal = 4),locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private void onMove(World world_1, BlockPos blockPos_1, Direction direction_1, boolean boolean_1,
|
||||
|
||||
@@ -23,7 +23,7 @@ public abstract class PlayerEntity_antiCheatDisabled
|
||||
@Inject(method = "checkFallFlying", at = @At("HEAD"), cancellable = true)
|
||||
private void allowDeploys(CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
if (CarpetSettings.antiCheatDisabled && CarpetServer.minecraft_server.isDedicated())
|
||||
if (CarpetSettings.antiCheatDisabled && CarpetServer.minecraft_server != null && CarpetServer.minecraft_server.isDedicated())
|
||||
{
|
||||
ItemStack itemStack_1 = getEquippedStack(EquipmentSlot.CHEST);
|
||||
if (itemStack_1.getItem() == Items.ELYTRA && ElytraItem.isUsable(itemStack_1)) {
|
||||
|
||||
Reference in new issue
Block a user