Merge branch 'master' into 1.15
This commit is contained in:
commit
1ea8815bd0
7 files changed
+79
-14
No files matched your search
@@ -356,6 +356,16 @@ public class CarpetSettings
|
|||||||
)
|
)
|
||||||
public static int fillLimit = 32768;
|
public static int fillLimit = 32768;
|
||||||
|
|
||||||
|
|
||||||
|
@Rule(
|
||||||
|
desc = "Customizable forceload chunk limit",
|
||||||
|
options = {"256"},
|
||||||
|
category = CREATIVE,
|
||||||
|
strict = false,
|
||||||
|
validate = FillLimitLimits.class
|
||||||
|
)
|
||||||
|
public static int forceloadLimit = 256;
|
||||||
|
|
||||||
@Rule(
|
@Rule(
|
||||||
desc = "Customizable maximal entity collision limits, 0 for no limits",
|
desc = "Customizable maximal entity collision limits, 0 for no limits",
|
||||||
options = {"0", "1", "20"},
|
options = {"0", "1", "20"},
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ public class PlayerCommand
|
|||||||
.then(makeActionCommand("swapHands", EntityPlayerActionPack.ActionType.SWAP_HANDS))
|
.then(makeActionCommand("swapHands", EntityPlayerActionPack.ActionType.SWAP_HANDS))
|
||||||
.then(literal("kill").executes(PlayerCommand::kill))
|
.then(literal("kill").executes(PlayerCommand::kill))
|
||||||
.then(literal("shadow"). executes(PlayerCommand::shadow))
|
.then(literal("shadow"). executes(PlayerCommand::shadow))
|
||||||
.then(literal("mount").executes(manipulation(EntityPlayerActionPack::mount)))
|
.then(literal("mount").executes(manipulation(ap -> ap.mount(true)))
|
||||||
|
.then(literal("anything").executes(manipulation(ap -> ap.mount(false)))))
|
||||||
.then(literal("dismount").executes(manipulation(EntityPlayerActionPack::dismount)))
|
.then(literal("dismount").executes(manipulation(EntityPlayerActionPack::dismount)))
|
||||||
.then(literal("sneak").executes(manipulation(ap -> ap.setSneaking(true))))
|
.then(literal("sneak").executes(manipulation(ap -> ap.setSneaking(true))))
|
||||||
.then(literal("unsneak").executes(manipulation(ap -> ap.setSneaking(false))))
|
.then(literal("unsneak").executes(manipulation(ap -> ap.setSneaking(false))))
|
||||||
@@ -78,7 +79,7 @@ public class PlayerCommand
|
|||||||
.then(literal("back").executes(c -> manipulate(c, ap -> ap.turn(180, 0))))
|
.then(literal("back").executes(c -> manipulate(c, ap -> ap.turn(180, 0))))
|
||||||
.then(argument("rotation", RotationArgumentType.rotation())
|
.then(argument("rotation", RotationArgumentType.rotation())
|
||||||
.executes(c -> manipulate(c, ap -> ap.turn(RotationArgumentType.getRotation(c, "rotation").toAbsoluteRotation(c.getSource())))))
|
.executes(c -> manipulate(c, ap -> ap.turn(RotationArgumentType.getRotation(c, "rotation").toAbsoluteRotation(c.getSource())))))
|
||||||
).then(literal("move")
|
).then(literal("move").executes(c -> manipulate(c, EntityPlayerActionPack::stopMovement))
|
||||||
.then(literal("forward").executes(c -> manipulate(c, ap -> ap.setForward(1))))
|
.then(literal("forward").executes(c -> manipulate(c, ap -> ap.setForward(1))))
|
||||||
.then(literal("backward").executes(c -> manipulate(c, ap -> ap.setForward(-1))))
|
.then(literal("backward").executes(c -> manipulate(c, ap -> ap.setForward(-1))))
|
||||||
.then(literal("left").executes(c -> manipulate(c, ap -> ap.setStrafing(1))))
|
.then(literal("left").executes(c -> manipulate(c, ap -> ap.setStrafing(1))))
|
||||||
@@ -244,7 +245,7 @@ public class PlayerCommand
|
|||||||
{
|
{
|
||||||
if (cantManipulate(context)) return 0;
|
if (cantManipulate(context)) return 0;
|
||||||
ServerPlayerEntity player = getPlayer(context);
|
ServerPlayerEntity player = getPlayer(context);
|
||||||
((ServerPlayerEntityInterface) player).getActionPack().stop();
|
((ServerPlayerEntityInterface) player).getActionPack().stopAll();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ package carpet.helpers;
|
|||||||
import carpet.fakes.ServerPlayerEntityInterface;
|
import carpet.fakes.ServerPlayerEntityInterface;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.passive.HorseBaseEntity;
|
||||||
|
import net.minecraft.entity.vehicle.BoatEntity;
|
||||||
|
import net.minecraft.entity.vehicle.MinecartEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.server.network.packet.PlayerActionC2SPacket;
|
import net.minecraft.server.network.packet.PlayerActionC2SPacket;
|
||||||
@@ -41,7 +44,7 @@ public class EntityPlayerActionPack
|
|||||||
public EntityPlayerActionPack(ServerPlayerEntity playerIn)
|
public EntityPlayerActionPack(ServerPlayerEntity playerIn)
|
||||||
{
|
{
|
||||||
player = playerIn;
|
player = playerIn;
|
||||||
stop();
|
stopAll();
|
||||||
}
|
}
|
||||||
public void copyFrom(EntityPlayerActionPack other)
|
public void copyFrom(EntityPlayerActionPack other)
|
||||||
{
|
{
|
||||||
@@ -132,11 +135,8 @@ public class EntityPlayerActionPack
|
|||||||
return turn(rotation.x, rotation.y);
|
return turn(rotation.x, rotation.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityPlayerActionPack stopMovement()
|
||||||
public EntityPlayerActionPack stop()
|
|
||||||
{
|
{
|
||||||
for (ActionType type : actions.keySet()) type.stop(player, actions.get(type));
|
|
||||||
actions.clear();
|
|
||||||
setSneaking(false);
|
setSneaking(false);
|
||||||
setSprinting(false);
|
setSprinting(false);
|
||||||
forward = 0.0F;
|
forward = 0.0F;
|
||||||
@@ -144,10 +144,27 @@ public class EntityPlayerActionPack
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityPlayerActionPack mount()
|
|
||||||
|
public EntityPlayerActionPack stopAll()
|
||||||
|
{
|
||||||
|
for (ActionType type : actions.keySet()) type.stop(player, actions.get(type));
|
||||||
|
actions.clear();
|
||||||
|
return stopMovement();
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityPlayerActionPack mount(boolean onlyRideables)
|
||||||
{
|
{
|
||||||
//test what happens
|
//test what happens
|
||||||
List<Entity> entities = player.world.getEntities(player,player.getBoundingBox().expand(3.0D, 1.0D, 3.0D));
|
List<Entity> entities;
|
||||||
|
if (onlyRideables)
|
||||||
|
{
|
||||||
|
entities = player.world.getEntities(player, player.getBoundingBox().expand(3.0D, 1.0D, 3.0D),
|
||||||
|
e -> e instanceof MinecartEntity || e instanceof BoatEntity || e instanceof HorseBaseEntity);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entities = player.world.getEntities(player, player.getBoundingBox().expand(3.0D, 1.0D, 3.0D));
|
||||||
|
}
|
||||||
if (entities.size()==0)
|
if (entities.size()==0)
|
||||||
return this;
|
return this;
|
||||||
Entity closest = null;
|
Entity closest = null;
|
||||||
@@ -164,7 +181,11 @@ public class EntityPlayerActionPack
|
|||||||
closest = e;
|
closest = e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (closest != null) player.startRiding(closest,true);
|
if (closest == null) return this;
|
||||||
|
if (closest instanceof HorseBaseEntity && onlyRideables)
|
||||||
|
((HorseBaseEntity) closest).interactMob(player, Hand.MAIN_HAND);
|
||||||
|
else
|
||||||
|
player.startRiding(closest,true);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public EntityPlayerActionPack dismount()
|
public EntityPlayerActionPack dismount()
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.server.command.ForceLoadCommand;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
@Mixin(ForceLoadCommand.class)
|
||||||
|
public class ForceLoadCommand_forceLoadLimitMixin
|
||||||
|
{
|
||||||
|
@ModifyConstant(method = "executeChange", constant = @Constant(longValue = 256L))
|
||||||
|
private static long forceloadLimit(long original)
|
||||||
|
{
|
||||||
|
return CarpetSettings.forceloadLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModifyConstant(method = "executeChange", constant = @Constant(intValue = 256))
|
||||||
|
private static int forceloadLimitError(int original)
|
||||||
|
{
|
||||||
|
return CarpetSettings.forceloadLimit;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1726,6 +1726,8 @@ public class CarpetExpression
|
|||||||
* <p>Eye height of the entity.</p>
|
* <p>Eye height of the entity.</p>
|
||||||
* <h3><code>query(e,'age')</code></h3>
|
* <h3><code>query(e,'age')</code></h3>
|
||||||
* <p>Age, in ticks, of the entity, i.e. how long it existed.</p>
|
* <p>Age, in ticks, of the entity, i.e. how long it existed.</p>
|
||||||
|
* <h3><code>query(e,'breeding_age')</code></h3>
|
||||||
|
* <p>Breeding age of passive entity, in ticks. If negative it it time to adulthood, if positive, breeding cooldown</p>
|
||||||
* <h3><code>query(e,'despawn_timer')</code></h3>
|
* <h3><code>query(e,'despawn_timer')</code></h3>
|
||||||
* <p>For living entities - the number of ticks they fall outside of immediate player presence.</p>
|
* <p>For living entities - the number of ticks they fall outside of immediate player presence.</p>
|
||||||
* <h3><code>query(e,'item')</code></h3>
|
* <h3><code>query(e,'item')</code></h3>
|
||||||
@@ -1827,7 +1829,7 @@ public class CarpetExpression
|
|||||||
* <p>Adds a vector to the motion vector. Most realistic way to apply a force to an entity.</p>
|
* <p>Adds a vector to the motion vector. Most realistic way to apply a force to an entity.</p>
|
||||||
* <h3><code>modify(e, 'custom_name'), modify(e, 'custom_name', name )</code></h3>
|
* <h3><code>modify(e, 'custom_name'), modify(e, 'custom_name', name )</code></h3>
|
||||||
* <h3><code>modify(e, 'pickup_delay')</code></h3>
|
* <h3><code>modify(e, 'pickup_delay')</code></h3>
|
||||||
* <p>Sets a custom pickup delay if the entity argument is an item entity</p>
|
* <h3><code>modify(e, 'breeding_age')</code></h3>
|
||||||
* <h3><code>modify(e, 'despawn_timer')</code></h3>
|
* <h3><code>modify(e, 'despawn_timer')</code></h3>
|
||||||
* <p>Sets a custom despawn timer value.</p>
|
* <p>Sets a custom despawn timer value.</p>
|
||||||
* <h3><code>modify(e, 'dismount')</code></h3>
|
* <h3><code>modify(e, 'dismount')</code></h3>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import net.minecraft.entity.effect.StatusEffect;
|
|||||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||||
import net.minecraft.entity.mob.MobEntity;
|
import net.minecraft.entity.mob.MobEntity;
|
||||||
import net.minecraft.entity.mob.MobEntityWithAi;
|
import net.minecraft.entity.mob.MobEntityWithAi;
|
||||||
|
import net.minecraft.entity.passive.PassiveEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.predicate.entity.EntityPredicates;
|
import net.minecraft.predicate.entity.EntityPredicates;
|
||||||
@@ -245,6 +246,7 @@ public class EntityValue extends Value
|
|||||||
put("width", (e, a) -> new NumericValue(e.getDimensions(EntityPose.STANDING).width));
|
put("width", (e, a) -> new NumericValue(e.getDimensions(EntityPose.STANDING).width));
|
||||||
put("eye_height", (e, a) -> new NumericValue(e.getStandingEyeHeight()));
|
put("eye_height", (e, a) -> new NumericValue(e.getStandingEyeHeight()));
|
||||||
put("age", (e, a) -> new NumericValue(e.age));
|
put("age", (e, a) -> new NumericValue(e.age));
|
||||||
|
put("breeding_age", (e, a) -> e instanceof PassiveEntity?new NumericValue(((PassiveEntity) e).getBreedingAge()):Value.NULL);
|
||||||
put("despawn_timer", (e, a) -> e instanceof LivingEntity?new NumericValue(((LivingEntity) e).getDespawnCounter()):Value.NULL);
|
put("despawn_timer", (e, a) -> e instanceof LivingEntity?new NumericValue(((LivingEntity) e).getDespawnCounter()):Value.NULL);
|
||||||
put("item", (e, a) -> (e instanceof ItemEntity)?ListValue.fromItemStack(((ItemEntity) e).getStack()):Value.NULL);
|
put("item", (e, a) -> (e instanceof ItemEntity)?ListValue.fromItemStack(((ItemEntity) e).getStack()):Value.NULL);
|
||||||
put("count", (e, a) -> (e instanceof ItemEntity)?new NumericValue(((ItemEntity) e).getStack().getCount()):Value.NULL);
|
put("count", (e, a) -> (e instanceof ItemEntity)?new NumericValue(((ItemEntity) e).getStack().getCount()):Value.NULL);
|
||||||
@@ -668,6 +670,13 @@ public class EntityValue extends Value
|
|||||||
// ((MobEntity) e).setTarget(elb);
|
// ((MobEntity) e).setTarget(elb);
|
||||||
// }
|
// }
|
||||||
//});
|
//});
|
||||||
|
put("breeding_age", (e, v) ->
|
||||||
|
{
|
||||||
|
if (e instanceof PassiveEntity)
|
||||||
|
{
|
||||||
|
((PassiveEntity) e).setBreedingAge((int)NumericValue.asNumber(v).getLong());
|
||||||
|
}
|
||||||
|
});
|
||||||
put("talk", (e, v) -> {
|
put("talk", (e, v) -> {
|
||||||
// attacks indefinitely
|
// attacks indefinitely
|
||||||
if (e instanceof MobEntity)
|
if (e instanceof MobEntity)
|
||||||
@@ -777,8 +786,6 @@ public class EntityValue extends Value
|
|||||||
if (lv.size() >= 2 && lv.size() <= 5)
|
if (lv.size() >= 2 && lv.size() <= 5)
|
||||||
{
|
{
|
||||||
String effectName = lv.get(0).getString();
|
String effectName = lv.get(0).getString();
|
||||||
if (effectName.startsWith("minecraft:"))
|
|
||||||
effectName = "minecraft:"+effectName;
|
|
||||||
StatusEffect effect = Registry.STATUS_EFFECT.get(new Identifier(effectName));
|
StatusEffect effect = Registry.STATUS_EFFECT.get(new Identifier(effectName));
|
||||||
if (effect == null)
|
if (effect == null)
|
||||||
throw new InternalExpressionException("Wrong effect name: "+effectName);
|
throw new InternalExpressionException("Wrong effect name: "+effectName);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
"FillCommandMixin",
|
"FillCommandMixin",
|
||||||
"CloneCommandMixin",
|
"CloneCommandMixin",
|
||||||
"SetBlockCommandMixin",
|
"SetBlockCommandMixin",
|
||||||
|
"ForceLoadCommand_forceLoadLimitMixin",
|
||||||
"World_fillUpdatesMixin",
|
"World_fillUpdatesMixin",
|
||||||
"WorldChunk_fillUpdatesMixin",
|
"WorldChunk_fillUpdatesMixin",
|
||||||
"StructureBlockBlockEntity_fillUpdatesMixin",
|
"StructureBlockBlockEntity_fillUpdatesMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user