24w39a
This commit is contained in:
1 parent
ad8680826d
commit
85d848c488
21 files changed
+80
-32
No files matched your search
@@ -35,7 +35,7 @@ public abstract class ClientPacketListener_clientCommandMixin extends ClientComm
|
||||
if (CarpetServer.minecraft_server == null && !CarpetClient.isCarpet() && minecraft.player != null)
|
||||
{
|
||||
LocalPlayer playerSource = minecraft.player;
|
||||
CarpetServer.forEachManager(sm -> sm.inspectClientsideCommand(playerSource.createCommandSourceStack(), "/" + string));
|
||||
CarpetServer.forEachManager(sm -> sm.inspectClientsideCommand("/" + string));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.fakes.FoodDataInterface;
|
||||
import net.minecraft.world.food.FoodData;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(FoodData.class)
|
||||
public class FoodData_scarpetMixin implements FoodDataInterface
|
||||
{
|
||||
@Shadow private float exhaustionLevel;
|
||||
|
||||
@Override
|
||||
public float getCMExhaustionLevel()
|
||||
{
|
||||
return exhaustionLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExhaustion(float aFloat)
|
||||
{
|
||||
exhaustionLevel = aFloat;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@@ -22,6 +23,6 @@ public abstract class LivingEntity_cleanLogsMixin extends Entity
|
||||
@Redirect(method = "die", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;hasCustomName()Z"))
|
||||
private boolean shouldLogDeaths(LivingEntity livingEntity)
|
||||
{
|
||||
return livingEntity.hasCustomName() && CarpetSettings.cleanLogs && level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
return livingEntity.hasCustomName() && CarpetSettings.cleanLogs && livingEntity.getServer().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public abstract class LivingEntity_maxCollisionsMixin extends Entity
|
||||
int maxEntityCramming =-1;
|
||||
if (CarpetSettings.maxEntityCollisions > 0)
|
||||
{
|
||||
maxEntityCramming = this.level().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
|
||||
maxEntityCramming = this.getServer().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
|
||||
entities = ((LevelInterface) this.level()).getOtherEntitiesLimited(
|
||||
this,
|
||||
this.getBoundingBox(),
|
||||
@@ -50,7 +50,7 @@ public abstract class LivingEntity_maxCollisionsMixin extends Entity
|
||||
}
|
||||
|
||||
if (!entities.isEmpty()) {
|
||||
if (maxEntityCramming < 0) maxEntityCramming = this.level().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
|
||||
if (maxEntityCramming < 0) maxEntityCramming = this.getServer().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
|
||||
if (maxEntityCramming > 0 && entities.size() > maxEntityCramming - 1 && this.random.nextInt(4) == 0) {
|
||||
int candidates = 0;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package carpet.mixins;
|
||||
import carpet.fakes.EntityInterface;
|
||||
import carpet.fakes.LivingEntityInterface;
|
||||
import carpet.script.EntityEventsGroup;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
@@ -42,7 +43,7 @@ public abstract class LivingEntity_scarpetEventsMixin extends Entity implements
|
||||
target = "Lnet/minecraft/world/entity/LivingEntity;getDamageAfterArmorAbsorb(Lnet/minecraft/world/damagesource/DamageSource;F)F",
|
||||
shift = At.Shift.BEFORE
|
||||
))
|
||||
private void entityTakingDamage(DamageSource source, float amount, CallbackInfo ci)
|
||||
private void entityTakingDamage(ServerLevel serverLevel, DamageSource source, float amount, CallbackInfo ci)
|
||||
{
|
||||
((EntityInterface)this).getEventContainer().onEvent(EntityEventsGroup.Event.ON_DAMAGE, amount, source);
|
||||
// this is not applicable since its not a playr for sure
|
||||
|
||||
@@ -2,6 +2,7 @@ package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@@ -57,7 +58,7 @@ public abstract class Player_parrotMixin extends LivingEntity
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "hurt", at = @At(value = "INVOKE",
|
||||
@Redirect(method = "hurtServer", at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/entity/player/Player;removeEntitiesOnShoulder()V"))
|
||||
private void cancelDropShoulderEntities2(Player playerEntity)
|
||||
{
|
||||
@@ -76,9 +77,9 @@ public abstract class Player_parrotMixin extends LivingEntity
|
||||
this.setShoulderEntityRight(new CompoundTag());
|
||||
}
|
||||
|
||||
@Inject(method = "hurt", at = @At(value = "INVOKE", shift = At.Shift.BEFORE,
|
||||
@Inject(method = "hurtServer", at = @At(value = "INVOKE", shift = At.Shift.BEFORE,
|
||||
target = "Lnet/minecraft/world/entity/player/Player;removeEntitiesOnShoulder()V"))
|
||||
private void onDamage(DamageSource damageSource_1, float float_1, CallbackInfoReturnable<Boolean> cir)
|
||||
private void onDamage(ServerLevel serverLevel, DamageSource damageSource_1, float float_1, CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
if (CarpetSettings.persistentParrots && !this.isShiftKeyDown())
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ package carpet.mixins;
|
||||
|
||||
import carpet.fakes.EntityInterface;
|
||||
import carpet.script.EntityEventsGroup;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
@@ -36,7 +37,7 @@ public abstract class Player_scarpetEventsMixin extends LivingEntity
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/entity/player/Player;getDamageAfterArmorAbsorb(Lnet/minecraft/world/damagesource/DamageSource;F)F"
|
||||
))
|
||||
private void playerTakingDamage(DamageSource source, float amount, CallbackInfo ci)
|
||||
private void playerTakingDamage(ServerLevel serverLevel, DamageSource source, float amount, CallbackInfo ci)
|
||||
{
|
||||
// version of LivingEntity_scarpetEventsMixin::entityTakingDamage
|
||||
((EntityInterface)this).getEventContainer().onEvent(EntityEventsGroup.Event.ON_DAMAGE, amount, source);
|
||||
|
||||
@@ -44,6 +44,8 @@ import static carpet.script.CarpetEventServer.Event.CHUNK_UNLOADED;
|
||||
public abstract class ServerLevel_scarpetMixin extends Level implements ServerWorldInterface
|
||||
{
|
||||
|
||||
@Shadow public abstract GameRules getGameRules();
|
||||
|
||||
protected ServerLevel_scarpetMixin(WritableLevelData writableLevelData, ResourceKey<Level> resourceKey, RegistryAccess registryAccess, Holder<DimensionType> holder, boolean bl, boolean bl2, long l, int i)
|
||||
{
|
||||
super(writableLevelData, resourceKey, registryAccess, holder, bl, bl2, l, i);
|
||||
|
||||
@@ -2,6 +2,7 @@ package carpet.mixins;
|
||||
|
||||
import carpet.utils.WoolTool;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.WoolCarpetBlock;
|
||||
@@ -17,12 +18,13 @@ public abstract class WoolCarpetBlock_placeMixin extends Block
|
||||
super(block$Settings_1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockPlaceContext context)
|
||||
{
|
||||
BlockState state = super.getStateForPlacement(context);
|
||||
if (context.getPlayer() != null && !context.getLevel().isClientSide)
|
||||
{ // getColor()
|
||||
WoolTool.carpetPlacedAction(((WoolCarpetBlock)(Object)this).getColor(), context.getPlayer(), context.getClickedPos(), (ServerLevel) context.getLevel());
|
||||
WoolTool.carpetPlacedAction(((WoolCarpetBlock)(Object)this).getColor(), (ServerPlayer) context.getPlayer(), context.getClickedPos(), (ServerLevel) context.getLevel());
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user