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
+55 -915

No files matched your search

@@ -15,6 +15,7 @@ chunk_tickets
crafting_remaining_item
create_marker
current_dimension
custom_dimension
day_time
destroy
diamond
@@ -55,7 +55,7 @@
set without_updates
blocks_movement block_sound material map_colour property block_properties block_data poi set_poi
place_item set_biome biome loaded_status generation_status inhabited_time spawn_potential chunk_tickets
structure_eligibility structures structure_references set_structure reset_chunk reload_chunk
structure_eligibility structures structure_references set_structure reset_chunk reload_chunk custom_dimension
add_chunk_ticket
scoreboard scoreboard_add scoreboard_remove scoreboard_display
@@ -1,73 +0,0 @@
package carpet.commands;
import carpet.CarpetSettings;
import carpet.settings.SettingsManager;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket;
import net.minecraft.network.packet.s2c.play.RemoveEntityStatusEffectS2CPacket;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.command.argument.EntityArgumentType;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.world.GameMode;
import static net.minecraft.server.command.CommandManager.argument;
import static net.minecraft.server.command.CommandManager.literal;
public class CameraModeCommand
{/*
public static void register(CommandDispatcher<ServerCommandSource> dispatcher)
{
LiteralArgumentBuilder<ServerCommandSource> camera = literal("c").
requires((player) -> SettingsManager.canUseCommand(player, CarpetSettings.commandCameramode)).
executes((c) -> cameraMode(c.getSource(), c.getSource().getPlayer())).
then(argument("player", EntityArgumentType.player()).
executes( (c) -> cameraMode(c.getSource(), EntityArgumentType.getPlayer(c, "player"))));
LiteralArgumentBuilder<ServerCommandSource> survival = literal("s").
requires((player) -> SettingsManager.canUseCommand(player, CarpetSettings.commandCameramode)).
executes((c) -> survivalMode(
c.getSource(),
c.getSource().getPlayer())).
then(argument("player", EntityArgumentType.player()).
executes( (c) -> survivalMode(c.getSource(), EntityArgumentType.getPlayer(c, "player"))));
dispatcher.register(camera);
dispatcher.register(survival);
}
private static boolean iCanHasPermissions(ServerCommandSource source, ServerPlayerEntity player)
{
try
{
return source.hasPermissionLevel(2) || source.getPlayer() == player;
}
catch (CommandSyntaxException e)
{
return true; // shoudn't happen because server has all permissions anyways
}
}
private static int cameraMode(ServerCommandSource source, ServerPlayerEntity player)
{
if (!(iCanHasPermissions(source, player))) return 0;
player.setGameMode(GameMode.SPECTATOR);
player.addVelocity(0,0.1,0);
player.networkHandler.sendPacket(new EntityVelocityUpdateS2CPacket(player));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.NIGHT_VISION, 999999, 0, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.CONDUIT_POWER, 999999, 0, false, false));
return 1;
}
private static int survivalMode(ServerCommandSource source, ServerPlayerEntity player)
{
if (!(iCanHasPermissions(source, player))) return 0;
player.setGameMode(GameMode.SURVIVAL);
player.networkHandler.sendPacket(new RemoveEntityStatusEffectS2CPacket(player.getEntityId(), StatusEffects.NIGHT_VISION));
player.removeStatusEffect(StatusEffects.NIGHT_VISION);
player.networkHandler.sendPacket(new RemoveEntityStatusEffectS2CPacket(player.getEntityId(), StatusEffects.CONDUIT_POWER));
player.removeStatusEffect(StatusEffects.CONDUIT_POWER);
return 1;
}
*/
}
@@ -15,7 +15,6 @@ import net.minecraft.command.argument.BlockPosArgumentType;
import net.minecraft.command.argument.EntitySummonArgumentType;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import static net.minecraft.server.command.CommandManager.argument;
import static net.minecraft.server.command.CommandManager.literal;
@@ -29,7 +29,6 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.GameMode;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import java.util.Arrays;
import java.util.Collection;
@@ -1,8 +1,14 @@
package carpet.commands;
import carpet.CarpetServer;
import carpet.script.*;
import carpet.CarpetSettings;
import carpet.script.CarpetEventServer;
import carpet.script.CarpetExpression;
import carpet.script.CarpetScriptHost;
import carpet.script.Expression;
import carpet.script.LazyValue;
import carpet.script.ScriptHost;
import carpet.script.Tokenizer;
import carpet.script.exception.CarpetExpressionException;
import carpet.script.value.FunctionValue;
import carpet.settings.SettingsManager;
@@ -27,7 +33,13 @@ import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockBox;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate;
import java.util.function.Supplier;
@@ -55,13 +67,14 @@ public class ScriptCommand
if (quoteCount % 2 == 1)
return Collections.emptyList();
int maxLen = prefix.length()<3 ? (prefix.length()*2+1) : 1234;
String eventPrefix = prefix.startsWith("__on_")?prefix.substring(5):null;
List<String> scarpetMatches = scarpetFunctions.stream().
filter(s -> s.startsWith(prefix) && s.length() <= maxLen).map(s -> s+"(").collect(Collectors.toList());
scarpetMatches.addAll(APIFunctions.stream().
filter(s -> s.startsWith(prefix) && s.length() <= maxLen).map(s -> s+"(").collect(Collectors.toList()));
// not that useful in commandline, more so in external scripts, so skipping here
//scarpetMatches.addAll(CarpetServer.scriptServer.events.eventHandlers.keySet().stream().
// filter(s -> s.startsWith(prefix) && s.length() <= maxLen).map(s -> "__"+s+"(").collect(Collectors.toList()));
if (eventPrefix != null) scarpetMatches.addAll(CarpetEventServer.Event.byName.keySet().stream().
filter(s -> s.startsWith(eventPrefix)).map(s -> "__on_"+s+"(").collect(Collectors.toList()));
scarpetMatches.addAll(host.globaFunctionNames(host.main, s -> s.startsWith(prefix)).map(s -> s+"(").collect(Collectors.toList()));
scarpetMatches.addAll(host.globaVariableNames(host.main, s -> s.startsWith(prefix)).collect(Collectors.toList()));
return scarpetMatches;
@@ -14,15 +14,11 @@ import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import net.minecraft.command.argument.BlockPosArgumentType;
import net.minecraft.command.argument.DimensionArgumentType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.DyeColor;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import java.util.Arrays;
import java.util.stream.Collectors;
@@ -8,7 +8,6 @@ import carpet.utils.Messenger;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.BaseText;
import net.minecraft.server.command.ServerCommandSource;
@@ -90,10 +89,7 @@ public class TickCommand
{
}
BaseText message = TickSpeed.tickrate_advance(player, advance, tail_command, source);
if (message != null)
{
source.sendFeedback(message, false);
}
return 1;
}
@@ -1,9 +0,0 @@
package carpet.fakes;
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
import net.minecraft.world.gen.feature.StructureFeature;
public interface BiomeInterface
{
ConfiguredStructureFeature<?, ?> getConfiguredFeature(StructureFeature<?> arg);
}
@@ -1,12 +0,0 @@
package carpet.fakes;
//import net.minecraft.block.BlockRenderLayer;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.render.BufferBuilder;
public interface BlockEntityRenderDispatcherInterface
{
/*void renderBlockEntityOffset(BlockEntity blockEntity_1, float partialTicks, int destroyStage, BlockRenderLayer blockRenderLayer_1, BufferBuilder bufferBuilder_1,
double xOffset, double yOffset, double zOffset);
*/
}
@@ -1,50 +0,0 @@
package carpet.fakes;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentTarget;
import net.minecraft.entity.EquipmentSlot;
public abstract class DummyEnchantments
{
public static class Dummies extends Enchantment
{
protected Dummies()
{
super(Rarity.COMMON, EnchantmentTarget.BREAKABLE, new EquipmentSlot[]{EquipmentSlot.MAINHAND});
}
}
public static class Dummy1 extends Dummies {}
public static class Dummy2 extends Dummies {}
public static class Dummy3 extends Dummies {}
public static class Dummy4 extends Dummies {}
public static class Dummy5 extends Dummies {}
public static class Dummy6 extends Dummies {}
public static class Dummy7 extends Dummies {}
public static class Dummy8 extends Dummies {}
public static class Dummy9 extends Dummies {}
public static class Dummy10 extends Dummies {}
public static class Dummy11 extends Dummies {}
public static class Dummy12 extends Dummies {}
public static class Dummy13 extends Dummies {}
public static class Dummy14 extends Dummies {}
public static class Dummy15 extends Dummies {}
public static class Dummy16 extends Dummies {}
public static class Dummy17 extends Dummies {}
public static class Dummy18 extends Dummies {}
public static class Dummy19 extends Dummies {}
public static class Dummy20 extends Dummies {}
public static class Dummy21 extends Dummies {}
public static class Dummy22 extends Dummies {}
public static class Dummy23 extends Dummies {}
public static class Dummy24 extends Dummies {}
public static class Dummy25 extends Dummies {}
public static class Dummy26 extends Dummies {}
public static class Dummy27 extends Dummies {}
public static class Dummy28 extends Dummies {}
public static class Dummy29 extends Dummies {}
public static class Dummy30 extends Dummies {}
public static class Dummy31 extends Dummies {}
public static class Dummy32 extends Dummies {}
}
@@ -11,8 +11,6 @@ import net.minecraft.world.gen.feature.FeatureConfig;
public interface StructureFeatureInterface<C>
{
boolean plopAnywhere(ServerWorld world, BlockPos pos);
boolean gridAnywhere(ServerWorld world, BlockPos pos);
boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly,Biome biome, FeatureConfig config);
boolean shouldStartPublicAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, ChunkRandom chunkRandom, int i, int j, Biome biome, ChunkPos chunkPos, C featureConfig);
}
@@ -1,7 +1,6 @@
package carpet.fakes;
public interface TntEntityInterface {
public interface TntEntityInterface
{
int getMergedTNT();
}
@@ -293,7 +293,7 @@ public class BlockRotator
}
else if ((block instanceof ObserverBlock) || (block instanceof EndRodBlock))
{
newState = state.with(FacingBlock.FACING, (Direction) state.get(FacingBlock.FACING).getOpposite());
newState = state.with(FacingBlock.FACING, state.get(FacingBlock.FACING).getOpposite());
}
else if (block instanceof DispenserBlock)
{
@@ -313,7 +313,7 @@ public class BlockRotator
}
else if (block instanceof HopperBlock)
{
if ((Direction)state.get(HopperBlock.FACING) != Direction.DOWN)
if (state.get(HopperBlock.FACING) != Direction.DOWN)
{
newState = state.with(HopperBlock.FACING, state.get(HopperBlock.FACING).rotateYClockwise());
}
@@ -82,9 +82,6 @@ public class FeatureGenerator
StructureFeature<?> structureFeature = Registry.STRUCTURE_FEATURE.get(id);
if (structureFeature == null) return null;
return getDefaultFeature(structureFeature, world, pos, true);
// optionally fish out
}
synchronized public static Boolean plopGrid(ConfiguredStructureFeature<?, ?> structureFeature, ServerWorld world, BlockPos pos)
@@ -124,10 +121,6 @@ public class FeatureGenerator
{
return setupCustomStructure(structure, conf, biome, false);
}
private static Thing gridCustomStructure(StructureFeature structure, FeatureConfig conf, RegistryKey<Biome> biome)
{
return setupCustomStructure(structure, conf, biome, true);
}
private static Thing setupCustomStructure(StructureFeature structure, FeatureConfig conf, RegistryKey<Biome> biome, boolean wireOnly)
{
return (w, p) -> ((StructureFeatureInterface)structure).plopAnywhere(w, p, w.getChunkManager().getChunkGenerator(), wireOnly, w.getRegistryManager().get(Registry.BIOME_KEY).get(biome), conf);
@@ -149,7 +142,6 @@ public class FeatureGenerator
findFirst().map(Map.Entry::getValue).orElse(null);
}
public static <T extends FeatureConfig> StructureStart shouldStructureStartAt(ServerWorld world, BlockPos pos, StructureFeature<T> structure, boolean computeBox)
{
long seed = world.getSeed();
@@ -11,7 +11,6 @@ import net.minecraft.text.BaseText;
import net.minecraft.text.TranslatableText;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import java.util.ArrayList;
import java.util.Collections;
@@ -53,7 +53,6 @@ public class OptimizedExplosion
private static List<Entity> entitylist;
private static Vec3d vec3dmem;
private static long tickmem;
private static Vec3d vec3dZero = new Vec3d(0, 0, 0);
// For disabling the explosion particles and sound
public static int explosionSound = 0;
@@ -224,28 +223,6 @@ public class OptimizedExplosion
BlockState state = world.getBlockState(blockpos);
Block block = state.getBlock();
/*if (spawnParticles)
{
double d0 = (double)((float)blockpos.getX() + world.random.nextFloat());
double d1 = (double)((float)blockpos.getY() + world.random.nextFloat());
double d2 = (double)((float)blockpos.getZ() + world.random.nextFloat());
double d3 = d0 - posX;
double d4 = d1 - posY;
double d5 = d2 - posZ;
double d6 = (double)MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
d3 = d3 / d6;
d4 = d4 / d6;
d5 = d5 / d6;
double d7 = 0.5D / (d6 / (double) eAccess.getPower() + 0.1D);
d7 = d7 * (double)(world.random.nextFloat() * world.random.nextFloat() + 0.3F);
d3 = d3 * d7;
d4 = d4 * d7;
d5 = d5 * d7;
world.addParticle(ParticleTypes.POOF,
(d0 + posX) / 2.0D, (d1 + posY) / 2.0D, (d2 + posZ) / 2.0D, d3, d4, d5);
world.addParticle(ParticleTypes.SMOKE, d0, d1, d2, d3, d4, d5);
}*/
if (state.getMaterial() != Material.AIR)
{
if (block.shouldDropItemsOnExplosion(e) && world instanceof ServerWorld)
@@ -35,11 +35,6 @@ public class ParticleDisplay
return particleCache.get(name);
}
public static void drawParticleLine(ServerPlayerEntity player, Vec3d from, Vec3d to,String main)
{
drawParticleLine(player, from, to, main, null, 1, 0.0);
}
public static void drawParticleLine(ServerPlayerEntity player, Vec3d from, Vec3d to, String main, String accent, int count, double spread)
{
ParticleEffect accentParticle = getEffect(accent);
@@ -1,9 +1,7 @@
package carpet.logging;
import carpet.CarpetServer;
import carpet.helpers.HopperCounter;
import carpet.helpers.TickSpeed;
import carpet.logging.LoggerRegistry;
import carpet.logging.logHelpers.PacketCounter;
import carpet.mixins.PlayerListHeaderS2CPacketMixin;
import carpet.utils.Messenger;
@@ -17,7 +15,6 @@ import net.minecraft.text.BaseText;
import net.minecraft.text.LiteralText;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import java.util.ArrayList;
import java.util.Arrays;
@@ -22,13 +22,10 @@ public class LoggerRegistry
public static boolean __tnt;
public static boolean __projectiles;
public static boolean __fallingBlocks;
public static boolean __kills;
public static boolean __tps;
public static boolean __counter;
public static boolean __mobcaps;
public static boolean __damage;
public static boolean __packets;
public static boolean __weather;
public static boolean __pathfinding;
public static boolean __explosions;
@@ -44,11 +41,7 @@ public class LoggerRegistry
registerLogger("tnt", Logger.stardardLogger( "tnt", "brief", new String[]{"brief", "full"}));
registerLogger("projectiles", Logger.stardardLogger("projectiles", "brief", new String[]{"brief", "full"}));
registerLogger("fallingBlocks",Logger.stardardLogger("fallingBlocks", "brief", new String[]{"brief", "full"}));
//registerLogger("kills", new Logger("kills", null, null));
//registerLogger("damage", new Logger("damage", "all", new String[]{"all","players","me"}));
//registerLogger("weather", new Logger("weather", null, null));
registerLogger( "pathfinding", Logger.stardardLogger("pathfinding", "20", new String[]{"2", "5", "10"}));
registerLogger("tps", HUDLogger.stardardHUDLogger("tps", null, null));
registerLogger("packets", HUDLogger.stardardHUDLogger("packets", null, null));
registerLogger("counter",HUDLogger.stardardHUDLogger("counter","white", Arrays.stream(DyeColor.values()).map(Object::toString).toArray(String[]::new)));
@@ -1,102 +0,0 @@
package carpet.logging.logHelpers;
import carpet.logging.LoggerRegistry;
import carpet.utils.Messenger;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.text.BaseText;
import java.util.function.Supplier;
public class DamageReporter
{
private static BaseText[] verifyAndProduceMessage(String option, PlayerEntity player, Entity from, Entity to, Supplier<BaseText> messageFuture)
{
if ("all".equalsIgnoreCase(option)
|| ("players".equalsIgnoreCase(option) && (from instanceof PlayerEntity || to instanceof PlayerEntity))
|| ("me".equalsIgnoreCase(option) && ( (from == player) || ( to == player) ) ))
{
return new BaseText[]{messageFuture.get()};
}
return null;
}
public static boolean register_damage_attacker(Entity target, LivingEntity source, float amount)
{
if (!LoggerRegistry.__damage) return true;
LoggerRegistry.getLogger("damage").log( (option, player)->
verifyAndProduceMessage(option, player, source, target, () ->
Messenger.c(source.getDisplayName(),
"g attacking ", target.getDisplayName(),"g for ",
String.format("r %.2f",amount), "g points of damage")
)
);
return true;
}
public static void register_damage(LivingEntity target, DamageSource source, float amount)
{
if (!LoggerRegistry.__damage) return;
if (source.isFire() && (target.isFireImmune() ||
target.hasStatusEffect(StatusEffects.FIRE_RESISTANCE)))
return;
LoggerRegistry.getLogger("damage").log( (option, player)->
verifyAndProduceMessage(option, player, source.getSource(), target, () ->
Messenger.c(target.getDisplayName(),
"g receiving ",
String.format("r %.2f", amount),
String.format("g points of damage from %s", source.getName()))
)
);
}
public static void register_final_damage(LivingEntity target, DamageSource source, float amount)
{
if (!LoggerRegistry.__damage) return;
LoggerRegistry.getLogger("damage").log( (option, player)->
verifyAndProduceMessage(option, player, source.getSource(), target, () ->
Messenger.c("g - total received ",
String.format("r %.2f", amount),
"g points of damage")
)
);
}
public static void modify_damage(LivingEntity target, DamageSource source, float previous_amount, float final_amount, String component)
{
if (!LoggerRegistry.__damage)
return;
if (previous_amount == final_amount)
return;
if (source.isFire() && (target.isFireImmune() ||
target.hasStatusEffect(StatusEffects.FIRE_RESISTANCE)))
return;
LoggerRegistry.getLogger("damage").log( (option, player)->
verifyAndProduceMessage(option, player, source.getSource(), target, () ->
{
if (final_amount == 0.0f)
{
return Messenger.c("g - reduced to ","r 0.0","g due to: "+component);
}
else if (previous_amount > final_amount)
{
float reduction = previous_amount-final_amount;
return Messenger.c("g - reduced to ",
String.format("l %.2f",final_amount),
String.format("g by %.2f (%.1f%% less) due to: %s",reduction,100.0*reduction/previous_amount, component));
}
else
{
float increase = final_amount-previous_amount;
return Messenger.c("g - increased to ",
String.format("r %.2f",final_amount),
String.format("g by %.2f (%.1f%% more) due to: %s",increase,100.0*increase/previous_amount, component));
}
}
)
);
}
}
@@ -1,26 +0,0 @@
package carpet.logging.logHelpers;
import carpet.logging.LoggerRegistry;
import carpet.utils.Messenger;
import net.minecraft.text.BaseText;
public class KillLogHelper {
public static void onSweep(String name, int count)
{
LoggerRegistry.getLogger("kills").log( () -> new BaseText[]{
Messenger.c("g "+name+" smacked ","r "+count,"g entities with sweeping")});
}
public static void onNonSweepAttack(String name)
{
LoggerRegistry.getLogger("kills").log( () -> new BaseText[]{
Messenger.c("g "+name+" smacked ","r 1","g (no sweeping)")});
}
public static void onDudHit(String name)
{
LoggerRegistry.getLogger("kills").log( () -> new BaseText[]{
Messenger.c("g "+name+" dud hot = no one affected")});
}
}
@@ -2,13 +2,8 @@ package carpet.logging.logHelpers;
import carpet.helpers.ParticleDisplay;
import carpet.logging.LoggerRegistry;
import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.command.argument.ParticleArgumentType;
import net.minecraft.entity.Entity;
import net.minecraft.particle.ParticleEffect;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.Vec3d;
public class PathfindingVisualizer
@@ -43,8 +43,8 @@ public class TNTLogHelper
"r E ",Messenger.dblt("r",x, y, z))};
case "full":
return new BaseText[]{Messenger.c(
"r #" + String.valueOf(tntCount),
"m @" + String.valueOf(gametime),
"r #" + tntCount,
"m @" + gametime,
"g : ",
"l P ",Messenger.dblf("l",primedX,primedY,primedZ),
"w ",Messenger.dblf("l", primedAngle.x, primedAngle.y, primedAngle.z),
@@ -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);
+2 -11
View File
@@ -84,7 +84,6 @@
"FluidBlock_renewableBlackstoneMixin",
"StructureFeatureMixin",
"World_scarpetPlopMixin",
"Biome_scarpetMixin",
"ChunkRegion_scarpetPlopMixin",
"StructurePiece_scarpetPlopMixin",
@@ -94,7 +93,7 @@
"SaplingBlockMixin",
"EntityMixin",
"FlatChunkGeneratorMixin",
"ChunkGeneratorMixin",
"ChunkGenerator_scarpetMixin",
"BiomeArray_getBiomeArrayMixin",
@@ -102,7 +101,7 @@
"DesertPyramidFeatureMixin",
"HuskEntityMixin",
"SurfaceChunkGenerator_husksSpawnMixin",
"NoiseChunkGenerator_husksSpawnMixin",
"ServerChunkManagerMixin",
"SpawnHelperMixin",
@@ -117,9 +116,6 @@
"ServerPlayNetworkHandler_antiCheatDisabledMixin",
"PlayerEntity_antiCheatDisabled",
"Entity_portalSuffocationMixin",
"PortalForcer_portalSuffocationMixin",
"ServerPlayerInteractionManager_antiCheatMixin",
"HopperBlockEntityMixin",
@@ -147,7 +143,6 @@
"DispenserBlock_qcMixin",
"PickaxeItem_missingToolsMixin",
"ShearsItem_missingToolsMixin",
"ItemDispenserBehaviour_extremeBehavioursMixin",
"ItemScatterer_extremeMixin",
@@ -157,8 +152,6 @@
"BlazeEntity_extremeMixin",
"BlazeEntityShootFireballGoal_extremeMixin",
"MobEntity_extremeMixin",
"ExplosiveProjectileEntity_extremeMixin",
"LlamaSpitEntity_extremeMixin",
"ProjectileEntity_extremeMixin",
"Projectile_extremeMixin",
@@ -196,7 +189,6 @@
"MinecraftClientMixin",
"MinecraftClient_pausedShakeMixin",
"WorldRenderer_pausedShakeMixin",
"IntegratedServerMixin",
"InGameHudMixin",
"PlayerListHudMixin",
"PistonBlockEntityRenderer_movableTEMixin",
@@ -209,7 +201,6 @@
"WorldRenderer_scarpetRenderMixin"
],
"server": [
"MinecraftDedicatedServerMixin"
],
"injectors": {
"defaultRequire": 1