diff --git a/carpetmodSrc/carpet/CarpetSettings.java b/carpetmodSrc/carpet/CarpetSettings.java index ec06d92..d6a1e52 100644 --- a/carpetmodSrc/carpet/CarpetSettings.java +++ b/carpetmodSrc/carpet/CarpetSettings.java @@ -23,6 +23,7 @@ import carpet.helpers.RandomTickOptimization; import carpet.helpers.ScoreboardDelta; import carpet.patches.BlockWool; +import carpet.prometheus.PrometheusExtension; import carpet.utils.TickingArea; import carpet.worldedit.WorldEditBridge; import net.minecraft.block.BlockFalling; @@ -43,7 +44,7 @@ public class CarpetSettings { public static boolean locked = false; - public static final String carpetVersion = "v22_01_27"; + public static final String carpetVersion = "v22_02_09"; public static final String minecraftVersion = "1.12.2"; public static final String mcpMappings = "39-1.12"; @@ -623,7 +624,7 @@ private static boolean validateBlockEventSerializer(boolean value) { @Rule(desc = "Redstone dust algorithm", category = {EXPERIMENTAL, OPTIMIZATIONS}, extra = { "Fast redstone dust by Theosib", "Random redstone dust to test if your contraption is locational", - "Modern aims to mimic 1.15's signal decrement to improve lag efficiencya" + "Modern aims to mimic 1.15's signal decrement to improve lag efficiency" }) public static RedstoneDustAlgorithm redstoneDustAlgorithm = RedstoneDustAlgorithm.vanilla; @@ -668,8 +669,8 @@ public static enum RedstoneDustAlgorithm { }) public static boolean boundingBoxFix = false; - @Rule(desc = "Blocks inherit the original light opacity and light values while being pushed with a piston", category = OPTIMIZATIONS) - public static boolean movingBlockLightOptimization = false; + /*@Rule(desc = "Blocks inherit the original light opacity and light values while being pushed with a piston", category = OPTIMIZATIONS) + public static boolean movingBlockLightOptimization = false; Deleted by xcom/2no2name*/ @Rule(desc = "Chunk saving issues that causes entites and blocks to duplicate or disappear", category = FIX, extra = "By Theosib") @BugFixDefault @@ -1135,7 +1136,6 @@ private static boolean validateDoorCheckOptimization(boolean value) { category = {CREATIVE, EXPERIMENTAL, BULLET} ) public static boolean extremeBehaviours; - // ===== API ===== // /** diff --git a/carpetmodSrc/carpet/commands/CarpetCommands.java b/carpetmodSrc/carpet/commands/CarpetCommands.java index d22e44d..3ab99d6 100644 --- a/carpetmodSrc/carpet/commands/CarpetCommands.java +++ b/carpetmodSrc/carpet/commands/CarpetCommands.java @@ -28,6 +28,7 @@ public static void register(CommandHandler handler) { handler.registerCommand(new CommandLight()); handler.registerCommand(new CommandLoadedChunks()); handler.registerCommand(new CommandLog()); + handler.registerCommand(new CommandPalette()); handler.registerCommand(new CommandPerimeter()); handler.registerCommand(new CommandPing()); handler.registerCommand(new CommandPlayer()); diff --git a/carpetmodSrc/carpet/commands/CommandPalette.java b/carpetmodSrc/carpet/commands/CommandPalette.java new file mode 100644 index 0000000..42e30a6 --- /dev/null +++ b/carpetmodSrc/carpet/commands/CommandPalette.java @@ -0,0 +1,300 @@ +package carpet.commands; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockColored; +import net.minecraft.block.state.IBlockState; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.init.Blocks; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BitArray; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.world.World; +import net.minecraft.world.chunk.*; +import net.minecraft.world.chunk.storage.ExtendedBlockStorage; + +import javax.annotation.Nullable; +import java.util.*; + +public class CommandPalette extends CommandCarpetBase { + /** + * Gets the name of the command + */ + + public String getUsage(ICommandSender sender) { + return "Usage: palette <4-8 | 13>"; + } + + public String getName() { + return "palette"; + } + + /** + * Callback for when the command is executed + */ + public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { + if (!command_enabled("commandChunk", sender)) return; + + try { + BlockPos pos = new BlockPos(sender.getPosition().getX(), sender.getPosition().getY(), sender.getPosition().getZ()); + if (args.length < 4 && args[0].equals("posInfo")) { + throw new WrongUsageException(getUsage(sender)); + } else if (args.length >= 4) { + pos = parseBlockPos(sender, args, 1, false); + } + World world = sender.getEntityWorld(); + Chunk chunk = world.getChunk(pos); + ExtendedBlockStorage[] list = chunk.getBlockStorageArray(); + int h = pos.getY() >> 4; + if (h < 0) h = 0; + if (h > 15) h = 15; + ExtendedBlockStorage ebs = list[h]; + BlockStateContainer bsc = ebs.getBlockStateContainer(); + int bits = bsc.getBits(); + + switch (args[0]) { + case "bits": + sender.sendMessage(new TextComponentString("Palette bit size: " + bits)); + return; + case "size": + getSize(sender, bsc); + return; + case "posInfo": + boolean isFull = false; + if (args.length >= 5) isFull = args[4].equals("full"); + Block block = null; + if (args.length >= 6) block = CommandBase.getBlockByText(sender, args[5]); + IBlockState iblockstate = null; + if (args.length >= 7 && block != null) { + iblockstate = convertArgToBlockState(block, args[6]); + } else if (block != null) { + iblockstate = block.getDefaultState(); + } + infoPalette(sender, bsc, pos, isFull, iblockstate); + return; + case "fill": + int bitSize = -1; + int type = 1; + if (args.length >= 5) type = args[4].equals("full") ? 2 : 1; + if (args.length >= 6) bitSize = parseInt(args[5]); + fill(sender, bsc, pos, type, bitSize); + return; + default: + throw new WrongUsageException(getUsage(sender)); + + } + } catch (Exception e) { + e.printStackTrace(); + throw new WrongUsageException(getUsage(sender)); + } + } + + private static IBlockState[] backup = null; + private static HashMap tileEntityList = new HashMap<>(); + + private static void fill(ICommandSender sender, BlockStateContainer bsc, BlockPos pos, int type, int bitSize) { + if (type != 3 && backup != null) type = 3; + + if (bitSize < 1 || bitSize > 64) bitSize = bsc.getStorage().getBitsPerEntry(); + + BlockPos basePos = new BlockPos(pos.getX() >>> 4 << 4, pos.getY() >>> 4 << 4, pos.getZ() >>> 4 << 4); + int color = -1; + int storeJ = -1; + if (type != 3) { + backup = new IBlockState[4096]; + } + HashSet backupSet = new HashSet<>(); + for (int i = 0; i < 4096; i++) { + BlockPos set = getBlockIndex(i, basePos); + if (type == 1) { + int j = i * bitSize / 64; + int k = ((i + 1) * bitSize - 1) / 64; + + if (j != k) { + backup[i] = sender.getEntityWorld().getBlockState(set); + TileEntity te = sender.getEntityWorld().getTileEntity(set); + if (te != null) { + tileEntityList.put(set, te); + sender.getEntityWorld().removeTileEntity(set); + } + sender.getEntityWorld().setBlockState(set, Blocks.GLASS.getDefaultState(), 128); + } + } else if (type == 2) { + backup[i] = sender.getEntityWorld().getBlockState(set); + TileEntity te = sender.getEntityWorld().getTileEntity(set); + if (te != null) { + tileEntityList.put(set, te); + sender.getEntityWorld().removeTileEntity(set); + } + set = getBlockIndex(i, basePos); + int j = i * bitSize / 64; + int k = ((i + 1) * bitSize - 1) / 64; + + if (j != storeJ) { + storeJ = j; + color = (color + 1) & 15; + } + + if (j != k) { + sender.getEntityWorld().setBlockState(set, Blocks.GLASS.getDefaultState(), 128); + } else { + sender.getEntityWorld().setBlockState(set, Blocks.STAINED_GLASS.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.byMetadata(color)), 128); + } + } else if (type == 3) { + if (backup[i] != null && !backupSet.contains(set)) { + backupSet.add(set); + sender.getEntityWorld().setBlockState(set, backup[i], 128); + TileEntity te = tileEntityList.get(set); + if (te != null) { + sender.getEntityWorld().removeTileEntity(set); + te.validate(); + sender.getEntityWorld().setTileEntity(set, te); + } + } + } + } + if (type == 3) { + backup = null; + tileEntityList.clear(); + } + } + + private void infoPalette(ICommandSender sender, BlockStateContainer bsc, BlockPos pos, boolean full, IBlockState blockState) { + BitArray bArray = bsc.getStorage(); + int bits = bArray.getBitsPerEntry(); + int index = getIndex(pos); + int i = index * bits; + int j = i / 64; + int k = ((index + 1) * bits - 1) / 64; + int l = i % 64; + long[] longArray = bArray.getBackingLongArray(); + + if (j == k) { + displayJKBits(sender, longArray[j], l, l + bits - 1, ""); + if (full) { + for (BlockPos bp : getArrayFromJK(j, k, bits, pos)) { + sender.sendMessage(new TextComponentString(bp.toString())); + } + } + } else { + displayJKBits(sender, longArray[j], l, 64, "1"); + displayJKBits(sender, longArray[k], 0, (l + bits - 1) % 64, "2"); + if (full) { + for (BlockPos bp : getArrayFromJK(j, k, bits, pos)) { + sender.sendMessage(new TextComponentString(bp.toString())); + } + } + } + if (blockState != null && bsc.getPalette() instanceof BlockStatePaletteRegistry && j != k) { + int blockStateBits = Block.BLOCK_STATE_IDS.get(blockState); + int leftBits = 64 - l; + int rightBits = bits - leftBits; + int leftMask = (1 << leftBits) - 1; + int rightMask = ((1 << rightBits) - 1) << leftBits; + int blockStateMaskL = blockStateBits & leftMask; + int blockStateMaskR = blockStateBits & rightMask; + sender.sendMessage(new TextComponentString("Left bit match:")); + for (int itr = 0; itr < Block.BLOCK_STATE_IDS.size(); itr++) { + IBlockState ibs = Block.BLOCK_STATE_IDS.getByValue(itr); + if (ibs != null) { + int left = itr & leftMask; + if (left == blockStateMaskL) { + String s = String.format("%" + bits + "s", Integer.toBinaryString(itr)).replace(' ', '0') + " " + ibs.toString().replace("minecraft:", ""); + sender.sendMessage(new TextComponentString(s)); + } + } + } + sender.sendMessage(new TextComponentString("Right bit match:")); + for (int itr = 0; itr < Block.BLOCK_STATE_IDS.size(); itr++) { + IBlockState ibs = Block.BLOCK_STATE_IDS.getByValue(itr); + if (ibs != null) { + int right = itr & rightMask; + if (right == blockStateMaskR) { + String s = String.format("%" + bits + "s", Integer.toBinaryString(itr)).replace(' ', '0') + " " + ibs.toString().replace("minecraft:", ""); + sender.sendMessage(new TextComponentString(s)); + } + } + } + } else if (blockState != null && j != k) { + sender.sendMessage(new TextComponentString("This location doesn't share two bit arrays.")); + } else if (blockState != null && bsc.getPalette() instanceof BlockStatePaletteRegistry) { + sender.sendMessage(new TextComponentString("This subchunk doesn't have enough palettes, add more palettes.")); + } + } + + private static void displayJKBits(ICommandSender sender, long longString, long l1, long l2, String append) { + StringBuilder sb = new StringBuilder(); + + String add = "§f"; + for (int bitNum = 0; bitNum < 64; bitNum++) { + char s = (longString & 1) == 1 ? '1' : '0'; + longString = longString >> 1; + if (bitNum == l1) add = "§c"; + sb.append(add + s); + if (bitNum == l2) add = "§f"; + } + sender.sendMessage(new TextComponentString("§8L" + append + ":" + sb)); + } + + private static BlockPos[] getArrayFromJK(int j, int k, int bits, BlockPos pos) { + BlockPos basePos = new BlockPos(pos.getX() >>> 4 << 4, pos.getY() >>> 4 << 4, pos.getZ() >>> 4 << 4); + ArrayList list = new ArrayList<>(); + for (int index = 0; index < 4096; index++) { + int i = index * bits; + int jj = i / 64; + int kk = ((index + 1) * bits - 1) / 64; + if (jj == j || kk == k || jj == k || kk == j) { + list.add(getBlockIndex(index, basePos)); + } + } + return list.toArray(new BlockPos[0]); + } + + private static int getIndex(BlockPos pos) { + int x = pos.getX() & 15; + int y = pos.getY() & 15; + int z = pos.getZ() & 15; + + return y << 8 | z << 4 | x; + } + + private static BlockPos getBlockIndex(int index, BlockPos pos) { + int x = (pos.getX() & ~0xF) | (index & 0xF); + int y = (pos.getY() & ~0xF) | ((index >>> 8) & 0xF); + int z = (pos.getZ() & ~0xF) | ((index >>> 4) & 0xF); + + return new BlockPos(x, y, z); + } + + private void getSize(ICommandSender sender, BlockStateContainer bsc) { + IBlockStatePalette ibsp = bsc.getPalette(); + if (ibsp instanceof BlockStatePaletteLinear) { + sender.sendMessage(new TextComponentString("Palette size: " + ((BlockStatePaletteLinear) ibsp).paletteSize())); + } else if (ibsp instanceof BlockStatePaletteHashMap) { + sender.sendMessage(new TextComponentString("Palette size: " + ((BlockStatePaletteHashMap) ibsp).paletteSize())); + } else if (ibsp instanceof BlockStatePaletteRegistry) { + sender.sendMessage(new TextComponentString("Palette size MAX aka " + Block.BLOCK_STATE_IDS.size())); + } + } + + public List getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos) { + if (args.length == 1) { + return getListOfStringsMatchingLastWord(args, "bits", "size", "posInfo", "fill"); + } else if (args.length >= 2 && args.length <= 4) { + return getTabCompletionCoordinate(args, 1, targetPos); + } else if (args.length == 5 && (args[0].equals("posInfo") || args[0].equals("fill"))) { + return getListOfStringsMatchingLastWord(args, "full", "normal"); + } else if (args.length == 6 && args[0].equals("fill")) { + return getListOfStringsMatchingLastWord(args, "4", "5", "6", "7", "8", "13"); + } else if (args.length == 6 && args[0].equals("posInfo")) { + return getListOfStringsMatchingLastWord(args, Block.REGISTRY.getKeys()); + } else { + return Collections.emptyList(); + } + } +} \ No newline at end of file diff --git a/patches/net/minecraft/block/BlockPistonBase.java.patch b/patches/net/minecraft/block/BlockPistonBase.java.patch index 89aa2ee..e6e295e 100644 --- a/patches/net/minecraft/block/BlockPistonBase.java.patch +++ b/patches/net/minecraft/block/BlockPistonBase.java.patch @@ -77,27 +77,27 @@ + { + p_176316_1_.func_180501_a(p_176316_2_, p_176316_3_.func_177226_a(field_176320_b, Boolean.valueOf(false)), 2); + } -+ ++ + // [CM] Piston ghost blocks fix - start + int suppress_move = 0; + if (CarpetSettings.pistonGhostBlocksFix == CarpetSettings.PistonGhostBlocksFix.clientAndServer) + { + final EnumFacing facing = p_176316_3_.func_177229_b(field_176387_N); -+ ++ + final BlockPos blockpos = new BlockPos(p_176316_2_).func_177967_a(facing, 2); + final IBlockState iblockstate = p_176316_1_.func_180495_p(blockpos); -+ ++ + if (iblockstate.func_177230_c() == Blocks.field_180384_M) + { + final TileEntity tileentity = p_176316_1_.func_175625_s(blockpos); -+ ++ + if (tileentity instanceof TileEntityPiston) + { + final TileEntityPiston tileentitypiston = (TileEntityPiston) tileentity; + if (tileentitypiston.func_174930_e() == facing && tileentitypiston.func_145868_b() -+ && (tileentitypiston.field_145870_n < 0.5F -+ || tileentitypiston.func_145831_w().func_82737_E() == tileentitypiston.lastTicked -+ || !((WorldServer) p_176316_1_).haveBlockActionsProcessed())) ++ && (tileentitypiston.field_145870_n < 0.5F ++ || tileentitypiston.func_145831_w().func_82737_E() == tileentitypiston.lastTicked ++ || !((WorldServer) p_176316_1_).haveBlockActionsProcessed())) + { + suppress_move = 16; + } @@ -114,16 +114,16 @@ - private boolean func_176318_b(World p_176318_1_, BlockPos p_176318_2_, EnumFacing p_176318_3_) + /* + * This if statement checks if the the pulling block (block that is 2 blocks infront of the extended piston) -+ * is a non-moving block and returns a meta value of 16 so it can tell the client to ignore pulling blocks ++ * is a non-moving block and returns a meta value of 16 so it can tell the client to ignore pulling blocks + * even if the client can pull them. CARPET-XCOM + */ + private int ignoreMovingBlockMeta(World worldIn, BlockPos pos, EnumFacing enumfacing) { + BlockPos blockpos = pos.func_177982_a(enumfacing.func_82601_c() * 2, enumfacing.func_96559_d() * 2, enumfacing.func_82599_e() * 2); + IBlockState iblockstate = worldIn.func_180495_p(blockpos); + Block block = iblockstate.func_177230_c(); -+ ++ + if (block == Blocks.field_180384_M) return 16; -+ ++ + return 0; + } + @@ -144,16 +144,14 @@ BlockPos blockpos = p_176318_2_.func_177984_a(); for (EnumFacing enumfacing1 : EnumFacing.values()) -@@ -240,7 +317,11 @@ - } +@@ -241,6 +318,10 @@ } } -- -+ + + // [CM] Piston ghost blocks fix + if ((p_189539_5_ & 16) == 16 && CarpetSettings.pistonGhostBlocksFix == CarpetSettings.PistonGhostBlocksFix.clientAndServer) + flag1 = true; -+ ++ if (!flag1 && iblockstate.func_185904_a() != Material.field_151579_a && func_185646_a(iblockstate, p_189539_2_, blockpos, enumfacing.func_176734_d(), false, enumfacing) && (iblockstate.func_185905_o() == EnumPushReaction.NORMAL || block == Blocks.field_150331_J || block == Blocks.field_150320_F)) { this.func_176319_a(p_189539_2_, p_189539_3_, enumfacing, false); @@ -174,21 +172,21 @@ } else { -@@ -319,6 +408,14 @@ - return false; +@@ -320,6 +409,14 @@ } } -+ + + // Movable Tile entity fix CARPET-2No2Name + private static boolean isPushableTileEntityBlock(Block block) + { + //Making PISTON_EXTENSION (BlockPistonMoving) pushable would not work as its createNewTileEntity()-method returns null + return block != Blocks.field_150477_bB && block != Blocks.field_150381_bn && block != Blocks.field_185775_db -+ && block != Blocks.field_150384_bq && block != Blocks.field_150474_ac && block != Blocks.field_180384_M; ++ && block != Blocks.field_150384_bq && block != Blocks.field_150474_ac && block != Blocks.field_180384_M; + } - ++ private boolean func_176319_a(World p_176319_1_, BlockPos p_176319_2_, EnumFacing p_176319_3_, boolean p_176319_4_) { + if (!p_176319_4_) @@ -342,6 +439,7 @@ { BlockPos blockpos = list.get(i); @@ -197,12 +195,11 @@ } List list2 = blockpistonstructurehelper.func_177252_d(); -@@ -358,15 +456,70 @@ - --k; +@@ -359,14 +457,49 @@ aiblockstate[k] = iblockstate; } -+ -+ // Movable Tile entity fix CARPET-2No2Name + ++ // Movable Tile entity fix CARPET-2No2Name + List list1_TileEntities = Lists.newArrayList(); + if(CarpetSettings.movableTileEntities || CarpetSettings.autocrafter){ + for (int i = 0; i < list.size(); ++i) @@ -210,7 +207,7 @@ + BlockPos blockpos = list.get(i); + TileEntity tileentity = p_176319_1_.func_175625_s(blockpos); + list1_TileEntities.add(tileentity); - ++ + if(tileentity != null) + { + p_176319_1_.func_175713_t(blockpos); @@ -218,7 +215,7 @@ + } + } + } -+ ++ for (int l = list.size() - 1; l >= 0; --l) { BlockPos blockpos3 = list.get(l); @@ -228,33 +225,11 @@ + } + // ----- RSMM End ----- // IBlockState iblockstate2 = p_176319_1_.func_180495_p(blockpos3); -- p_176319_1_.func_180501_a(blockpos3, Blocks.field_150350_a.func_176223_P(), 2); + p_176319_1_.func_180501_a(blockpos3, Blocks.field_150350_a.func_176223_P(), 2); blockpos3 = blockpos3.func_177972_a(enumfacing); -- p_176319_1_.func_180501_a(blockpos3, Blocks.field_180384_M.func_176223_P().func_177226_a(field_176387_N, p_176319_3_), 4); + p_176319_1_.func_180501_a(blockpos3, Blocks.field_180384_M.func_176223_P().func_177226_a(field_176387_N, p_176319_3_), 4); - p_176319_1_.func_175690_a(blockpos3, BlockPistonMoving.func_185588_a(list1.get(l), p_176319_3_, p_176319_4_, false)); -+ // Added the properties of opacity and light to the moving block as to minimize light updates. CARPET-XCOM -+ if(CarpetSettings.movingBlockLightOptimization){ -+ BlockPos posOld = list.get(l); -+ boolean remove = true; -+ for (int backwardCheck = l - 1; backwardCheck >= 0; --backwardCheck){ -+ BlockPos blockposCheck = list.get(backwardCheck); -+ if(blockposCheck.func_177972_a(enumfacing).equals(posOld)){ -+ remove = false; -+ break; -+ } -+ } -+ IBlockState iBlockState = Blocks.field_180384_M.func_176223_P().func_177226_a(field_176387_N, p_176319_3_) -+ .func_177226_a(BlockPistonMoving.OPACITY, Math.min(iblockstate2.func_185891_c(), 15)) -+ .func_177226_a(BlockPistonMoving.LIGHT, iblockstate2.func_185906_d()); -+ p_176319_1_.func_180501_a(blockpos3, iBlockState, 20); -+ if(remove){ -+ p_176319_1_.func_180501_a(posOld, Blocks.field_150350_a.func_176223_P(), 2); -+ } -+ p_176319_1_.func_190522_c(blockpos3, iBlockState.func_177230_c()); -+ }else{ -+ p_176319_1_.func_180501_a(list.get(l), Blocks.field_150350_a.func_176223_P(), 2); -+ p_176319_1_.func_180501_a(blockpos3, Blocks.field_180384_M.func_176223_P().func_177226_a(field_176387_N, p_176319_3_), 4); -+ } ++ + // Movable Tile entity fix CARPET-2No2Name + if(CarpetSettings.autocrafter && iblockstate2 instanceof BlockWorkbench){ + TileEntity tilePiston = BlockPistonMoving.func_185588_a(list1.get(l), p_176319_3_, p_176319_4_, false); @@ -271,7 +246,7 @@ --k; aiblockstate[k] = iblockstate2; } -@@ -397,6 +550,8 @@ +@@ -397,6 +530,8 @@ p_176319_1_.func_175685_c(blockpos2, Blocks.field_150332_K, false); } @@ -280,7 +255,7 @@ return true; } } -@@ -439,4 +594,9 @@ +@@ -439,4 +574,9 @@ p_193383_2_ = this.func_176221_a(p_193383_2_, p_193383_1_, p_193383_3_); return p_193383_2_.func_177229_b(field_176387_N) != p_193383_4_.func_176734_d() && ((Boolean)p_193383_2_.func_177229_b(field_176320_b)).booleanValue() ? BlockFaceShape.UNDEFINED : BlockFaceShape.SOLID; } diff --git a/patches/net/minecraft/block/BlockPistonMoving.java.patch b/patches/net/minecraft/block/BlockPistonMoving.java.patch deleted file mode 100644 index a6d32fc..0000000 --- a/patches/net/minecraft/block/BlockPistonMoving.java.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java -@@ -28,15 +28,21 @@ - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; - -+import net.minecraft.block.properties.PropertyInteger; -+ - public class BlockPistonMoving extends BlockContainer - { - public static final PropertyDirection field_176426_a = BlockPistonExtension.field_176387_N; - public static final PropertyEnum field_176425_b = BlockPistonExtension.field_176325_b; - -+ // Getting propertys from other sources as its apparently laggy to create your own. CARPET-XCOM -+ public static final PropertyInteger OPACITY = BlockDaylightDetector.field_176436_a; -+ public static final PropertyInteger LIGHT = BlockLiquid.field_176367_b; -+ - public BlockPistonMoving() - { - super(Material.field_76233_E); -- this.func_180632_j(this.field_176227_L.func_177621_b().func_177226_a(field_176426_a, EnumFacing.NORTH).func_177226_a(field_176425_b, BlockPistonExtension.EnumPistonType.DEFAULT)); -+ this.func_180632_j(this.field_176227_L.func_177621_b().func_177226_a(field_176426_a, EnumFacing.NORTH).func_177226_a(field_176425_b, BlockPistonExtension.EnumPistonType.DEFAULT).func_177226_a(OPACITY, 0).func_177226_a(LIGHT, 0)); - this.func_149711_c(-1.0F); - } - -@@ -207,11 +213,24 @@ - - protected BlockStateContainer func_180661_e() - { -- return new BlockStateContainer(this, new IProperty[] {field_176426_a, field_176425_b}); -+ // Adding the propertys to the list of allowed propertys. CARPET-XCOM -+ return new BlockStateContainer(this, new IProperty[] {field_176426_a, field_176425_b, OPACITY, LIGHT}); - } - - public BlockFaceShape func_193383_a(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) - { - return BlockFaceShape.UNDEFINED; - } -+ -+ // Grabbing the inherited properties from the parrent block that is moved and setting it to the moving block. CARPET-XCOM -+ @Override -+ public int func_149717_k(IBlockState state) -+ { -+ return state.func_177229_b(OPACITY); -+ } -+ @Override -+ public int func_149750_m(IBlockState state) -+ { -+ return state.func_177229_b(LIGHT); -+ } - } diff --git a/patches/net/minecraft/util/BitArray.java.patch b/patches/net/minecraft/util/BitArray.java.patch new file mode 100644 index 0000000..7a33b74 --- /dev/null +++ b/patches/net/minecraft/util/BitArray.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/util/BitArray.java ++++ ../src-work/minecraft/net/minecraft/util/BitArray.java +@@ -65,4 +65,11 @@ + { + return this.field_188148_d; + } ++ ++ public long getMaxEntryValue(){ ++ return field_188147_c; ++ } ++ public int getBitsPerEntry(){ ++ return field_188146_b; ++ } + } diff --git a/patches/net/minecraft/world/chunk/BlockStateContainer.java.patch b/patches/net/minecraft/world/chunk/BlockStateContainer.java.patch new file mode 100644 index 0000000..8584704 --- /dev/null +++ b/patches/net/minecraft/world/chunk/BlockStateContainer.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/BlockStateContainer.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/BlockStateContainer.java +@@ -146,4 +146,14 @@ + { + return 1 + this.field_186022_c.func_186040_a() + PacketBuffer.func_150790_a(this.field_186021_b.func_188144_b()) + this.field_186021_b.func_188143_a().length * 8; + } ++ ++ public BitArray getStorage(){ ++ return field_186021_b; ++ } ++ public IBlockStatePalette getPalette(){ ++ return field_186022_c; ++ } ++ public int getBits(){ ++ return field_186024_e; ++ } + } diff --git a/patches/net/minecraft/world/chunk/BlockStatePaletteHashMap.java.patch b/patches/net/minecraft/world/chunk/BlockStatePaletteHashMap.java.patch new file mode 100644 index 0000000..b802c78 --- /dev/null +++ b/patches/net/minecraft/world/chunk/BlockStatePaletteHashMap.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/BlockStatePaletteHashMap.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/BlockStatePaletteHashMap.java +@@ -64,4 +64,8 @@ + + return i; + } ++ ++ public int paletteSize(){ ++ return field_186046_a.func_186810_b(); ++ } + } diff --git a/patches/net/minecraft/world/chunk/BlockStatePaletteLinear.java.patch b/patches/net/minecraft/world/chunk/BlockStatePaletteLinear.java.patch new file mode 100644 index 0000000..3962115 --- /dev/null +++ b/patches/net/minecraft/world/chunk/BlockStatePaletteLinear.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/BlockStatePaletteLinear.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/BlockStatePaletteLinear.java +@@ -70,4 +70,8 @@ + + return i; + } ++ ++ public int paletteSize(){ ++ return field_186045_d; ++ } + } diff --git a/patches/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch b/patches/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch index f66168e..171aafb 100644 --- a/patches/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch +++ b/patches/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch @@ -14,12 +14,21 @@ public boolean func_76663_a() { - return this.field_76682_b == 0; -+ // NewLight PHIPRO-CARPET -+ if (CarpetSettings.newLight){ -+ return false; -+ }else{ -+ return this.field_76682_b == 0; -+ } ++ // NewLight PHIPRO-CARPET ++ if (CarpetSettings.newLight){ ++ return false; ++ }else{ ++ return this.field_76682_b == 0; ++ } } public boolean func_76675_b() +@@ -147,4 +154,8 @@ + { + this.field_76685_h = p_76666_1_; + } ++ ++ public BlockStateContainer getBlockStateContainer() { ++ return field_177488_d; ++ } + }