19w41a first pass

This commit is contained in:
gnembon committed 2019-10-09 19:43:37 -03:00
1 parent 5ebfb7d1c0
commit 7b649f9ccd
28 files changed
+164 -178

No files matched your search

@@ -4,7 +4,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
public interface class_4548Interface
public interface BiomeArrayInterface
{
void setBiomeAtIndex(BlockPos pos, World world, Biome what);
}
@@ -1,12 +1,12 @@
package carpet.fakes;
import net.minecraft.block.BlockRenderLayer;
//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,
/*void renderBlockEntityOffset(BlockEntity blockEntity_1, float partialTicks, int destroyStage, BlockRenderLayer blockRenderLayer_1, BufferBuilder bufferBuilder_1,
double xOffset, double yOffset, double zOffset);
*/
}
@@ -236,7 +236,7 @@ public class EntityPlayerActionPack
player.updateLastActionTime();
EntityHitResult entityHit = (EntityHitResult) hit;
Entity entity = entityHit.getEntity();
Vec3d relativeHitPos = entityHit.getPos().subtract(entity.x, entity.y, entity.z);
Vec3d relativeHitPos = entityHit.getPos().subtract(entity.method_23317(), entity.method_23318(), entity.method_23321());
if (entity.interactAt(player, relativeHitPos, hand) == ActionResult.SUCCESS) return true;
if (player.interact(entity, hand) == ActionResult.SUCCESS) return true;
break;
@@ -14,24 +14,11 @@ import net.minecraft.world.biome.source.VanillaLayeredBiomeSourceConfig;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.OverworldChunkGenerator;
import net.minecraft.world.gen.chunk.OverworldChunkGeneratorConfig;
import net.minecraft.world.gen.feature.BoulderFeatureConfig;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import net.minecraft.world.gen.feature.DoublePlantFeatureConfig;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.FeatureConfig;
import net.minecraft.world.gen.feature.IcebergFeatureConfig;
import net.minecraft.world.gen.feature.JungleGroundBushFeature;
import net.minecraft.world.gen.feature.LakeFeatureConfig;
import net.minecraft.world.gen.feature.MineshaftFeature;
import net.minecraft.world.gen.feature.MineshaftFeatureConfig;
import net.minecraft.world.gen.feature.OceanRuinFeature;
import net.minecraft.world.gen.feature.OceanRuinFeatureConfig;
import net.minecraft.world.gen.feature.PlantedFeatureConfig;
import net.minecraft.world.gen.feature.SeaPickleFeatureConfig;
import net.minecraft.world.gen.feature.SeagrassFeatureConfig;
import net.minecraft.world.gen.feature.ShipwreckFeatureConfig;
import net.minecraft.world.gen.feature.StructureFeature;
import net.minecraft.world.gen.feature.VillageFeatureConfig;
import net.minecraft.world.gen.feature.*;
//import net.minecraft.world.gen.feature.DoublePlantFeatureConfig;
//import net.minecraft.world.gen.feature.IcebergFeatureConfig;
//import net.minecraft.world.gen.feature.LakeFeatureConfig;
//import net.minecraft.world.gen.feature.PlantedFeatureConfig;
import java.util.HashMap;
import java.util.Map;
@@ -61,6 +48,8 @@ public class FeatureGenerator
private static Thing spawnCustomStructure(StructureFeature structure, FeatureConfig conf, Biome biome)
{
if (1+2==3)
throw new RuntimeException("rebuild me");
return (w, p) -> {
ChunkGenerator chunkgen = new OverworldChunkGenerator(w, w.method_14178().getChunkGenerator().getBiomeSource(), new OverworldChunkGeneratorConfig()) // BiomeSourceType.VANILLA_LAYERED.applyConfig((BiomeSourceType.VANILLA_LAYERED.getConfig())), ChunkGeneratorType.SURFACE.createSettings())
{
@@ -75,7 +64,7 @@ public class FeatureGenerator
{
return new VanillaLayeredBiomeSource(new VanillaLayeredBiomeSourceConfig(w.getLevelProperties()))
{
@Override
// // // @Override
public Biome getBiome(int i, int j, int k)
{
return biome;
@@ -99,48 +88,48 @@ public class FeatureGenerator
private static Map<String, Thing> featureMap = new HashMap<String, Thing>() {{
put("oak", simplePlop(Feature.NORMAL_TREE));
put("oak_large", simplePlop(Feature.FANCY_TREE));
put("birch", simplePlop(Feature.BIRCH_TREE));
put("birch_large", simplePlop(Feature.SUPER_BIRCH_TREE));
put("shrub", simplePlop(Feature.JUNGLE_GROUND_BUSH));
put("shrub_acacia", simplePlop(new JungleGroundBushFeature((d) -> FeatureConfig.DEFAULT, Blocks.ACACIA_WOOD.getDefaultState(), Blocks.ACACIA_LEAVES.getDefaultState())));
put("shrub_birch", simplePlop(new JungleGroundBushFeature((d) -> FeatureConfig.DEFAULT, Blocks.BIRCH_WOOD.getDefaultState(), Blocks.BIRCH_LEAVES.getDefaultState())));
put("shrub_snowy", simplePlop(new JungleGroundBushFeature((d) -> FeatureConfig.DEFAULT, Blocks.BONE_BLOCK.getDefaultState(), Blocks.COBWEB.getDefaultState())));
put("jungle", simplePlop(Feature.JUNGLE_TREE));
put("spruce_matchstick", simplePlop(Feature.PINE_TREE));
put("dark_oak", simplePlop(Feature.DARK_OAK_TREE));
put("acacia", simplePlop(Feature.SAVANNA_TREE));
put("spruce", simplePlop(Feature.SPRUCE_TREE));
put("oak_swamp", simplePlop(Feature.SWAMP_TREE));
put("jungle_large", simplePlop(Feature.MEGA_JUNGLE_TREE));
//put("oak", simplePlop(Feature.NORMAL_TREE));
//put("oak_large", simplePlop(Feature.FANCY_TREE));
//put("birch", simplePlop(Feature.BIRCH_TREE));
//put("birch_large", simplePlop(Feature.SUPER_BIRCH_TREE));
//put("shrub", simplePlop(Feature.JUNGLE_GROUND_BUSH));
//put("shrub_acacia", simplePlop(new JungleGroundBushFeature((d) -> FeatureConfig.DEFAULT, Blocks.ACACIA_WOOD.getDefaultState(), Blocks.ACACIA_LEAVES.getDefaultState())));
//put("shrub_birch", simplePlop(new JungleGroundBushFeature((d) -> FeatureConfig.DEFAULT, Blocks.BIRCH_WOOD.getDefaultState(), Blocks.BIRCH_LEAVES.getDefaultState())));
//put("shrub_snowy", simplePlop(new JungleGroundBushFeature((d) -> FeatureConfig.DEFAULT, Blocks.BONE_BLOCK.getDefaultState(), Blocks.COBWEB.getDefaultState())));
//put("jungle", simplePlop(Feature.JUNGLE_TREE));
//put("spruce_matchstick", simplePlop(Feature.PINE_TREE));
//put("dark_oak", simplePlop(Feature.DARK_OAK_TREE));
//put("acacia", simplePlop(Feature.SAVANNA_TREE));
//put("spruce", simplePlop(Feature.SPRUCE_TREE));
//put("oak_swamp", simplePlop(Feature.SWAMP_TREE));
//put("jungle_large", simplePlop(Feature.MEGA_JUNGLE_TREE));
//put("spruce_matchstick_large", simplePlop(Feature.MEGA_PINE_TREE));??
put("spruce_large", simplePlop(Feature.MEGA_SPRUCE_TREE));
//put("spruce_large", simplePlop(Feature.MEGA_SPRUCE_TREE));
put("well", simplePlop(Feature.DESERT_WELL));
put("grass_jungle", simplePlop(Feature.JUNGLE_GRASS));
put("fern", simplePlop(Feature.TAIGA_GRASS));
put("grass", simplePlop(Feature.DOUBLE_PLANT, new DoublePlantFeatureConfig(Blocks.TALL_GRASS.getDefaultState())));
//put("grass_jungle", simplePlop(Feature.JUNGLE_GRASS));
//put("fern", simplePlop(Feature.TAIGA_GRASS));
//put("grass", simplePlop(Feature.DOUBLE_PLANT, new DoublePlantFeatureConfig(Blocks.TALL_GRASS.getDefaultState())));
//put("", simplePlop(Feature.));
//put("", simplePlop(Feature.));
//put("", simplePlop(Feature.));
//put("", simplePlop(Feature.));
put("cactus", simplePlop(Feature.CACTUS));
put("dead_bush", simplePlop(Feature.DEAD_BUSH));
//put("cactus", simplePlop(Feature.CACTUS));
//put("dead_bush", simplePlop(Feature.DEAD_BUSH));
put("fossils", simplePlop(Feature.FOSSIL)); // spawn above, spawn invisible
put("mushroom_brown", simplePlop(Feature.HUGE_BROWN_MUSHROOM, new PlantedFeatureConfig(false)));
put("mushroom_red", simplePlop(Feature.HUGE_RED_MUSHROOM, new PlantedFeatureConfig(false)));
//put("mushroom_brown", simplePlop(Feature.HUGE_BROWN_MUSHROOM, new class_4635(false)));
// put("mushroom_red", simplePlop(Feature.HUGE_RED_MUSHROOM, new class_4635(false)));
put("ice_spike", simplePlop(Feature.ICE_SPIKE));
put("glowstone", simplePlop(Feature.GLOWSTONE_BLOB));
put("melon", simplePlop(Feature.MELON));
put("pumpkin", simplePlop(Feature.PUMPKIN));
put("sugarcane", simplePlop(Feature.REED));
put("lilypad", simplePlop(Feature.WATERLILY));
//put("melon", simplePlop(Feature.MELON));
//put("pumpkin", simplePlop(Feature.PUMPKIN));
//put("sugarcane", simplePlop(Feature.REED));
//put("lilypad", simplePlop(Feature.WATERLILY));
put("dungeon", simplePlop(Feature.MONSTER_ROOM));
put("iceberg", simplePlop(Feature.ICEBERG, new IcebergFeatureConfig(Blocks.PACKED_ICE.getDefaultState())));
put("iceberg_blue", simplePlop(Feature.ICEBERG, new IcebergFeatureConfig(Blocks.BLUE_ICE.getDefaultState())));
put("lake", simplePlop(Feature.LAKE, new LakeFeatureConfig(Blocks.WATER.getDefaultState())));
put("lake_lava", simplePlop(Feature.LAKE, new LakeFeatureConfig(Blocks.LAVA.getDefaultState())));
put("iceberg", simplePlop(Feature.ICEBERG, new BushFeatureConfig(Blocks.PACKED_ICE.getDefaultState())));
put("iceberg_blue", simplePlop(Feature.ICEBERG, new BushFeatureConfig(Blocks.BLUE_ICE.getDefaultState())));
put("lake", simplePlop(Feature.LAKE, new BushFeatureConfig(Blocks.WATER.getDefaultState())));
put("lake_lava", simplePlop(Feature.LAKE, new BushFeatureConfig(Blocks.LAVA.getDefaultState())));
//put("end tower", simplePlop(Feature.END_CRYSTAL_TOWER)); // requires more complex setup
put("end_island", simplePlop(Feature.END_ISLAND));
put("chorus", simplePlop(Feature.CHORUS_PLANT));
+1 -1
View File
@@ -47,7 +47,7 @@ public class XPcombine
if (getTextureByXP(first.getExperienceAmount()) != size)
{
newOrb = new ExperienceOrbEntity(EntityType.EXPERIENCE_ORB, first.world);
newOrb.setPositionAndAngles(first.x, first.y, first.z, first.yaw, first.pitch);
newOrb.setPositionAndAngles(first.method_23317(), first.method_23318(), first.method_23321(), first.yaw, first.pitch);
((ExperienceOrbInterface)newOrb).setAmount(first.getExperienceAmount());
first.world.spawnEntity(newOrb);
@@ -0,0 +1,35 @@
package carpet.mixins;
import carpet.fakes.BiomeArrayInterface;
import carpet.settings.CarpetSettings;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeArray;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(BiomeArray.class)
public class BiomeArray_getBiomeArrayMixin implements BiomeArrayInterface
{
@Shadow @Final private static int HORIZONTAL_SECTION_COUNT;
@Shadow @Final public static int HORIZONTAL_BIT_MASK;
@Shadow @Final public static int VERTICAL_BIT_MASK;
@Shadow @Final private Biome[] data;
@Override
public void setBiomeAtIndex(BlockPos pos, World world, Biome what)
{
int seaLevel = 0;// seems to be a fixed value for now. world.getSeaLevel();
int int_4 = (pos.getX() >> 2) & HORIZONTAL_BIT_MASK;
int int_5 = MathHelper.clamp(seaLevel, 0, VERTICAL_BIT_MASK);
int int_6 = (pos.getZ() >> 2) & HORIZONTAL_BIT_MASK;
data[(int_5 << (HORIZONTAL_SECTION_COUNT + HORIZONTAL_SECTION_COUNT)) | (int_6 << HORIZONTAL_SECTION_COUNT) | int_4] = what;
}
}
@@ -1,7 +1,7 @@
package carpet.mixins;
import carpet.fakes.BlockEntityRenderDispatcherInterface;
import net.minecraft.block.BlockRenderLayer;
//import net.minecraft.block.BlockRenderLayer;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.Camera;
@@ -29,7 +29,7 @@ public abstract class FallingBlockEntityMixin extends Entity
private void tickCheck(CallbackInfo ci)
{
if (LoggerRegistry.__fallingBlocks && logHelper != null)
logHelper.onTick(x, y, z, getVelocity());
logHelper.onTick(method_23317(), method_23318(), method_23321(), getVelocity());
}
@Override
@@ -1,9 +1,9 @@
package carpet.mixins;
import carpet.settings.CarpetSettings;
import net.minecraft.class_4538;
import net.minecraft.structure.processor.GravityStructureProcessor;
import net.minecraft.world.Heightmap;
import net.minecraft.world.WorldView;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -13,10 +13,10 @@ public class GravityStructureProcessorMixin
{
@Redirect(method = "process", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/class_4538;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/world/WorldView;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(class_4538 class_4538, Heightmap.Type var1, int var2, int var3)
private int getTop(WorldView worldView, Heightmap.Type var1, int var2, int var3)
{
return class_4538.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:var1, var2, var3);
return worldView.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.WORLD_SURFACE:var1, var2, var3);
}
}
@@ -27,7 +27,7 @@ public abstract class GuardianEntityMixin extends HostileEntity
if (!this.world.isClient && !this.removed && CarpetSettings.renewableSponges)
{
ElderGuardianEntity elderGuardian = new ElderGuardianEntity(EntityType.ELDER_GUARDIAN ,this.world);
elderGuardian.setPositionAndAngles(this.x, this.y, this.z, this.yaw, this.pitch);
elderGuardian.setPositionAndAngles(this.method_23317(), this.method_23318(), this.method_23321(), this.yaw, this.pitch);
elderGuardian.initialize(this.world ,this.world.getLocalDifficulty(new BlockPos(elderGuardian)), SpawnType.CONVERSION, (EntityData)null, (CompoundTag)null);
elderGuardian.setAiDisabled(this.isAiDisabled());
@@ -4,11 +4,11 @@ import carpet.settings.CarpetSettings;
import carpet.fakes.PistonBlockEntityInterface;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.PistonBlockEntity;
import net.minecraft.class_4587;
import net.minecraft.class_4597;
import net.minecraft.client.render.LayeredVertexConsumerStorage;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.PistonBlockEntityRenderer;
import net.minecraft.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -24,8 +24,9 @@ public abstract class PistonBlockEntityRenderer_movableTEMixin extends BlockEnti
}
@Inject(method = "method_3576", at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/render/block/entity/PistonBlockEntityRenderer;method_3575(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/class_4587;Lnet/minecraft/class_4597;Lnet/minecraft/world/World;Z)V", ordinal = 3))
private void updateRenderBool(PistonBlockEntity pistonBlockEntity_1, double double_1, double double_2, double double_3, float float_1, class_4587 class_4587_1, class_4597 class_4597_1, int int_1, CallbackInfo ci)
target = "Lnet/minecraft/client/render/block/entity/PistonBlockEntityRenderer;method_3575(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/MatrixStack;Lnet/minecraft/client/render/LayeredVertexConsumerStorage;Lnet/minecraft/world/World;ZI)V", ordinal = 3))
private void updateRenderBool(PistonBlockEntity pistonBlockEntity_1, double double_1, double double_2, double double_3, float float_1, MatrixStack matrixStack_1, LayeredVertexConsumerStorage layeredVertexConsumerStorage_1, int int_1, int int_2, CallbackInfo ci)
//private void updateRenderBool(PistonBlockEntity pistonBlockEntity_1, double double_1, double double_2, double double_3, float float_1, class_4587 class_4587_1, class_4597 class_4597_1, int int_1, CallbackInfo ci)
{
if (!((PistonBlockEntityInterface) pistonBlockEntity_1).isRenderModeSet())
((PistonBlockEntityInterface) pistonBlockEntity_1).setRenderCarriedBlockEntity(CarpetSettings.movableBlockEntities && ((PistonBlockEntityInterface) pistonBlockEntity_1).getCarriedBlockEntity() != null);
@@ -33,7 +34,7 @@ public abstract class PistonBlockEntityRenderer_movableTEMixin extends BlockEnti
@Inject(method = "method_3576", at = @At("RETURN"), locals = LocalCapture.NO_CAPTURE)
private void endMethod3576(PistonBlockEntity pistonBlockEntity_1, double xOffset, double yOffset, double zOffset, float partialTicks, class_4587 transform, class_4597 bufferWrapper, int int_1, CallbackInfo ci)
private void endMethod3576(PistonBlockEntity pistonBlockEntity_1, double xOffset, double yOffset, double zOffset, float partialTicks, MatrixStack matrixStack_1, LayeredVertexConsumerStorage layeredVertexConsumerStorage_1, int int_1, int init_2, CallbackInfo ci)
{
if (((PistonBlockEntityInterface) pistonBlockEntity_1).getRenderCarriedBlockEntity())
{
@@ -42,12 +43,12 @@ public abstract class PistonBlockEntityRenderer_movableTEMixin extends BlockEnti
{
carriedBlockEntity.setPos(pistonBlockEntity_1.getPos());
//((BlockEntityRenderDispatcherInterface) BlockEntityRenderDispatcher.INSTANCE).renderBlockEntityOffset(carriedBlockEntity, float_1, int_1, BlockRenderLayer.field_20799, bufferBuilder_1, pistonBlockEntity_1.getRenderOffsetX(float_1), pistonBlockEntity_1.getRenderOffsetY(float_1), pistonBlockEntity_1.getRenderOffsetZ(float_1));
transform.method_22904( // translate
matrixStack_1.translate(
pistonBlockEntity_1.getRenderOffsetX(partialTicks),
pistonBlockEntity_1.getRenderOffsetY(partialTicks),
pistonBlockEntity_1.getRenderOffsetZ(partialTicks)
);
BlockEntityRenderDispatcher.INSTANCE.render(carriedBlockEntity, partialTicks, transform, bufferWrapper, xOffset, yOffset, zOffset);
BlockEntityRenderDispatcher.INSTANCE.render(carriedBlockEntity, partialTicks, matrixStack_1, layeredVertexConsumerStorage_1, xOffset, yOffset, zOffset);
}
}
@@ -35,9 +35,9 @@ public abstract class PistonBlock_movableTEMixin extends FacingBlock
if (CarpetSettings.stickyHoney && direction_1 != direction_2)
{
Block block = blockState_1.getBlock();
if (block != Blocks.GOLD_BLOCK && block != Blocks.SLIME_BLOCK) return;
if (block != Blocks.HONEY_BLOCK && block != Blocks.SLIME_BLOCK) return;
Block otherBlock = world_1.getBlockState(blockPos_1.method_10079(direction_2.getOpposite(),1)).getBlock();
if (otherBlock != Blocks.GOLD_BLOCK && otherBlock != Blocks.SLIME_BLOCK) return;
if (otherBlock != Blocks.HONEY_BLOCK && otherBlock != Blocks.SLIME_BLOCK) return;
cir.setReturnValue(block == otherBlock);
}
}
@@ -41,10 +41,6 @@ public abstract class PistonHandler_movableTEMixin
* @author 2No2Name
*/
private void stickToStickySide(BlockPos blockPos_1, Direction direction_1, CallbackInfoReturnable<Boolean> cir, BlockState blockState_1, Block block_1, int int_1, int int_2, int int_4, BlockPos blockPos_3, int int_5, int int_6){
if (CarpetSettings.stickyHoney && this.world.getBlockState(blockPos_1).getBlock() == Blocks.GOLD_BLOCK && !method_11538(blockPos_1)) {
cir.setReturnValue(false);
return;
}
if(!stickToStickySide(blockPos_3)){
cir.setReturnValue(false);
cir.cancel();
@@ -58,11 +54,6 @@ public abstract class PistonHandler_movableTEMixin
*/
private void stickToStickySide(CallbackInfoReturnable<Boolean> cir, int int_1){
BlockPos pos = this.movedBlocks.get(int_1);
if (CarpetSettings.stickyHoney && world.getBlockState(pos).getBlock() == Blocks.GOLD_BLOCK && !method_11538(pos))
{
cir.setReturnValue(false);
return;
}
if(!stickToStickySide(pos)){
cir.setReturnValue(false);
cir.cancel();
@@ -112,19 +103,15 @@ public abstract class PistonHandler_movableTEMixin
private BlockState redirectGetBlockState_1_B(World world, BlockPos pos) {
return blockState_1 = world.getBlockState(pos);
}
@Redirect(method = "tryMove",
at = @At(value = "FIELD", target = "Lnet/minecraft/block/Blocks;SLIME_BLOCK:Lnet/minecraft/block/Block;"))
@Inject(method = "method_23367", at = @At(value = "HEAD"), cancellable = true)
//Thanks to Earthcomputer for showing how to redirect FIELD access like this
/**
* Makes backwards stickyness work with sticky non-slimeblocks as well.
* @author 2No2Nameb
*/
private Block redirectSlimeBlock() {
if (CarpetSettings.stickyHoney && blockState_1.getBlock() == Blocks.GOLD_BLOCK)
return Blocks.GOLD_BLOCK;
private void redirectSlimeBlock(Block block_1, CallbackInfoReturnable<Boolean> cir) {
if (CarpetSettings.movableBlockEntities && isStickyOnSide(blockState_1, this.direction.getOpposite()))
return blockState_1.getBlock(); //this makes the comparison in the while condition "while(blockState_1.getBlock() == redirectSlimeBlock())" evaluate to true, so the block is treated as sticky
return Blocks.SLIME_BLOCK; //vanilla behavior
cir.setReturnValue(true);
}
@@ -29,7 +29,7 @@ public abstract class ProjectileEntityMixin extends Entity
private void tickCheck(CallbackInfo ci)
{
if (LoggerRegistry.__projectiles && logHelper != null)
logHelper.onTick(x, y, z, getVelocity());
logHelper.onTick(method_23317(), method_23318(), method_23321(), getVelocity());
}
@Inject(method = "onHit(Lnet/minecraft/util/hit/HitResult;)V", at = @At("RETURN"))
@@ -20,6 +20,8 @@ public class ServerPlayNetworkHandler_tickMixin
@Shadow private double lastTickY;
@Shadow private double lastTickZ;
@Inject(method = "onPlayerInput", at = @At(value = "RETURN"))
private void checkMoves(PlayerInputC2SPacket p, CallbackInfo ci)
{
@@ -36,9 +38,9 @@ public class ServerPlayNetworkHandler_tickMixin
))
private void checkMove(PlayerMoveC2SPacket p, CallbackInfo ci)
{
if (Math.abs(p.getX(player.x) - lastTickX) > 0.0001D
|| Math.abs(p.getY(player.y) - lastTickY) > 0.0001D
|| Math.abs(p.getY(player.y) - lastTickY) > 0.0001D)
if (Math.abs(p.getX(player.method_23317()) - lastTickX) > 0.0001D
|| Math.abs(p.getY(player.method_23318()) - lastTickY) > 0.0001D
|| Math.abs(p.getY(player.method_23321()) - lastTickZ) > 0.0001D)
{
TickSpeed.reset_player_active_timeout();
}
@@ -17,7 +17,7 @@ public class ServerPlayerInteractionManager_cactusMixin
@Redirect(method = "interactBlock", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/BlockState;activate(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Z"
target = "Lnet/minecraft/block/BlockState;onUse(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Z"
))
private boolean activateWithOptionalCactus(BlockState blockState, World world_1, PlayerEntity playerEntity_1, Hand hand_1, BlockHitResult blockHitResult_1)
{
@@ -25,6 +25,6 @@ public class ServerPlayerInteractionManager_cactusMixin
if (flipped)
return true;
return blockState.activate(world_1, playerEntity_1, hand_1, blockHitResult_1);
return blockState.onUse(world_1, playerEntity_1, hand_1, blockHitResult_1);
}
}
@@ -9,6 +9,7 @@ import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.BlockBox;
import net.minecraft.world.IWorld;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.gen.chunk.ChunkGenerator;
@@ -101,6 +102,10 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
private StructureStart forceStructureStart(IWorld worldIn, ChunkGenerator <? extends ChunkGeneratorConfig > generator, Random rand, long packedChunkPos)
{
if (2+1==3)
{
throw new RuntimeException("reimplement it");
}
ChunkPos chunkpos = new ChunkPos(packedChunkPos);
StructureStart structurestart;
@@ -115,7 +120,7 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
return structurestart;
}
}
Biome biome_1 = generator.getBiomeSource().getBiome((chunkpos.getStartX() + 9) >> 2, 0, (chunkpos.getStartZ() + 9) >> 2 );
Biome biome_1 = Biomes.PLAINS;// generator.getBiomeSource().getBiome((chunkpos.getStartX() + 9) >> 2, 0, (chunkpos.getStartZ() + 9) >> 2 );
StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos.x, chunkpos.z, BlockBox.empty(),0,generator.getSeed());
structurestart1.initialize(generator, ((ServerWorld)worldIn).getStructureManager() , chunkpos.x, chunkpos.z, biome_1);
structurestart = structurestart1.hasChildren() ? structurestart1 : StructureStart.DEFAULT;
@@ -1,9 +1,9 @@
package carpet.mixins;
import carpet.settings.CarpetSettings;
import net.minecraft.class_4538;
import net.minecraft.structure.StructurePiece;
import net.minecraft.world.Heightmap;
import net.minecraft.world.WorldView;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -13,10 +13,10 @@ public class StructurePieceMixin
{
@Redirect(method = "isUnderSeaLevel", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/class_4538;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"
target = "Lnet/minecraft/world/WorldView;getTopY(Lnet/minecraft/world/Heightmap$Type;II)I"
))
private int getTop(class_4538 class_4538, Heightmap.Type var1, int var2, int var3)
private int getTop(WorldView worldView, Heightmap.Type var1, int var2, int var3)
{
return class_4538.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
return worldView.getTopY(CarpetSettings.skipGenerationChecks?Heightmap.Type.OCEAN_FLOOR:Heightmap.Type.OCEAN_FLOOR_WG, var2, var3);
}
}
@@ -29,7 +29,7 @@ public abstract class ThrownEntityMixin extends Entity
private void tickCheck(CallbackInfo ci)
{
if (LoggerRegistry.__projectiles && logHelper != null)
logHelper.onTick(x, y, z, getVelocity());
logHelper.onTick(method_23317(), method_23318(), method_23321(), getVelocity());
}
@Override
@@ -38,7 +38,7 @@ public abstract class TntEntityMixin extends Entity
{
if (LoggerRegistry.__tnt && logHelper != null && !logHelper.initialized)
{
logHelper.onPrimed(x, y, z, getVelocity());
logHelper.onPrimed(method_23317(), method_23318(), method_23321(), getVelocity());
}
}
@@ -56,6 +56,6 @@ public abstract class TntEntityMixin extends Entity
private void onExplode(CallbackInfo ci)
{
if (LoggerRegistry.__tnt && logHelper != null)
logHelper.onExploded(x, y, z);
logHelper.onExploded(method_23317(), method_23318(), method_23321());
}
}
@@ -123,7 +123,7 @@ public abstract class VillagerEntity_aiMixin extends AbstractTraderEntity
if (bedPos == null || bedPos.getDimension() != dimension)
{
sayNo();
((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER, x, y + getStandingEyeHeight() + 1, z, 1, 0.1, 0.1, 0.1, 0.0);
((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER, method_23317(), method_23318() + getStandingEyeHeight() + 1, method_23321(), 1, 0.1, 0.1, 0.1, 0.0);
}
else
{
@@ -181,7 +181,7 @@ public abstract class VillagerEntity_aiMixin extends AbstractTraderEntity
{
if (MobAI.isTracking(this, MobAI.TrackingType.IRON_GOLEM_SPAWNING))
{
((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER, x, y+3, z, 1, 0.1, 0.1, 0.1, 0.0);
((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER, method_23317(), method_23318()+3, method_23321(), 1, 0.1, 0.1, 0.1, 0.0);
}
}
@@ -1,34 +0,0 @@
package carpet.mixins;
import carpet.fakes.class_4548Interface;
import carpet.settings.CarpetSettings;
import net.minecraft.class_4548;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import static net.minecraft.class_4548.field_20650;
import static net.minecraft.class_4548.field_20651;
@Mixin(class_4548.class)
public class class_4548_getBiomeArrayMixin implements class_4548Interface
{
@Shadow @Final private Biome[] field_20654;
@Shadow @Final private static int field_20652;
@Override
public void setBiomeAtIndex(BlockPos pos, World world, Biome what)
{
int seaLevel = 0;// seems to be a fixed value for now. world.getSeaLevel();
int int_4 = (pos.getX() >> 2) & field_20650;
int int_5 = MathHelper.clamp(seaLevel, 0, field_20651);
int int_6 = (pos.getZ() >> 2) & field_20650;
field_20654[(int_5 << (field_20652 + field_20652)) | (int_6 << field_20652) | int_4] = what;
}
}
@@ -75,7 +75,7 @@ public class EntityPlayerMPFake extends ServerPlayerEntity
server.getPlayerManager().onPlayerConnect(new NetworkManagerFake(NetworkSide.SERVERBOUND), playerShadow);
playerShadow.setHealth(player.getHealth());
playerShadow.networkHandler.requestTeleport(player.x, player.y, player.z, player.yaw, player.pitch);
playerShadow.networkHandler.requestTeleport(player.method_23317(), player.method_23318(), player.method_23321(), player.yaw, player.pitch);
interactionManagerIn.setGameMode(player.interactionManager.getGameMode());
((ServerPlayerEntityInterface) playerShadow).getActionPack().copyFrom(((ServerPlayerEntityInterface) player).getActionPack());
playerShadow.stepHeight = 0.6F;
@@ -2,7 +2,7 @@ package carpet.script;
import carpet.CarpetServer;
import carpet.fakes.MinecraftServerInterface;
import carpet.fakes.class_4548Interface;
import carpet.fakes.BiomeArrayInterface;
import carpet.helpers.FeatureGenerator;
import carpet.script.Fluff.TriFunction;
import carpet.script.exception.CarpetExpressionException;
@@ -676,7 +676,7 @@ public class CarpetExpression
Entity e = ((EntityValue) arg).getEntity();
if (e == null)
throw new InternalExpressionException("Null entity");
Value retval = ListValue.of(new NumericValue(e.x), new NumericValue(e.y), new NumericValue(e.z));
Value retval = ListValue.of(new NumericValue(e.method_23317()), new NumericValue(e.method_23318()), new NumericValue(e.method_23321()));
return (c_, t_) -> retval;
}
else
@@ -785,7 +785,7 @@ public class CarpetExpression
booleanStateTest(c, "block_tick", lv, (s, p) ->
{
ServerWorld w = ((CarpetContext)c).s.getWorld();
s.onRandomTick(w, p, w.random);
s.randomTick(w, p, w.random);
return true;
}));
@@ -794,7 +794,7 @@ public class CarpetExpression
{
ServerWorld w = ((CarpetContext)c).s.getWorld();
if (s.hasRandomTicks() || s.getFluidState().hasRandomTicks())
s.onRandomTick(w, p, w.random);
s.randomTick(w, p, w.random);
return true;
}));
@@ -1024,7 +1024,7 @@ public class CarpetExpression
ServerWorld world = cc.s.getWorld();
BlockPos pos = locator.block.getPos();
Chunk chunk = world.getChunk(pos);
((class_4548Interface)chunk.getBiomeArray()).setBiomeAtIndex(pos, world, biome);
((BiomeArrayInterface)chunk.getBiomeArray()).setBiomeAtIndex(pos, world, biome);
this.forceChunkUpdate(pos, world);
return LazyValue.NULL;
});
@@ -1332,8 +1332,8 @@ public class CarpetExpression
{
LivingEntity villager = (LivingEntity)owner;
// stolen from LookTargetUtil.give((VillagerEntity)owner, droppedStack, (LivingEntity) owner);
double double_1 = villager.y - 0.30000001192092896D + (double)villager.getStandingEyeHeight();
item = new ItemEntity(villager.world, villager.x, double_1, villager.z, droppedStack);
double double_1 = villager.method_23318() - 0.30000001192092896D + (double)villager.getStandingEyeHeight();
item = new ItemEntity(villager.world, villager.method_23317(), double_1, villager.method_23321(), droppedStack);
Vec3d vec3d_1 = villager.getRotationVec(1.0F).normalize().multiply(0.3);// new Vec3d(0, 0.3, 0);
item.setVelocity(vec3d_1);
item.setToDefaultPickupDelay();
@@ -1808,7 +1808,7 @@ public class CarpetExpression
{
throw new InternalExpressionException("Unknown entity selection criterion: "+who);
}
List<Entity> entityList = ((CarpetContext)c).s.getWorld().getEntities(pair.getKey(), area, pair.getValue());
List<Entity> entityList = ((CarpetContext)c).s.getWorld().getEntities((EntityType<Entity>) pair.getKey(), area, pair.getValue());
Value retval = ListValue.wrap(entityList.stream().map(EntityValue::new).collect(Collectors.toList()));
return (_c, _t ) -> retval;
});
@@ -2811,7 +2811,7 @@ public class CarpetExpression
return (cc, tt) -> retval;
});
this.expr.addLazyFunction("plop", 4, (c, t, lv) ->{
/*this.expr.addLazyFunction("plop", 4, (c, t, lv) ->{
BlockValue.LocatorResult locator = BlockValue.fromParams((CarpetContext)c, lv, 0);
if (lv.size() <= locator.offset)
throw new InternalExpressionException("plop needs extra argument indicating what to plop");
@@ -2822,7 +2822,7 @@ public class CarpetExpression
if (what.equalsIgnoreCase("boulder")) // there might be more of those
this.forceChunkUpdate(locator.block.getPos(), ((CarpetContext)c).s.getWorld());
return (c_, t_) -> new NumericValue(res);
});
});*/
this.expr.addLazyFunction("schedule", -1, (c, t, lv) -> {
if (lv.size()<2)
@@ -180,11 +180,11 @@ public class EntityValue extends Value
put("removed", (entity, arg) -> new NumericValue(entity.removed));
put("uuid",(e, a) -> new StringValue(e.getUuidAsString()));
put("id",(e, a) -> new NumericValue(e.getEntityId()));
put("pos", (e, a) -> ListValue.of(new NumericValue(e.x), new NumericValue(e.y), new NumericValue(e.z)));
put("location", (e, a) -> ListValue.of(new NumericValue(e.x), new NumericValue(e.y), new NumericValue(e.z), new NumericValue(e.yaw), new NumericValue(e.pitch)));
put("x", (e, a) -> new NumericValue(e.x));
put("y", (e, a) -> new NumericValue(e.y));
put("z", (e, a) -> new NumericValue(e.z));
put("pos", (e, a) -> ListValue.of(new NumericValue(e.method_23317()), new NumericValue(e.method_23318()), new NumericValue(e.method_23321())));
put("location", (e, a) -> ListValue.of(new NumericValue(e.method_23317()), new NumericValue(e.method_23318()), new NumericValue(e.method_23321()), new NumericValue(e.yaw), new NumericValue(e.pitch)));
put("x", (e, a) -> new NumericValue(e.method_23317()));
put("y", (e, a) -> new NumericValue(e.method_23317()));
put("z", (e, a) -> new NumericValue(e.method_23317()));
put("motion", (e, a) ->
{
Vec3d velocity = e.getVelocity();
@@ -422,7 +422,7 @@ public class EntityValue extends Value
private static void updatePosition(Entity e)
{
if (e instanceof ServerPlayerEntity)
((ServerPlayerEntity)e).networkHandler.requestTeleport(e.x, e.y, e.z, e.yaw, e.pitch);
((ServerPlayerEntity)e).networkHandler.requestTeleport(e.method_23317(), e.method_23318(), e.method_23321(), e.yaw, e.pitch);
else
((ServerWorld)e.getEntityWorld()).method_14178().sendToNearbyPlayers(e,new EntityPositionS2CPacket(e));
}
@@ -446,14 +446,16 @@ public class EntityValue extends Value
throw new InternalExpressionException("expected a list of 5 parameters as second argument");
}
List<Value> coords = ((ListValue) v).getItems();
e.x = NumericValue.asNumber(coords.get(0)).getDouble();
e.y = NumericValue.asNumber(coords.get(1)).getDouble();
e.z = NumericValue.asNumber(coords.get(2)).getDouble();
e.method_23327(
NumericValue.asNumber(coords.get(0)).getDouble(),
NumericValue.asNumber(coords.get(1)).getDouble(),
NumericValue.asNumber(coords.get(2)).getDouble()
);
e.pitch = (float) NumericValue.asNumber(coords.get(4)).getDouble();
e.prevPitch = e.pitch;
e.yaw = (float) NumericValue.asNumber(coords.get(3)).getDouble();
e.prevYaw = e.yaw;
e.setPosition(e.x, e.y, e.z);
e.setPosition(e.method_23317(), e.method_23318(), e.method_23321());
updatePosition(e);
});
put("pos", (e, v) ->
@@ -463,28 +465,30 @@ public class EntityValue extends Value
throw new InternalExpressionException("expected a list of 3 parameters as second argument");
}
List<Value> coords = ((ListValue) v).getItems();
e.x = NumericValue.asNumber(coords.get(0)).getDouble();
e.y = NumericValue.asNumber(coords.get(1)).getDouble();
e.z = NumericValue.asNumber(coords.get(2)).getDouble();
e.setPosition(e.x, e.y, e.z);
e.method_23327(
NumericValue.asNumber(coords.get(0)).getDouble(),
NumericValue.asNumber(coords.get(1)).getDouble(),
NumericValue.asNumber(coords.get(2)).getDouble()
);
e.setPosition(e.method_23317(), e.method_23318(), e.method_23321());
updatePosition(e);
});
put("x", (e, v) ->
{
e.x = NumericValue.asNumber(v).getDouble();
e.setPosition(e.x, e.y, e.z);
//e.x = NumericValue.asNumber(v).getDouble();
e.setPosition(NumericValue.asNumber(v).getDouble(), e.method_23318(), e.method_23321());
updatePosition(e);
});
put("y", (e, v) ->
{
e.y = NumericValue.asNumber(v).getDouble();
e.setPosition(e.x, e.y, e.z);
//e.y = NumericValue.asNumber(v).getDouble();
e.setPosition(e.method_23317(), NumericValue.asNumber(v).getDouble(), e.method_23321());
updatePosition(e);
});
put("z", (e, v) ->
{
e.z = NumericValue.asNumber(v).getDouble();
e.setPosition(e.x, e.y, e.z);
//e.z = NumericValue.asNumber(v).getDouble();
e.setPosition(e.method_23317(), e.method_23318(), NumericValue.asNumber(v).getDouble());
updatePosition(e);
});
put("pitch", (e, v) ->
@@ -510,10 +514,7 @@ public class EntityValue extends Value
throw new InternalExpressionException("expected a list of 3 parameters as second argument");
}
List<Value> coords = ((ListValue) v).getItems();
e.x += NumericValue.asNumber(coords.get(0)).getDouble();
e.y += NumericValue.asNumber(coords.get(1)).getDouble();
e.z += NumericValue.asNumber(coords.get(2)).getDouble();
e.setPosition(e.x, e.y, e.z);
e.setPosition(NumericValue.asNumber(coords.get(0)).getDouble(),NumericValue.asNumber(coords.get(1)).getDouble(), NumericValue.asNumber(coords.get(2)).getDouble());
updatePosition(e);
});
+1 -1
View File
@@ -65,7 +65,7 @@ public class EntityInfo
{
return "None";
}
return String.format("%s at [%.1f, %.1f, %.1f]",e.getDisplayName().getString(), e.x, e.y, e.y);
return String.format("%s at [%.1f, %.1f, %.1f]",e.getDisplayName().getString(), e.method_23317(), e.method_23318(), e.method_23321());
}
private static double get_speed(double internal)
@@ -7,7 +7,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.EntityCategory;
import net.minecraft.entity.SpawnRestriction;
import net.minecraft.entity.SpawnType;
import net.minecraft.entity.WaterCreatureEntity;
import net.minecraft.entity.mob.WaterCreatureEntity;
import net.minecraft.entity.mob.AmbientEntity;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.mob.Monster;