cleanup unused code and mixins

This commit is contained in:
gnembon committed 2020-08-18 01:54:24 -03:00
1 parent 598219608b
commit 3167fe06f3
62 files changed
+56 -916

No files matched your search

@@ -1,24 +0,0 @@
package carpet.mixins;
import carpet.fakes.BiomeInterface;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
import net.minecraft.world.gen.feature.StructureFeature;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import java.util.Map;
@Mixin(Biome.class)
public class Biome_scarpetMixin
{
//@Shadow @Final private Map<StructureFeature<?>, ConfiguredStructureFeature<?, ?>> structureFeatures;
/*
@Override
public ConfiguredStructureFeature<?, ?> getConfiguredFeature(StructureFeature<?> arg)
{
return null;
// return structureFeatures.get(arg);
}*/
}
@@ -1,7 +1,6 @@
package carpet.mixins;
import carpet.utils.RandomTools;
import net.minecraft.entity.mob.BlazeEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -1,38 +0,0 @@
package carpet.mixins;
import carpet.CarpetSettings;
import carpet.fakes.ChunkGeneratorInterface;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.FeatureConfig;
import net.minecraft.world.gen.feature.StructureFeature;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(ChunkGenerator.class)
public abstract class ChunkGeneratorMixin implements ChunkGeneratorInterface
{
@Shadow protected abstract void generateStrongholdPositions();
@Override
public void initStrongholds()
{
generateStrongholdPositions();
}
// this might not be needed anymore
/*
@Inject(method = "hasStructure", at = @At("HEAD"), cancellable = true)
private void skipGenerationBiomeChecks(Biome biome_1, StructureFeature<? extends FeatureConfig> structureFeature_1, CallbackInfoReturnable<Boolean> cir)
{
if (CarpetSettings.skipGenerationChecks)
{
cir.setReturnValue(true);
cir.cancel();
}
}
*/
}
@@ -0,0 +1,18 @@
package carpet.mixins;
import carpet.fakes.ChunkGeneratorInterface;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(ChunkGenerator.class)
public abstract class ChunkGenerator_scarpetMixin implements ChunkGeneratorInterface
{
@Shadow protected abstract void generateStrongholdPositions();
@Override
public void initStrongholds()
{
generateStrongholdPositions();
}
}
@@ -17,13 +17,8 @@ import java.util.Iterator;
@Mixin(ChunkTicketManager.class)
public abstract class ChunkTicketManager_spawnChunksMixin implements ChunkTicketManagerInterface
{
@Shadow protected abstract SortedArraySet<ChunkTicket<?>> getTicketSet(long position);
@Shadow @Final private Long2ObjectOpenHashMap<SortedArraySet<ChunkTicket<?>>> ticketsByPosition;
@Shadow public abstract <T> void removeTicket(ChunkTicketType<T> type, ChunkPos pos, int radius, T argument);
@Shadow protected abstract void removeTicket(long pos, ChunkTicket<?> ticket);
@Shadow public abstract <T> void addTicket(ChunkTicketType<T> type, ChunkPos pos, int radius, T argument);
@@ -10,8 +10,6 @@ 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;
import org.spongepowered.asm.mixin.injection.At;
@@ -2,11 +2,8 @@ package carpet.mixins;
import carpet.CarpetSettings;
import com.google.common.collect.Lists;
//import com.mojang.datafixers.Dynamic;
import com.mojang.serialization.Codec;
import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.Biome;
//import net.minecraft.world.gen.feature.AbstractTempleFeature;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import net.minecraft.world.gen.feature.DesertPyramidFeature;
@@ -15,7 +12,6 @@ import org.spongepowered.asm.mixin.Mixin;
import java.util.Collections;
import java.util.List;
//import java.util.function.Function;
@Mixin(DesertPyramidFeature.class)
public abstract class DesertPyramidFeatureMixin extends StructureFeature<DefaultFeatureConfig>
@@ -2,10 +2,8 @@ package carpet.mixins;
import carpet.CarpetSettings;
import com.google.common.collect.Lists;
//import com.mojang.datafixers.Dynamic;
import com.mojang.serialization.Codec;
import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import net.minecraft.world.gen.feature.EndCityFeature;
@@ -14,7 +12,6 @@ import org.spongepowered.asm.mixin.Mixin;
import java.util.Collections;
import java.util.List;
//import java.util.function.Function;
@Mixin(EndCityFeature.class)
public abstract class EndCityFeatureMixin extends StructureFeature<DefaultFeatureConfig>
@@ -1,55 +0,0 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.entity.Entity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
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(
value = "INVOKE",
target = "Lnet/minecraft/entity/Entity;getLastNetherPortalDirection()Lnet/minecraft/util/math/Direction;"
))
private void registerEntityDimensionChange(ServerWorld serverWorld, CallbackInfoReturnable<Entity> cir)
{
if (CarpetSettings.portalSuffocationFix)
{
CarpetSettings.currentTelepotingEntityBox = getBoundingBox();
CarpetSettings.fixedPosition = null;
}
}
@Redirect(method = "changeDimension", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/Entity;refreshPositionAndAngles(Lnet/minecraft/util/math/BlockPos;FF)V"
))
private void alternativeSetPositionAndAngles(Entity entity, BlockPos blockPos_1, float float_1, float float_2)
{
if (CarpetSettings.portalSuffocationFix && CarpetSettings.fixedPosition != null)
entity.refreshPositionAndAngles(CarpetSettings.fixedPosition.x, CarpetSettings.fixedPosition.y, CarpetSettings.fixedPosition.z, float_1, float_2);
else
entity.refreshPositionAndAngles(blockPos_1, float_1, float_2);
}
@Inject(method = "changeDimension", at = @At("RETURN"))
private void removeEntity(ServerWorld serverWorld, CallbackInfoReturnable<Entity> cir)
{
CarpetSettings.currentTelepotingEntityBox = null;
CarpetSettings.fixedPosition = null;
}
*/
}
@@ -1,15 +0,0 @@
package carpet.mixins;
import carpet.utils.RandomTools;
import net.minecraft.entity.projectile.ExplosiveProjectileEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import java.util.Random;
@Mixin(ExplosiveProjectileEntity.class)
public class ExplosiveProjectileEntity_extremeMixin
{
//intentonally left blank until becomes master
}
@@ -1,19 +1,14 @@
package carpet.mixins;
import carpet.CarpetSettings;
//import net.minecraft.block.Blocks;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.util.math.BlockPos;
//import net.minecraft.world.WorldAccess;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.ChunkGenerator;
//import net.minecraft.world.gen.chunk.ChunkGeneratorConfig;
import net.minecraft.world.gen.chunk.FlatChunkGenerator;
//import net.minecraft.world.gen.chunk.FlatChunkGeneratorConfig;
//import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.chunk.StructuresConfig;
import net.minecraft.world.gen.feature.StructureFeature;
import org.spongepowered.asm.mixin.Mixin;
@@ -1,37 +0,0 @@
package carpet.mixins;
//import carpet.CarpetSettings;
//import net.minecraft.class_5284;
//import net.minecraft.entity.SpawnGroup;
//import net.minecraft.util.math.BlockPos;
//import net.minecraft.world.biome.Biome;
//import net.minecraft.world.biome.source.BiomeSource;
//import net.minecraft.world.gen.StructureAccessor;
//import net.minecraft.world.gen.chunk.FloatingIslandsChunkGenerator;
//import net.minecraft.world.gen.chunk.SurfaceChunkGenerator;
//import net.minecraft.world.gen.feature.Feature;
//import org.spongepowered.asm.mixin.Mixin;
//
//import java.util.List;
//@Mixin(FloatingIslandsChunkGenerator.class)
public abstract class FloatingIslandsChunkGeneratorMixin //extends SurfaceChunkGenerator<class_5284> //FloatingIslandsChunkGeneratorConfig
{
/*public FloatingIslandsChunkGeneratorMixin(BiomeSource biomeSource, long l, class_5284 arg, int i, int j, int k, boolean bl)
{
super(biomeSource, l, arg, i, j, k, bl);
}
@Override
public List<Biome.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor structureAccessor, SpawnGroup category, BlockPos pos)
{
if (CarpetSettings.shulkerSpawningInEndCities && SpawnGroup.MONSTER == category)
{
if (Feature.END_CITY.isInsideStructure(structureAccessor, pos))
{
return Feature.END_CITY.getMonsterSpawns();
}
}
return super.getEntitySpawnList(biome, structureAccessor, category, pos);
}*/
}
@@ -10,7 +10,6 @@ import net.minecraft.entity.mob.GuardianEntity;
import net.minecraft.entity.mob.HostileEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
@@ -1,21 +0,0 @@
package carpet.mixins;
import carpet.CarpetServer;
import net.minecraft.server.integrated.IntegratedServer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(IntegratedServer.class)
public class IntegratedServerMixin
{
/*@Inject(method = "setupServer", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/integrated/IntegratedServer;loadWorld()V",
shift = At.Shift.BEFORE
))
private void onSetupServerIntegrated(CallbackInfoReturnable<Boolean> cir) {
CarpetServer.onServerLoaded((IntegratedServer) (Object) this);
}*/
}
@@ -53,7 +53,7 @@ public abstract class ItemEntityMixin extends Entity implements ItemEntityInterf
}
@Redirect(
method = "canMerge",
method = "canMerge()Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/ItemStack;getMaxCount()I"
@@ -1,6 +1,5 @@
package carpet.mixins;
import carpet.CarpetSettings;
import carpet.fakes.EntityInterface;
import carpet.fakes.LivingEntityInterface;
import carpet.script.EntityEventsGroup;
@@ -18,7 +17,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import static carpet.script.CarpetEventServer.Event.PLAYER_DEALS_DAMAGE;
import static carpet.script.CarpetEventServer.Event.PLAYER_TAKES_DAMAGE;
@Mixin(LivingEntity.class)
public abstract class LivingEntity_scarpetEventsMixin extends Entity implements LivingEntityInterface
@@ -1,15 +0,0 @@
package carpet.mixins;
import carpet.utils.RandomTools;
import net.minecraft.entity.projectile.LlamaSpitEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import java.util.Random;
@Mixin(LlamaSpitEntity.class)
public class LlamaSpitEntity_extremeMixin
{
// left intentinally blank for 1.15.2 class compat to be cleaned when promoting branch to master
}
@@ -1,6 +1,5 @@
package carpet.mixins;
import carpet.CarpetServer;
import carpet.network.CarpetClient;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
@@ -12,15 +11,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MinecraftClient.class)
public class MinecraftClientMixin
{
//to inject right before
// this.tickWorlds(booleanSupplier_1);
//@Inject(method = "run", at = @At(value = "HEAD")
//)
//private void onInit(CallbackInfo ci) {
// //CM start game hook
// CarpetServer.onGameStarted();
//}
@Inject(method = "disconnect(Lnet/minecraft/client/gui/screen/Screen;)V", at = @At("HEAD"))
private void onCloseGame(Screen screen, CallbackInfo ci)
{
@@ -1,25 +0,0 @@
package carpet.mixins;
import carpet.CarpetServer;
import net.minecraft.server.dedicated.MinecraftDedicatedServer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(MinecraftDedicatedServer.class)
public class MinecraftDedicatedServerMixin
{
//to inject right before
// this.tickWorlds(booleanSupplier_1);
//@Inject(method = "setupServer", at = @At(
// value = "INVOKE",
// target = "Lnet/minecraft/server/dedicated/MinecraftDedicatedServer;loadWorld()V",
// shift = At.Shift.BEFORE
//))
//private void onSetupServer(CallbackInfoReturnable<Boolean> cir) {
// //CM start game hook
// CarpetServer.onGameStarted();
//
//}
}
@@ -1,6 +1,5 @@
package carpet.mixins;
import carpet.CarpetServer;
import carpet.fakes.MinecraftServerInterface;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ServerTask;
@@ -21,9 +21,9 @@ import java.util.List;
@Mixin(NoiseChunkGenerator.class)
// todo rename mixin after 1.15 is gone
public abstract class SurfaceChunkGenerator_husksSpawnMixin extends ChunkGenerator
public abstract class NoiseChunkGenerator_husksSpawnMixin extends ChunkGenerator
{
public SurfaceChunkGenerator_husksSpawnMixin(BiomeSource biomeSource, StructuresConfig structuresConfig)
public NoiseChunkGenerator_husksSpawnMixin(BiomeSource biomeSource, StructuresConfig structuresConfig)
{
super(biomeSource, structuresConfig);
}
@@ -1,42 +0,0 @@
package carpet.mixins;
//import carpet.CarpetSettings;
//import net.minecraft.entity.SpawnGroup;
//import net.minecraft.util.math.BlockPos;
//import net.minecraft.world.WorldAccess;
//import net.minecraft.world.biome.Biome;
//import net.minecraft.world.biome.source.BiomeSource;
//import net.minecraft.world.gen.StructureAccessor;
//import net.minecraft.world.gen.chunk.OverworldChunkGenerator;
//import net.minecraft.world.gen.chunk.OverworldChunkGeneratorConfig;
//import net.minecraft.world.gen.chunk.SurfaceChunkGenerator;
//import net.minecraft.world.gen.feature.Feature;
//import org.spongepowered.asm.mixin.Mixin;
//import org.spongepowered.asm.mixin.injection.At;
//import org.spongepowered.asm.mixin.injection.Inject;
//import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.List;
//@Mixin(OverworldChunkGenerator.class)
public abstract class OverworldChunkGeneratorMixin //extends SurfaceChunkGenerator<OverworldChunkGeneratorConfig>
{
/*public OverworldChunkGeneratorMixin(BiomeSource biomeSource, long seed, OverworldChunkGeneratorConfig arg, int i, int j, int k, boolean bl)
{
super(biomeSource, seed, arg, i, j, k, bl);
}
@Inject(method = "getEntitySpawnList", at = @At(value = "INVOKE", ordinal = 1, shift = At.Shift.BEFORE,
target = "Lnet/minecraft/world/gen/feature/StructureFeature;isApproximatelyInsideStructure(Lnet/minecraft/world/gen/StructureAccessor;Lnet/minecraft/util/math/BlockPos;)Z"),
cancellable = true)
private void onGetEntitySpawnList(Biome biome, StructureAccessor structureAccessor, SpawnGroup spawnGroup, BlockPos blockPos, CallbackInfoReturnable<List<Biome.SpawnEntry>> cir)
{
if (CarpetSettings.huskSpawningInTemples)
{
if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(structureAccessor, blockPos))
{
cir.setReturnValue(Feature.DESERT_PYRAMID.getMonsterSpawns());
}
}
}*/
}
@@ -17,10 +17,6 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(PlayerEntity.class)
public abstract class PlayerEntity_creativeNoClipMixin extends LivingEntity
{
@Shadow public abstract boolean isCreative();
@Shadow @Final public PlayerAbilities abilities;
protected PlayerEntity_creativeNoClipMixin(EntityType<? extends LivingEntity> type, World world)
{
super(type, world);
@@ -1,6 +1,5 @@
package carpet.mixins;
import carpet.CarpetSettings;
import carpet.fakes.EntityInterface;
import carpet.script.EntityEventsGroup;
import net.minecraft.entity.EntityType;
@@ -1,91 +0,0 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.block.pattern.BlockPattern;
import net.minecraft.entity.Entity;
import net.minecraft.server.network.ServerPlayNetworkHandler;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.PortalForcer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
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;"
))
private void registerEntityDimensionChange(Entity entity, float f, CallbackInfoReturnable<Boolean> cir)
{
if (CarpetSettings.portalSuffocationFix)
{
CarpetSettings.currentTelepotingEntityBox = entity.getBoundingBox();
CarpetSettings.fixedPosition = null;
}
}
@Redirect(method = "usePortal", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/Entity;refreshPositionAfterTeleport(DDD)V"
))
private void alternativeSetPositionAndAngles(Entity entity, double d, double e, double f)
{
if (CarpetSettings.portalSuffocationFix && CarpetSettings.fixedPosition != null)
entity.refreshPositionAfterTeleport(CarpetSettings.fixedPosition.x, CarpetSettings.fixedPosition.y, CarpetSettings.fixedPosition.z);
else
entity.refreshPositionAfterTeleport(d, e, f);
}
@Inject(method = "usePortal", at = @At("RETURN"))
private void removeEntity(Entity entity_1, float float_1, CallbackInfoReturnable<Boolean> cir)
{
CarpetSettings.currentTelepotingEntityBox = null;
CarpetSettings.fixedPosition = null;
}
@SuppressWarnings("UnresolvedMixinReference")
@Redirect(method = "method_22391",at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/pattern/BlockPattern$Result;getTeleportTarget(Lnet/minecraft/util/math/Direction;Lnet/minecraft/util/math/BlockPos;DLnet/minecraft/util/math/Vec3d;D)Lnet/minecraft/block/pattern/BlockPattern$TeleportTarget;"
))
private BlockPattern.TeleportTarget newResult(BlockPattern.Result portal, Direction direction_1, BlockPos blockPos_1, double height_position_from_top, Vec3d vec3d_1, double width_position)
{
if (CarpetSettings.portalSuffocationFix && CarpetSettings.currentTelepotingEntityBox != null)
{
double entityWidth = CarpetSettings.currentTelepotingEntityBox.getXLength();
double entityHeight = CarpetSettings.currentTelepotingEntityBox.getYLength();
if (entityWidth >= portal.getWidth())
{
width_position = 0.5; // will suffocate anyways, placing in the middle
}
else
{
width_position = MathHelper.clamp(width_position, entityWidth/(2*portal.getWidth()), 1.0-entityWidth/(2*portal.getWidth()));
}
if (entityHeight >= portal.getHeight())
{
height_position_from_top = 1.0;
}
else
{
height_position_from_top = MathHelper.clamp(height_position_from_top, entityHeight/portal.getHeight(),1.0);
}
}
BlockPattern.TeleportTarget target = portal.getTeleportTarget(direction_1, blockPos_1, height_position_from_top, vec3d_1, width_position);
CarpetSettings.fixedPosition = target.pos;
return target;
}
*/
}
@@ -22,57 +22,6 @@ public abstract class ServerChunkManager_tickMixin
CarpetProfiler.ProfilerToken currentSection;
/* Replaced with ThreadedAnvilCHunkStorage_Mixin path and separately isolated spawning and random ticks here
ticket manager is not worth its own section at this point - will fall into rest, until its fixed.
@Inject(method = "tick(Ljava/util/function/BooleanSupplier;)V", at = @At(
value = "CONSTANT",
args = "stringValue=purge"
))
private void startTicketSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
{
currentSection = CarpetProfiler.start_section(world, "Ticket Manager", CarpetProfiler.TYPE.GENERAL);
}
@Inject(method = "tick(Ljava/util/function/BooleanSupplier;)V", at = @At(
value = "CONSTANT",
args = "stringValue=chunks"
))
private void stopTicketStartSpawningSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
{
if (currentSection != null)
{
CarpetProfiler.end_current_section(currentSection);
currentSection = CarpetProfiler.start_section(world, "Spawning and Random Ticks", CarpetProfiler.TYPE.GENERAL);
}
}
@Inject(method = "tick(Ljava/util/function/BooleanSupplier;)V", at = @At(
value = "CONSTANT",
args = "stringValue=unload"
))
private void stopSpawningStartUnloadSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
{
if (currentSection != null)
{
CarpetProfiler.end_current_section(currentSection);
currentSection = CarpetProfiler.start_section(world, "Unloading", CarpetProfiler.TYPE.GENERAL);
}
}
@Inject(method = "tick(Ljava/util/function/BooleanSupplier;)V", at = @At("TAIL"))
private void stopUnloadSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
{
if (currentSection != null)
{
CarpetProfiler.end_current_section(currentSection);
}
}
*/
@Inject(method = "tickChunks", at = @At("HEAD"))
private void startSpawningSection(CallbackInfo ci)
{
@@ -91,9 +40,7 @@ public abstract class ServerChunkManager_tickMixin
//// Tick freeze
@Redirect(method = "tickChunks", at = @At(
value = "INVOKE",
//target = "Lnet/minecraft/world/level/LevelProperties;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;"
//target = "Lnet/minecraft/class_5217;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;"
target = "Lnet/minecraft/server/world/ServerWorld;isDebugWorld()Z" // idDebug
target = "Lnet/minecraft/server/world/ServerWorld;isDebugWorld()Z"
))
private boolean skipChunkTicking(ServerWorld serverWorld)
{
@@ -16,10 +16,6 @@ import org.spongepowered.asm.mixin.Shadow;
@Mixin(ServerLightingProvider.class)
public abstract class ServerLightingProvider_scarpetMixin extends LightingProvider implements ServerLightingProviderInterface
{
@Shadow protected abstract void updateChunkStatus(ChunkPos pos);
@Shadow public abstract void checkBlock(BlockPos pos);
public ServerLightingProvider_scarpetMixin(ChunkProvider chunkProvider, boolean hasBlockLight, boolean hasSkyLight)
@@ -47,16 +47,10 @@ public class ServerPlayNetworkHandler_tickMixin
// corrective tick
if (movedBy < 0.0009 && lastMoved > 0.0009 && Math.abs(player.getServer().getTicks()-lastMovedTick-20)<2)
{
//CarpetSettings.LOG.error("Corrective movement packet");
return;
}
if (movedBy > 0.0D)
{
//CarpetSettings.LOG.error(String.format(
// "moved by %.6f at %d",
// player.getPos().squaredDistanceTo(lastTickX, lastTickY, lastTickZ),
// player.getServer().getTicks()-lastMovedTick
//));
lastMoved = movedBy;
lastMovedTick = player.getServer().getTicks();
TickSpeed.reset_player_active_timeout();
@@ -31,7 +31,6 @@ public abstract class ServerWorld_tickMixin extends World
}
@Shadow protected abstract void processSyncedBlockEvents();
//@Shadow protected abstract void sendBlockActions();
@Shadow protected abstract void tickTime();
@@ -168,15 +167,6 @@ public abstract class ServerWorld_tickMixin extends World
if (TickSpeed.process_entities) raidManager.tick();
}
/*@Redirect(method = "tick", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/WanderingTraderManager;tick()V"
))
private void tickConditionally(WanderingTraderManager wanderingTraderManager)
{
if (TickSpeed.process_entities) wanderingTraderManager.tick();
}*/
@Redirect(method = "tick", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/world/ServerWorld;processSyncedBlockEvents()V" // aka sendBlockActions
@@ -1,17 +0,0 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ShearsItem;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(ShearsItem.class)
public class ShearsItem_missingToolsMixin
{
// left intentionally blank until this becomes in master branch
}
@@ -14,8 +14,6 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
// temporary mixin until naming for spawnhelper gets fixed.
@Mixin(SpawnHelper.Info.class)
public class SpawnHelperInnerMixin implements SpawnHelperInnerInterface
{
@@ -151,7 +151,7 @@ public class SpawnHelperMixin
@Redirect(method = "spawnEntitiesInChunk(Lnet/minecraft/entity/SpawnGroup;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/Chunk;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/SpawnHelper$Checker;Lnet/minecraft/world/SpawnHelper$Runner;)V", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/world/ServerWorld;spawnEntityAndPassengers(Lnet/minecraft/entity/Entity;)V"//"Lnet/minecraft/server/world/ServerWorld;spawnEntity(Lnet/minecraft/entity/Entity;)Z"
target = "Lnet/minecraft/server/world/ServerWorld;spawnEntityAndPassengers(Lnet/minecraft/entity/Entity;)V"
))
private static void spawnEntity(ServerWorld world, Entity entity_1)
{
@@ -24,29 +24,12 @@ import java.util.Random;
@Mixin(StructureFeature.class)
public abstract class StructureFeatureMixin<C extends FeatureConfig> implements StructureFeatureInterface<C>
{
//problem is that is seems that now chunks deal with its portion of the strucuture
//on its own.
//@Shadow public abstract int getRadius();
@Shadow public abstract String getName();
@Shadow public abstract StructureFeature.StructureStartFactory getStructureStartFactory();
@Shadow protected abstract boolean shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, ChunkRandom chunkRandom, int i, int j, Biome biome, ChunkPos chunkPos, C featureConfig);
@Override
public boolean plopAnywhere(ServerWorld world, BlockPos pos)
{
return plopAnywhere(world, pos, world.getChunkManager().getChunkGenerator(), false, null, null);
}
@Override
public boolean gridAnywhere(ServerWorld world, BlockPos pos)
{
return plopAnywhere(world, pos, world.getChunkManager().getChunkGenerator(), true, null, null);
}
@Override
public boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly, Biome biome, FeatureConfig config)
{
@@ -64,21 +47,12 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
{
return false;
}
//generator.ge getStructurePositionToReferenceMap(this).computeIfAbsent(chId,
// (x) -> new LongOpenHashSet()).add(chId);
world.getChunk(j, k).addStructureReference((StructureFeature) (Object)this, chId); //, ChunkStatus.STRUCTURE_STARTS
world.getChunk(j, k).addStructureReference((StructureFeature) (Object)this, chId);
BlockBox box = structurestart.getBoundingBox();
if (!wireOnly)
{
structurestart.generateStructure(world, world.getStructureAccessor(), generator, rand,box,
/*new BlockBox(
pos.getX() - this.getRadius() * 16,
pos.getZ() - this.getRadius() * 16,
pos.getX() + (this.getRadius() + 1) * 16,
pos.getZ() + (1 + this.getRadius()) * 16),*/
new ChunkPos(j, k)
);
structurestart.generateStructure(world, world.getStructureAccessor(), generator, rand,box, new ChunkPos(j, k));
}
//structurestart.notifyPostProcessAt(new ChunkPos(j, k));
int i = Math.max(box.getBlockCountX(),box.getBlockCountZ())/16+1; //size
@@ -92,9 +66,7 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
long nbchkid = ChunkPos.toLong(k1, l1);
if (box.intersectsXZ(k1<<4, l1<<4, (k1<<4) + 15, (l1<<4) + 15))
{
//generator.getStructurePositionToReferenceMap(this).computeIfAbsent(nbchkid, (__) -> new LongOpenHashSet()).add(chId);
world.getChunk(k1, l1).addStructureReference((StructureFeature) (Object)this, chId); //, ChunkStatus.STRUCTURE_STARTS
//structurestart. notifyPostProcessAt(new ChunkPos(k1, l1));
world.getChunk(k1, l1).addStructureReference((StructureFeature) (Object)this, chId);
}
}
}
@@ -1,15 +0,0 @@
package carpet.mixins;
import carpet.utils.RandomTools;
import net.minecraft.entity.projectile.thrown.ThrownEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import java.util.Random;
@Mixin(ThrownEntity.class)
public class ThrownEntity_extremeMixin
{
// intentinally left blank to promote when in master
}
@@ -41,16 +41,10 @@ import java.util.stream.Collectors;
@Mixin(VillagerEntity.class)
public abstract class VillagerEntity_aiMixin extends AbstractTraderEntity
{
//@Shadow protected abstract boolean hasSeenGolemRecently(long long_1);
@Shadow protected abstract void sayNo();
@Shadow protected abstract int getAvailableFood();
//@Shadow protected abstract void depleteFood(int int_1);
//@Shadow protected abstract boolean lacksFood();
@Shadow public abstract void eatForBreeding();
int totalFood;
@@ -13,12 +13,12 @@ public class WorldRenderer_fogOffMixin
{
@Redirect(method = "render", require = 0, expect = 0, at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/render/SkyProperties;useThickFog(II)Z" //method_28110 isFogThick
target = "Lnet/minecraft/client/render/SkyProperties;useThickFog(II)Z"
))
private boolean isReallyThick(SkyProperties skyProperties, int x, int z)
{
if (CarpetSettings.fogOff) return false;
return skyProperties.useThickFog(x, z); //isFogThick
return skyProperties.useThickFog(x, z);
}
}
@@ -25,9 +25,6 @@ public abstract class World_movableTEMixin implements WorldInterface, WorldAcces
@Shadow
@Final
public boolean isClient;
@Shadow
@Final
protected MutableWorldProperties properties; //LevelProperties
@Shadow
public abstract WorldChunk getWorldChunk(BlockPos blockPos_1);