24w21a - broken shapes
This commit is contained in:
1 parent
7a1e152229
commit
9e578e6cc9
18 files changed
+274
-235
No files matched your search
@@ -2,6 +2,7 @@ package carpet.mixins;
|
||||
|
||||
import carpet.network.CarpetClient;
|
||||
import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
|
||||
import net.minecraft.network.DisconnectionDetails;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -13,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
public class ClientCommonPacketListenerImpl_customPacketMixin
|
||||
{
|
||||
@Inject(method = "onDisconnect", at = @At("HEAD"))
|
||||
private void onCMDisconnected(Component reason, CallbackInfo ci)
|
||||
private void onCMDisconnected(DisconnectionDetails reason, CallbackInfo ci)
|
||||
{
|
||||
CarpetClient.disconnect();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.fakes.EntityInterface;
|
||||
import carpet.fakes.PortalProcessorInterface;
|
||||
import carpet.script.EntityEventsGroup;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.PortalProcessor;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -15,13 +18,13 @@ public abstract class Entity_scarpetEventsMixin implements EntityInterface
|
||||
{
|
||||
//@Shadow public boolean removed;
|
||||
|
||||
@Shadow protected int portalTime;
|
||||
@Shadow private int portalCooldown;
|
||||
|
||||
@Shadow public abstract boolean isRemoved();
|
||||
|
||||
@Shadow private Vec3 position, deltaMovement;
|
||||
|
||||
@Shadow @Nullable public PortalProcessor portalProcess;
|
||||
private boolean permanentVehicle;
|
||||
|
||||
private final EntityEventsGroup events = new EntityEventsGroup((Entity) (Object)this);
|
||||
@@ -61,13 +64,13 @@ public abstract class Entity_scarpetEventsMixin implements EntityInterface
|
||||
@Override
|
||||
public int getPortalTimer()
|
||||
{
|
||||
return portalTime;
|
||||
return portalProcess.getPortalTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPortalTimer(int amount)
|
||||
{
|
||||
portalTime = amount;
|
||||
((PortalProcessorInterface)portalProcess).setPortalTime(amount);
|
||||
}
|
||||
|
||||
@Inject(method = "tick", at = @At("HEAD"))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import carpet.patches.EntityPlayerMPFake;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@@ -47,4 +48,12 @@ public abstract class LivingEntity_creativeFlyMixin extends Entity
|
||||
cir.setReturnValue( getFlyingSpeed() * (float)CarpetSettings.creativeFlySpeed);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "canChangeDimensions", at = @At("HEAD"), cancellable = true)
|
||||
private void canChangeDimensions(CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
if (CarpetSettings.isCreativeFlying(this)) {
|
||||
cir.setReturnValue(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.fakes.PortalProcessorInterface;
|
||||
import net.minecraft.world.entity.PortalProcessor;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(PortalProcessor.class)
|
||||
public class PortalProcessor_scarpetMixin implements PortalProcessorInterface
|
||||
{
|
||||
|
||||
@Shadow private int portalTime;
|
||||
|
||||
@Override
|
||||
public void setPortalTime(int time)
|
||||
{
|
||||
portalTime = time;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package carpet.mixins;
|
||||
import carpet.CarpetServer;
|
||||
import carpet.fakes.ServerGamePacketListenerImplInterface;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.DisconnectionDetails;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
@@ -26,8 +27,8 @@ public abstract class ServerGamePacketListenerImpl_coreMixin extends ServerCommo
|
||||
}
|
||||
|
||||
@Inject(method = "onDisconnect", at = @At("HEAD"))
|
||||
private void onPlayerDisconnect(Component reason, CallbackInfo ci) {
|
||||
CarpetServer.onPlayerLoggedOut(this.player, reason);
|
||||
private void onPlayerDisconnect(DisconnectionDetails reason, CallbackInfo ci) {
|
||||
CarpetServer.onPlayerLoggedOut(this.player, reason.reason());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -97,20 +97,20 @@ public abstract class ServerPlayer_scarpetEventMixin extends Player implements S
|
||||
private ResourceKey<Level> previousDimension;
|
||||
|
||||
@Inject(method = "changeDimension", at = @At("HEAD"))
|
||||
private void logPreviousCoordinates(DimensionTransitionSupplier serverWorld, CallbackInfoReturnable<Entity> cir)
|
||||
private void logPreviousCoordinates(DimensionTransition serverWorld, CallbackInfoReturnable<Entity> cir)
|
||||
{
|
||||
previousLocation = position();
|
||||
previousDimension = level().dimension(); //dimension type
|
||||
}
|
||||
|
||||
@Inject(method = "changeDimension", at = @At("RETURN"))
|
||||
private void atChangeDimension(DimensionTransitionSupplier destinationP, CallbackInfoReturnable<Entity> cir)
|
||||
private void atChangeDimension(DimensionTransition destinationP, CallbackInfoReturnable<Entity> cir)
|
||||
{
|
||||
if (PLAYER_CHANGES_DIMENSION.isNeeded())
|
||||
{
|
||||
ServerPlayer player = (ServerPlayer) (Object)this;
|
||||
DimensionTransition destinationTransition = destinationP.get();
|
||||
ServerLevel destination = destinationTransition.newDimension();
|
||||
DimensionTransition destinationTransition = destinationP;
|
||||
ServerLevel destination = destinationTransition.newLevel();
|
||||
Vec3 to = null;
|
||||
if (!wonGame || previousDimension != Level.END || destination.dimension() != Level.OVERWORLD)
|
||||
{
|
||||
|
||||
@@ -11,9 +11,5 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
@Mixin(TheEndGatewayBlockEntity.class)
|
||||
public class TheEndGatewayBlockEntity_creativeNoClipMixin
|
||||
{
|
||||
@Inject(method = "canEntityTeleport", cancellable = true, at = @At("HEAD"))
|
||||
private static void checkFlyingCreative(Entity entity, CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
if (CarpetSettings.isCreativeFlying(entity)) cir.setReturnValue(false);
|
||||
}
|
||||
// removeme
|
||||
}
|
||||
Reference in new issue
Block a user