21w37a
This commit is contained in:
1 parent
70754dbfe8
commit
bc175509a2
24 files changed
+155
-113
No files matched your search
@@ -7,43 +7,46 @@ import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.PistonExtensionBlock;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkSectionPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.HeightLimitView;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.TickScheduler;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.ChunkSection;
|
||||
import net.minecraft.world.chunk.UpgradeData;
|
||||
import net.minecraft.world.chunk.WorldChunk;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
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.Redirect;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static net.minecraft.world.chunk.WorldChunk.EMPTY_SECTION;
|
||||
|
||||
@Mixin(WorldChunk.class)
|
||||
public abstract class WorldChunk_movableTEMixin implements WorldChunkInterface
|
||||
public abstract class WorldChunk_movableTEMixin extends Chunk implements WorldChunkInterface
|
||||
{
|
||||
@Shadow
|
||||
@Final
|
||||
private ChunkSection[] sections;
|
||||
@Shadow
|
||||
@Final
|
||||
private Map<Heightmap.Type, Heightmap> heightmaps;
|
||||
@Shadow
|
||||
private boolean shouldSave;
|
||||
@Shadow
|
||||
@Final
|
||||
private World world;
|
||||
|
||||
World world;
|
||||
|
||||
public WorldChunk_movableTEMixin(ChunkPos chunkPos, UpgradeData upgradeData, HeightLimitView heightLimitView, Registry<Biome> registry, long l, @Nullable ChunkSection[] chunkSections, TickScheduler<Block> tickScheduler, TickScheduler<Fluid> tickScheduler2)
|
||||
{
|
||||
super(chunkPos, upgradeData, heightLimitView, registry, l, chunkSections, tickScheduler, tickScheduler2);
|
||||
}
|
||||
|
||||
@Shadow
|
||||
/* @Nullable */
|
||||
public abstract BlockEntity getBlockEntity(BlockPos blockPos_1, WorldChunk.CreationType worldChunk$CreationType_1);
|
||||
|
||||
@Shadow protected abstract <T extends BlockEntity> void updateTicker(T blockEntity);
|
||||
|
||||
@Shadow public abstract void addBlockEntity(BlockEntity blockEntity);
|
||||
|
||||
// Fix Failure: If a moving BlockEntity is placed while BlockEntities are ticking, this will not find it and then replace it with a new TileEntity!
|
||||
// blockEntity_2 = this.getBlockEntity(blockPos_1, WorldChunk.CreationType.CHECK);
|
||||
// question is - with the changes in the BE handling this might not be a case anymore
|
||||
@@ -70,23 +73,20 @@ public abstract class WorldChunk_movableTEMixin implements WorldChunkInterface
|
||||
* @author 2No2Name
|
||||
*/
|
||||
/* @Nullable */
|
||||
// todo update me to the new version
|
||||
public BlockState setBlockStateWithBlockEntity(BlockPos blockPos_1, BlockState newBlockState, BlockEntity newBlockEntity,
|
||||
boolean boolean_1)
|
||||
{
|
||||
int x = blockPos_1.getX() & 15;
|
||||
int y = blockPos_1.getY();
|
||||
int z = blockPos_1.getZ() & 15;
|
||||
int section = world.getSectionIndex(y);
|
||||
ChunkSection chunkSection = this.sections[section];
|
||||
if (chunkSection == EMPTY_SECTION)
|
||||
ChunkSection chunkSection = this.getSection(this.getSectionIndex(y));
|
||||
if (chunkSection.isEmpty())
|
||||
{
|
||||
if (newBlockState.isAir())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
chunkSection = new ChunkSection(ChunkSectionPos.getSectionCoord(y));
|
||||
this.sections[section] = chunkSection;
|
||||
}
|
||||
|
||||
boolean boolean_2 = chunkSection.isEmpty();
|
||||
@@ -99,10 +99,10 @@ public abstract class WorldChunk_movableTEMixin implements WorldChunkInterface
|
||||
{
|
||||
Block newBlock = newBlockState.getBlock();
|
||||
Block oldBlock = oldBlockState.getBlock();
|
||||
((Heightmap) this.heightmaps.get(Heightmap.Type.MOTION_BLOCKING)).trackUpdate(x, y, z, newBlockState);
|
||||
((Heightmap) this.heightmaps.get(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES)).trackUpdate(x, y, z, newBlockState);
|
||||
((Heightmap) this.heightmaps.get(Heightmap.Type.OCEAN_FLOOR)).trackUpdate(x, y, z, newBlockState);
|
||||
((Heightmap) this.heightmaps.get(Heightmap.Type.WORLD_SURFACE)).trackUpdate(x, y, z, newBlockState);
|
||||
((Heightmap) this.field_34541.get(Heightmap.Type.MOTION_BLOCKING)).trackUpdate(x, y, z, newBlockState);
|
||||
((Heightmap) this.field_34541.get(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES)).trackUpdate(x, y, z, newBlockState);
|
||||
((Heightmap) this.field_34541.get(Heightmap.Type.OCEAN_FLOOR)).trackUpdate(x, y, z, newBlockState);
|
||||
((Heightmap) this.field_34541.get(Heightmap.Type.WORLD_SURFACE)).trackUpdate(x, y, z, newBlockState);
|
||||
boolean boolean_3 = chunkSection.isEmpty();
|
||||
if (boolean_2 != boolean_3)
|
||||
{
|
||||
@@ -156,7 +156,7 @@ public abstract class WorldChunk_movableTEMixin implements WorldChunkInterface
|
||||
newBlockState.onBlockAdded(this.world, blockPos_1, oldBlockState, boolean_1); //This can call setblockstate! (e.g. hopper does)
|
||||
}
|
||||
|
||||
this.shouldSave = true;
|
||||
this.field_34537 = true; // shouldSave
|
||||
return oldBlockState;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user