Merge branch 'master' into 1.17
# Conflicts: # gradle.properties
This commit is contained in:
commit
0453dc33a0
4 files changed
+25
-9
No files matched your search
@@ -36,7 +36,7 @@ import static carpet.settings.RuleCategory.CLIENT;
|
||||
@SuppressWarnings("CanBeFinal")
|
||||
public class CarpetSettings
|
||||
{
|
||||
public static final String carpetVersion = "1.4.21+v201216";
|
||||
public static final String carpetVersion = "1.4.22+v210113";
|
||||
public static final Logger LOG = LogManager.getLogger("carpet");
|
||||
public static boolean skipGenerationChecks = false;
|
||||
public static boolean impendingFillSkipUpdates = false;
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.item.Items;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.dynamic.GlobalPos;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -113,7 +114,7 @@ public abstract class VillagerEntity_aiMixin extends MerchantEntity
|
||||
}
|
||||
|
||||
@Inject(method = "interactMob", at = @At("HEAD"), cancellable = true)
|
||||
private void onInteract(PlayerEntity playerEntity_1, Hand hand_1, CallbackInfoReturnable<Boolean> cir)
|
||||
private void onInteract(PlayerEntity playerEntity_1, Hand hand_1, CallbackInfoReturnable<ActionResult> cir)
|
||||
{
|
||||
if (MobAI.isTracking(this, MobAI.TrackingType.VILLAGER_BREEDING))
|
||||
{
|
||||
@@ -121,7 +122,7 @@ public abstract class VillagerEntity_aiMixin extends MerchantEntity
|
||||
if (itemStack_1.getItem() == Items.EMERALD)
|
||||
{
|
||||
GlobalPos bedPos = this.brain.getOptionalMemory(MemoryModuleType.HOME).orElse(null);
|
||||
if (bedPos == null || bedPos.getDimension() != world.getRegistryKey()) // get DImension
|
||||
if (bedPos == null || bedPos.getDimension() != world.getRegistryKey()) // get Dimension
|
||||
{
|
||||
sayNo();
|
||||
((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER, getX(), getY() + getStandingEyeHeight() + 1, getZ(), 1, 0.1, 0.1, 0.1, 0.0);
|
||||
@@ -162,7 +163,7 @@ public abstract class VillagerEntity_aiMixin extends MerchantEntity
|
||||
1, 0.1, 0.1, 0.1, 0.0);
|
||||
}
|
||||
}
|
||||
cir.setReturnValue(false);
|
||||
cir.setReturnValue(ActionResult.FAIL);
|
||||
cir.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,23 +182,38 @@ public class CarpetEventServer
|
||||
|
||||
public final List<Callback> callList;
|
||||
public final int reqArgs;
|
||||
final boolean isSystem;
|
||||
final boolean isGlobalOnly;
|
||||
final boolean perPlayerDistribution;
|
||||
|
||||
public CallbackList(int reqArgs)
|
||||
public CallbackList(int reqArgs, boolean isSystem, boolean isGlobalOnly)
|
||||
{
|
||||
this.callList = new ArrayList<>();
|
||||
this.reqArgs = reqArgs;
|
||||
this.isSystem = isSystem;
|
||||
this.isGlobalOnly = isGlobalOnly;
|
||||
perPlayerDistribution = isSystem && !isGlobalOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles only built-in events from the events system
|
||||
* @param argumentSupplier
|
||||
* @param cmdSourceSupplier
|
||||
*/
|
||||
public void call(Supplier<List<Value>> argumentSupplier, Supplier<ServerCommandSource> cmdSourceSupplier)
|
||||
{
|
||||
if (callList.size() > 0)
|
||||
{
|
||||
List<Value> argv = argumentSupplier.get(); // empty for onTickDone
|
||||
ServerCommandSource source = cmdSourceSupplier.get();
|
||||
String nameCheck = perPlayerDistribution?source.getName():null;
|
||||
assert argv.size() == reqArgs;
|
||||
List<Callback> fails = new ArrayList<>();
|
||||
for (Callback call: callList)
|
||||
{
|
||||
// supressing calls where target player hosts simply don't match
|
||||
// handling global hosts with player targets is left to when the host is resolved (few calls deeper).
|
||||
if (nameCheck != null && call.optionalTarget != null && !nameCheck.equals(call.optionalTarget)) continue;
|
||||
if (!call.execute(source, argv)) fails.add(call);
|
||||
}
|
||||
for (Callback call : fails) callList.remove(call);
|
||||
@@ -876,7 +891,7 @@ public class CarpetEventServer
|
||||
public Event(String name, int reqArgs, boolean isGlobalOnly, boolean isPublic)
|
||||
{
|
||||
this.name = name;
|
||||
this.handler = new CallbackList(reqArgs);
|
||||
this.handler = new CallbackList(reqArgs, true, isGlobalOnly);
|
||||
this.globalOnly = isGlobalOnly;
|
||||
this.isPublic = isPublic;
|
||||
byName.put(name, this);
|
||||
@@ -924,7 +939,7 @@ public class CarpetEventServer
|
||||
private Event(String name, CarpetScriptServer server)
|
||||
{
|
||||
this.name = name;
|
||||
this.handler = new CallbackList(1);
|
||||
this.handler = new CallbackList(1, false, false);
|
||||
this.globalOnly = false;
|
||||
this.isPublic = true;
|
||||
server.events.customEvents.put(name, this);
|
||||
|
||||
Reference in new issue
Block a user