mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 11:25:55 +03:00
155 lines
7.8 KiB
Diff
155 lines
7.8 KiB
Diff
--- ../src-base/minecraft/net/minecraft/world/gen/structure/template/Template.java
|
|
+++ ../src-work/minecraft/net/minecraft/world/gen/structure/template/Template.java
|
|
@@ -38,8 +38,8 @@
|
|
|
|
public class Template
|
|
{
|
|
- private final List<Template.BlockInfo> blocks = Lists.<Template.BlockInfo>newArrayList();
|
|
- private final List<Template.EntityInfo> entities = Lists.<Template.EntityInfo>newArrayList();
|
|
+ private final List<BlockInfo> blocks = Lists.<BlockInfo>newArrayList();
|
|
+ private final List<EntityInfo> entities = Lists.<EntityInfo>newArrayList();
|
|
private BlockPos size = BlockPos.ORIGIN;
|
|
private String author = "?";
|
|
|
|
@@ -63,9 +63,9 @@
|
|
if (endPos.getX() >= 1 && endPos.getY() >= 1 && endPos.getZ() >= 1)
|
|
{
|
|
BlockPos blockpos = startPos.add(endPos).add(-1, -1, -1);
|
|
- List<Template.BlockInfo> list = Lists.<Template.BlockInfo>newArrayList();
|
|
- List<Template.BlockInfo> list1 = Lists.<Template.BlockInfo>newArrayList();
|
|
- List<Template.BlockInfo> list2 = Lists.<Template.BlockInfo>newArrayList();
|
|
+ List<BlockInfo> list = Lists.<BlockInfo>newArrayList();
|
|
+ List<BlockInfo> list1 = Lists.<BlockInfo>newArrayList();
|
|
+ List<BlockInfo> list2 = Lists.<BlockInfo>newArrayList();
|
|
BlockPos blockpos1 = new BlockPos(Math.min(startPos.getX(), blockpos.getX()), Math.min(startPos.getY(), blockpos.getY()), Math.min(startPos.getZ(), blockpos.getZ()));
|
|
BlockPos blockpos2 = new BlockPos(Math.max(startPos.getX(), blockpos.getX()), Math.max(startPos.getY(), blockpos.getY()), Math.max(startPos.getZ(), blockpos.getZ()));
|
|
this.size = endPos;
|
|
@@ -85,15 +85,15 @@
|
|
nbttagcompound.removeTag("x");
|
|
nbttagcompound.removeTag("y");
|
|
nbttagcompound.removeTag("z");
|
|
- list1.add(new Template.BlockInfo(blockpos3, iblockstate, nbttagcompound));
|
|
+ list1.add(new BlockInfo(blockpos3, iblockstate, nbttagcompound));
|
|
}
|
|
else if (!iblockstate.isFullBlock() && !iblockstate.isFullCube())
|
|
{
|
|
- list2.add(new Template.BlockInfo(blockpos3, iblockstate, (NBTTagCompound)null));
|
|
+ list2.add(new BlockInfo(blockpos3, iblockstate, (NBTTagCompound)null));
|
|
}
|
|
else
|
|
{
|
|
- list.add(new Template.BlockInfo(blockpos3, iblockstate, (NBTTagCompound)null));
|
|
+ list.add(new BlockInfo(blockpos3, iblockstate, (NBTTagCompound)null));
|
|
}
|
|
}
|
|
}
|
|
@@ -141,7 +141,7 @@
|
|
blockpos = new BlockPos(vec3d);
|
|
}
|
|
|
|
- this.entities.add(new Template.EntityInfo(vec3d, blockpos, nbttagcompound));
|
|
+ this.entities.add(new EntityInfo(vec3d, blockpos, nbttagcompound));
|
|
}
|
|
}
|
|
|
|
@@ -150,7 +150,7 @@
|
|
Map<BlockPos, String> map = Maps.<BlockPos, String>newHashMap();
|
|
StructureBoundingBox structureboundingbox = placementIn.getBoundingBox();
|
|
|
|
- for (Template.BlockInfo template$blockinfo : this.blocks)
|
|
+ for (BlockInfo template$blockinfo : this.blocks)
|
|
{
|
|
BlockPos blockpos = transformedBlockPos(placementIn, template$blockinfo.pos).add(pos);
|
|
|
|
@@ -208,11 +208,12 @@
|
|
Block block = placementIn.getReplacedBlock();
|
|
StructureBoundingBox structureboundingbox = placementIn.getBoundingBox();
|
|
|
|
- for (Template.BlockInfo template$blockinfo : this.blocks)
|
|
+ for (BlockInfo template$blockinfo : this.blocks)
|
|
{
|
|
BlockPos blockpos = transformedBlockPos(placementIn, template$blockinfo.pos).add(pos);
|
|
- Template.BlockInfo template$blockinfo1 = templateProcessor != null ? templateProcessor.processBlock(worldIn, blockpos, template$blockinfo) : template$blockinfo;
|
|
-
|
|
+ BlockInfo template$blockinfo1 = templateProcessor != null ? templateProcessor.processBlock(worldIn, blockpos, template$blockinfo) : template$blockinfo;
|
|
+ // Forge: skip processing blocks outside BB to prevent cascading worldgen issues
|
|
+ if (structureboundingbox != null && !structureboundingbox.isVecInside(blockpos)) continue;
|
|
if (template$blockinfo1 != null)
|
|
{
|
|
Block block1 = template$blockinfo1.blockState.getBlock();
|
|
@@ -255,7 +256,7 @@
|
|
}
|
|
}
|
|
|
|
- for (Template.BlockInfo template$blockinfo2 : this.blocks)
|
|
+ for (BlockInfo template$blockinfo2 : this.blocks)
|
|
{
|
|
if (block == null || block != template$blockinfo2.blockState.getBlock())
|
|
{
|
|
@@ -287,7 +288,7 @@
|
|
|
|
private void addEntitiesToWorld(World worldIn, BlockPos pos, Mirror mirrorIn, Rotation rotationIn, @Nullable StructureBoundingBox aabb)
|
|
{
|
|
- for (Template.EntityInfo template$entityinfo : this.entities)
|
|
+ for (EntityInfo template$entityinfo : this.entities)
|
|
{
|
|
BlockPos blockpos = transformedBlockPos(template$entityinfo.blockPos, mirrorIn, rotationIn).add(pos);
|
|
|
|
@@ -474,10 +475,10 @@
|
|
|
|
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
|
|
{
|
|
- Template.BasicPalette template$basicpalette = new Template.BasicPalette();
|
|
+ BasicPalette template$basicpalette = new BasicPalette();
|
|
NBTTagList nbttaglist = new NBTTagList();
|
|
|
|
- for (Template.BlockInfo template$blockinfo : this.blocks)
|
|
+ for (BlockInfo template$blockinfo : this.blocks)
|
|
{
|
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
|
nbttagcompound.setTag("pos", this.writeInts(template$blockinfo.pos.getX(), template$blockinfo.pos.getY(), template$blockinfo.pos.getZ()));
|
|
@@ -493,7 +494,7 @@
|
|
|
|
NBTTagList nbttaglist1 = new NBTTagList();
|
|
|
|
- for (Template.EntityInfo template$entityinfo : this.entities)
|
|
+ for (EntityInfo template$entityinfo : this.entities)
|
|
{
|
|
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
|
nbttagcompound1.setTag("pos", this.writeDoubles(template$entityinfo.pos.x, template$entityinfo.pos.y, template$entityinfo.pos.z));
|
|
@@ -514,6 +515,7 @@
|
|
nbttaglist2.appendTag(NBTUtil.writeBlockState(new NBTTagCompound(), iblockstate));
|
|
}
|
|
|
|
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().getDataFixer().writeVersionData(nbt); //Moved up for MC updating reasons.
|
|
nbt.setTag("palette", nbttaglist2);
|
|
nbt.setTag("blocks", nbttaglist);
|
|
nbt.setTag("entities", nbttaglist1);
|
|
@@ -530,7 +532,7 @@
|
|
NBTTagList nbttaglist = compound.getTagList("size", 3);
|
|
this.size = new BlockPos(nbttaglist.getIntAt(0), nbttaglist.getIntAt(1), nbttaglist.getIntAt(2));
|
|
this.author = compound.getString("author");
|
|
- Template.BasicPalette template$basicpalette = new Template.BasicPalette();
|
|
+ BasicPalette template$basicpalette = new BasicPalette();
|
|
NBTTagList nbttaglist1 = compound.getTagList("palette", 10);
|
|
|
|
for (int i = 0; i < nbttaglist1.tagCount(); ++i)
|
|
@@ -557,7 +559,7 @@
|
|
nbttagcompound1 = null;
|
|
}
|
|
|
|
- this.blocks.add(new Template.BlockInfo(blockpos, iblockstate, nbttagcompound1));
|
|
+ this.blocks.add(new BlockInfo(blockpos, iblockstate, nbttagcompound1));
|
|
}
|
|
|
|
NBTTagList nbttaglist4 = compound.getTagList("entities", 10);
|
|
@@ -573,7 +575,7 @@
|
|
if (nbttagcompound3.hasKey("nbt"))
|
|
{
|
|
NBTTagCompound nbttagcompound2 = nbttagcompound3.getCompoundTag("nbt");
|
|
- this.entities.add(new Template.EntityInfo(vec3d, blockpos1, nbttagcompound2));
|
|
+ this.entities.add(new EntityInfo(vec3d, blockpos1, nbttagcompound2));
|
|
}
|
|
}
|
|
}
|