20w28a. Rewritten scarpet structure and plop API. Removed portalSuffocationFix, as its fixed.

This commit is contained in:
gnembon committed 2020-07-12 02:38:12 -03:00
1 parent bba9f4e88d
commit a0e0dc0f88
16 files changed
+207 -303

No files matched your search

@@ -4,28 +4,29 @@ import carpet.CarpetSettings;
import com.google.common.collect.Lists;
import com.mojang.serialization.Codec;
import net.minecraft.class_5434;
import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.BastionRemnantFeature;
import net.minecraft.world.gen.feature.BastionRemnantFeatureConfig;
import net.minecraft.world.gen.feature.StructureFeature;
import net.minecraft.world.gen.feature.StructurePoolFeatureConfig;
import org.spongepowered.asm.mixin.Mixin;
import java.util.Collections;
import java.util.List;
@Mixin(BastionRemnantFeature.class)
public abstract class BastionRemnantFeatureMixin extends StructureFeature<BastionRemnantFeatureConfig> {
public abstract class BastionRemnantFeatureMixin extends class_5434
{
private static final List<Biome.SpawnEntry> spawnList = Lists.newArrayList(
new Biome.SpawnEntry(EntityType.PIGLIN_BRUTE, 5, 1, 2),
new Biome.SpawnEntry(EntityType.PIGLIN, 10, 2, 4),
new Biome.SpawnEntry(EntityType.HOGLIN, 2, 1, 2)
);
public BastionRemnantFeatureMixin(Codec<BastionRemnantFeatureConfig> codec) {
super(codec);
public BastionRemnantFeatureMixin(Codec<StructurePoolFeatureConfig> codec, int i, boolean bl, boolean bl2)
{
super(codec, i, bl, bl2);
}
@Override
@@ -11,13 +11,14 @@ import org.spongepowered.asm.mixin.Shadow;
import java.util.Map;
@Mixin(Biome.class)
public class Biome_scarpetMixin implements BiomeInterface
public class Biome_scarpetMixin
{
@Shadow @Final private Map<StructureFeature<?>, ConfiguredStructureFeature<?, ?>> structureFeatures;
//@Shadow @Final private Map<StructureFeature<?>, ConfiguredStructureFeature<?, ?>> structureFeatures;
/*
@Override
public ConfiguredStructureFeature<?, ?> getConfiguredFeature(StructureFeature<?> arg)
{
return structureFeatures.get(arg);
}
return null;
// return structureFeatures.get(arg);
}*/
}
@@ -15,12 +15,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(ChunkGenerator.class)
public abstract class ChunkGeneratorMixin implements ChunkGeneratorInterface
{
@Shadow protected abstract void method_28509();
@Shadow protected abstract void generateStrongholdPositions();
@Override
public void initStrongholds()
{
method_28509();
generateStrongholdPositions();
}
// this might not be needed anymore
/*
@@ -10,6 +10,7 @@ import net.minecraft.network.packet.s2c.play.ChunkDataS2CPacket;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.source.BiomeArray;
import net.minecraft.world.chunk.WorldChunk;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -31,7 +32,7 @@ public class ClientPlayNetworkHandler_smoothClientAnimationsMixin
shift = At.Shift.AFTER
))
private void recreateMovingPistons(ChunkDataS2CPacket packet, CallbackInfo ci,
int i, int j, WorldChunk worldChunk, Iterator var5, CompoundTag tag, BlockPos blockPos)
int i, int j, BiomeArray biomeArray, WorldChunk worldChunk, Iterator var5, CompoundTag tag, BlockPos blockPos)
{
if (CarpetSettings.smoothClientAnimations)
{
@@ -15,6 +15,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(Entity.class)
public abstract class Entity_portalSuffocationMixin
{
// FIXED IN 20w28a
/*
@Shadow public abstract Box getBoundingBox();
@Inject(method = "changeDimension", at = @At(
@@ -48,4 +50,6 @@ public abstract class Entity_portalSuffocationMixin
CarpetSettings.currentTelepotingEntityBox = null;
CarpetSettings.fixedPosition = null;
}
*/
}
@@ -18,6 +18,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(PortalForcer.class)
public class PortalForcer_portalSuffocationMixin
{
//FIXED IN 20w28a
/*
@Inject(method = "usePortal", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/Entity;getLastNetherPortalDirectionVector()Lnet/minecraft/util/math/Vec3d;"
@@ -84,4 +86,6 @@ public class PortalForcer_portalSuffocationMixin
CarpetSettings.fixedPosition = target.pos;
return target;
}
*/
}
@@ -92,25 +92,25 @@ public abstract class ServerPlayerEntity_scarpetEventMixin extends PlayerEntity
private Vec3d previousLocation;
private RegistryKey<World> previousDimension;
@Inject(method = "changeDimension", at = @At("HEAD"))
@Inject(method = "moveToWorld", at = @At("HEAD"))
private void logPreviousCoordinates(ServerWorld serverWorld, CallbackInfoReturnable<Entity> cir)
{
previousLocation = getPos();
previousDimension = world.getRegistryKey(); //dimension type
}
@Inject(method = "changeDimension", at = @At("RETURN"))
private void atChangeDimension(ServerWorld newWorld, CallbackInfoReturnable<Entity> cir)
@Inject(method = "moveToWorld", at = @At("RETURN"))
private void atChangeDimension(ServerWorld destination, CallbackInfoReturnable<Entity> cir)
{
if (PLAYER_CHANGES_DIMENSION.isNeeded())
{
ServerPlayerEntity player = (ServerPlayerEntity) (Object)this;
Vec3d to = null;
if (!notInAnyWorld || previousDimension != World.END || newWorld.getRegistryKey() != World.OVERWORLD) // end ow
if (!notInAnyWorld || previousDimension != World.END || destination.getRegistryKey() != World.OVERWORLD) // end ow
{
to = getPos();
}
PLAYER_CHANGES_DIMENSION.onDimensionChange(player, previousLocation, to, previousDimension, newWorld.getRegistryKey());
PLAYER_CHANGES_DIMENSION.onDimensionChange(player, previousLocation, to, previousDimension, destination.getRegistryKey());
}
}
@@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ServerWorld.class)
public class ServerWorld_unloadedEntityMixin
{
@Redirect(method = "checkChunk", at = @At(
@Redirect(method = "checkEntityChunkPos", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/Entity;teleportRequested()Z"
))
@@ -135,7 +135,7 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos.x, chunkpos.z, BlockBox.empty(),0,worldIn.getSeed());
if (config == null)
config = new DefaultFeatureConfig();
structurestart1.init(generator, worldIn.getStructureManager() , chunkpos.x, chunkpos.z, biome_1, config);
structurestart1.init(worldIn.method_30349(), generator, worldIn.getStructureManager() , chunkpos.x, chunkpos.z, biome_1, config);
structurestart = structurestart1.hasChildren() ? structurestart1 : StructureStart.DEFAULT;
if (structurestart.hasChildren())