This commit is contained in:
gnembon committed 2021-03-31 22:02:09 -03:00
1 parent b49b99aea6
commit 0320de5d6d
23 files changed
+78 -89

No files matched your search

@@ -4,7 +4,9 @@ import carpet.CarpetSettings;
import com.google.common.collect.Lists;
import com.mojang.serialization.Codec;
import net.minecraft.class_6012;
import net.minecraft.entity.EntityType;
import net.minecraft.world.MobSpawnerLogic;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.gen.feature.BastionRemnantFeature;
@@ -18,7 +20,7 @@ import java.util.List;
@Mixin(BastionRemnantFeature.class)
public abstract class BastionRemnantFeatureMixin extends JigsawFeature
{
private static final List<SpawnSettings.SpawnEntry> spawnList = Lists.newArrayList(
private static final class_6012<SpawnSettings.SpawnEntry> spawnList = class_6012.method_34989(
new SpawnSettings.SpawnEntry(EntityType.PIGLIN_BRUTE, 5, 1, 2),
new SpawnSettings.SpawnEntry(EntityType.PIGLIN, 10, 2, 4),
new SpawnSettings.SpawnEntry(EntityType.HOGLIN, 2, 1, 2)
@@ -30,10 +32,10 @@ public abstract class BastionRemnantFeatureMixin extends JigsawFeature
}
@Override
public List<SpawnSettings.SpawnEntry> getMonsterSpawns()
public class_6012<SpawnSettings.SpawnEntry> getMonsterSpawns()
{
if (CarpetSettings.piglinsSpawningInBastions)
return spawnList;
return Collections.emptyList();
return SpawnSettings.field_30982; // empty spawn list
}
}
@@ -3,6 +3,7 @@ package carpet.mixins;
import carpet.CarpetSettings;
import com.google.common.collect.Lists;
import com.mojang.serialization.Codec;
import net.minecraft.class_6012;
import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
@@ -16,11 +17,11 @@ import java.util.List;
@Mixin(DesertPyramidFeature.class)
public abstract class DesertPyramidFeatureMixin extends StructureFeature<DefaultFeatureConfig>
{
private static final List<SpawnSettings.SpawnEntry> MONSTER_SPAWNS;
private static final class_6012<SpawnSettings.SpawnEntry> MONSTER_SPAWNS;
static
{
MONSTER_SPAWNS = Lists.newArrayList(new SpawnSettings.SpawnEntry(EntityType.HUSK, 1, 1, 1));
MONSTER_SPAWNS = class_6012.method_34989(new SpawnSettings.SpawnEntry(EntityType.HUSK, 1, 1, 1));
}
public DesertPyramidFeatureMixin(Codec<DefaultFeatureConfig> codec)
@@ -30,13 +31,13 @@ public abstract class DesertPyramidFeatureMixin extends StructureFeature<Default
@Override
public List<SpawnSettings.SpawnEntry> getMonsterSpawns()
public class_6012<SpawnSettings.SpawnEntry> getMonsterSpawns()
{
if (CarpetSettings.huskSpawningInTemples)
{
return MONSTER_SPAWNS;
}
return Collections.emptyList();
return SpawnSettings.field_30982; // empty spawn list
}
}
@@ -3,6 +3,7 @@ package carpet.mixins;
import carpet.CarpetSettings;
import com.google.common.collect.Lists;
import com.mojang.serialization.Codec;
import net.minecraft.class_6012;
import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
@@ -16,7 +17,7 @@ import java.util.List;
@Mixin(EndCityFeature.class)
public abstract class EndCityFeatureMixin extends StructureFeature<DefaultFeatureConfig>
{
private static final List<SpawnSettings.SpawnEntry> spawnList = Lists.newArrayList(new SpawnSettings.SpawnEntry(EntityType.SHULKER, 10, 4, 4));
private static final class_6012<SpawnSettings.SpawnEntry> spawnList = class_6012.method_34989(new SpawnSettings.SpawnEntry(EntityType.SHULKER, 10, 4, 4));
public EndCityFeatureMixin(Codec<DefaultFeatureConfig> codec)
{
@@ -24,10 +25,10 @@ public abstract class EndCityFeatureMixin extends StructureFeature<DefaultFeatur
}
@Override
public List<SpawnSettings.SpawnEntry> getMonsterSpawns()
public class_6012<SpawnSettings.SpawnEntry> getMonsterSpawns()
{
if (CarpetSettings.shulkerSpawningInEndCities)
return spawnList;
return Collections.emptyList();
return SpawnSettings.field_30982; // empty spawn list
}
}
@@ -7,6 +7,7 @@ import net.minecraft.entity.ai.pathing.Path;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -22,18 +23,18 @@ public abstract class EntityNavigation_pathfindingMixin
@Shadow @Final protected MobEntity entity;
@Shadow /*@Nullable*/ protected abstract Path findPathToAny(Set<BlockPos> set_1, int int_1, boolean boolean_1, int int_2);
@Shadow protected @Nullable abstract Path method_35142(Set<BlockPos> set, int i, boolean bl, int j);
@Redirect(method = "findPathTo(Lnet/minecraft/util/math/BlockPos;I)Lnet/minecraft/entity/ai/pathing/Path;", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;findPathToAny(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;"
target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;method_35142(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;"
))
private Path pathToBlock(EntityNavigation entityNavigation, Set<BlockPos> set_1, int int_1, boolean boolean_1, int int_2)
{
if (!LoggerRegistry.__pathfinding)
return findPathToAny(set_1, int_1, boolean_1, int_2);
return method_35142(set_1, int_1, boolean_1, int_2);
long start = System.nanoTime();
Path path = findPathToAny(set_1, int_1, boolean_1, int_2);
Path path = method_35142(set_1, int_1, boolean_1, int_2);
long finish = System.nanoTime();
float duration = (1.0F*((finish - start)/1000))/1000;
set_1.forEach(b -> PathfindingVisualizer.slowPath(entity, Vec3d.ofBottomCenter(b), duration, path != null)); // ground centered position
@@ -42,14 +43,14 @@ public abstract class EntityNavigation_pathfindingMixin
@Redirect(method = "findPathTo(Lnet/minecraft/entity/Entity;I)Lnet/minecraft/entity/ai/pathing/Path;", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;findPathToAny(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;"
target = "Lnet/minecraft/entity/ai/pathing/EntityNavigation;method_35142(Ljava/util/Set;IZI)Lnet/minecraft/entity/ai/pathing/Path;"
))
private Path pathToEntity(EntityNavigation entityNavigation, Set<BlockPos> set_1, int int_1, boolean boolean_1, int int_2)
{
if (!LoggerRegistry.__pathfinding)
return findPathToAny(set_1, int_1, boolean_1, int_2);
return method_35142(set_1, int_1, boolean_1, int_2);
long start = System.nanoTime();
Path path = findPathToAny(set_1, int_1, boolean_1, int_2);
Path path = method_35142(set_1, int_1, boolean_1, int_2);
long finish = System.nanoTime();
float duration = (1.0F*((finish - start)/1000))/1000;
set_1.forEach(b -> PathfindingVisualizer.slowPath(entity, Vec3d.ofBottomCenter(b), duration, path != null));
@@ -84,22 +84,4 @@ public abstract class ExperienceOrbEntityMixin implements ExperienceOrbInterface
playerEntity.addExperience(experience);
}
}
// temporary until gets fixed game-side
@Inject(method = "onPlayerCollision", locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true, at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/ExperienceOrbEntity;getMendingRepairAmount(I)I"
))
void cancelApplication(PlayerEntity player, CallbackInfo ci, Map.Entry<EquipmentSlot, ItemStack> entry, ItemStack itemStack)
{
if (CarpetSettings.xpfix && pickingCount > 1)
{
int i = Math.min(getMendingRepairAmount(this.amount), itemStack.getDamage());
pickingCount--;
itemStack.setDamage(itemStack.getDamage() - i);
// cancel effects of mending application
ci.cancel();
}
}
}
@@ -1,6 +1,7 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.class_6012;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.Biome;
@@ -25,7 +26,7 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator
}
@Override
public List<SpawnSettings.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos)
public class_6012<SpawnSettings.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos)
{
if (CarpetSettings.flatWorldStructureSpawning)
{
@@ -33,7 +33,7 @@ public abstract class FluidBlock_renewableBlackstoneMixin
for(Direction direction : Direction.values())
{
if (direction != Direction.DOWN) {
BlockPos blockPos = pos.offset(direction);
BlockPos blockPos = pos.method_35851(direction); // offset
if (world.getBlockState(blockPos).isOf(Blocks.BLUE_ICE)) {
world.setBlockState(pos, Blocks.BLACKSTONE.getDefaultState());
playExtinguishSound(world, pos);
@@ -36,7 +36,7 @@ public abstract class HopperBlockEntityMixin extends LootableContainerBlockEntit
if (CarpetSettings.hopperCounters) {
DyeColor wool_color = WoolTool.getWoolColorAtPosition(
world,
blockPos.offset(blockState.get(HopperBlock.FACING)));
blockPos.method_35851(blockState.get(HopperBlock.FACING))); // offset
if (wool_color != null)
{
for (int i = 0; i < inventory.size(); ++i)
@@ -1,6 +1,7 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.class_6012;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.Biome;
@@ -29,7 +30,7 @@ public abstract class NoiseChunkGenerator_husksSpawnMixin extends ChunkGenerator
}
@Inject(method = "getEntitySpawnList", at = @At("HEAD"), cancellable = true)
private void isInsidePyramid(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos, CallbackInfoReturnable<List<SpawnSettings.SpawnEntry>> cir)
private void isInsidePyramid(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos, CallbackInfoReturnable<class_6012<SpawnSettings.SpawnEntry>> cir)
{
if (CarpetSettings.huskSpawningInTemples && group == SpawnGroup.MONSTER)
{
@@ -196,7 +196,7 @@ public abstract class PistonHandler_customStickyMixin
// stickyDirection = blockState_1.get(FacingBlock.FACING);
//}
return stickyDirection == null || this.tryMove(blockPos_1.offset(stickyDirection), stickyDirection);
return stickyDirection == null || this.tryMove(blockPos_1.method_35851(stickyDirection), stickyDirection); //offset
}
@@ -50,13 +50,13 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
}
world.getChunk(j, k).addStructureReference((StructureFeature) (Object)this, chId);
BlockBox box = structurestart.getBoundingBox();
BlockBox box = structurestart.setBoundingBoxFromChildren(); // getBB
if (!wireOnly)
{
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
int i = Math.max(box.getBlockCountY(),box.getBlockCountX())/16+1; // X Z
//int i = getRadius();
for (int k1 = j - i; k1 <= j + i; ++k1)
@@ -105,7 +105,7 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
if (biome == null)
biome_1 = generator.getBiomeSource().getBiomeForNoiseGen((chunkpos.getStartX() + 9) >> 2, 0, (chunkpos.getStartZ() + 9) >> 2 );
StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos, BlockBox.empty(),0,worldIn.getSeed());
StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos,0,worldIn.getSeed());
if (config == null)
config = new DefaultFeatureConfig();
structurestart1.init(worldIn.getRegistryManager(), generator, worldIn.getStructureManager() , chunkpos, biome_1, config, ichunk);