From 57b153f87e3751d3be444c360bdab61e464fd899 Mon Sep 17 00:00:00 2001 From: Dioswilson Date: Thu, 27 Jan 2022 17:42:01 -0300 Subject: [PATCH] Added "modern"as a redstoneDustAlgorithm option to reduce redstone dust lag, it should still work the same as vanilla, if you have any issues contact me --- carpetmodSrc/carpet/CarpetSettings.java | 5 +- .../block/BlockRedstoneWire.java.patch | 723 +++++++++++++++--- .../management/PlayerProfileCache.java.patch | 2 +- 3 files changed, 603 insertions(+), 127 deletions(-) diff --git a/carpetmodSrc/carpet/CarpetSettings.java b/carpetmodSrc/carpet/CarpetSettings.java index a14fb00..029eae1 100644 --- a/carpetmodSrc/carpet/CarpetSettings.java +++ b/carpetmodSrc/carpet/CarpetSettings.java @@ -622,12 +622,13 @@ 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" + "Random redstone dust to test if your contraption is locational", + "Modern aims to mimic 1.15's signal decrement to improve lag efficiency" }) public static RedstoneDustAlgorithm redstoneDustAlgorithm = RedstoneDustAlgorithm.vanilla; public static enum RedstoneDustAlgorithm { - vanilla, fast, random + vanilla, fast, random, modern, } @Rule(desc = "TNT causes less lag when exploding in the same spot and in liquids", category = TNT) diff --git a/patches/net/minecraft/block/BlockRedstoneWire.java.patch b/patches/net/minecraft/block/BlockRedstoneWire.java.patch index 7c026b3..ff7244a 100644 --- a/patches/net/minecraft/block/BlockRedstoneWire.java.patch +++ b/patches/net/minecraft/block/BlockRedstoneWire.java.patch @@ -1,56 +1,185 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java -@@ -1,5 +1,6 @@ +@@ -1,12 +1,15 @@ package net.minecraft.block; +import carpet.helpers.RedstoneOreRedirectHelper; import com.google.common.collect.Lists; import com.google.common.collect.Sets; ++ import java.util.EnumSet; -@@ -27,6 +28,10 @@ + import java.util.List; + import java.util.Random; + import java.util.Set; + import javax.annotation.Nullable; ++ + import net.minecraft.block.material.Material; + import net.minecraft.block.properties.IProperty; + import net.minecraft.block.properties.PropertyEnum; +@@ -27,61 +30,59 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +-public class BlockRedstoneWire extends Block +-{ +import carpet.CarpetSettings; +import carpet.helpers.RedstoneWireTurbo; ++ +import java.util.Collections; + - public class BlockRedstoneWire extends Block - { ++public class BlockRedstoneWire extends Block { public static final PropertyEnum field_176348_a = PropertyEnum.func_177709_a("north", BlockRedstoneWire.EnumAttachPosition.class); -@@ -35,9 +40,11 @@ + public static final PropertyEnum field_176347_b = PropertyEnum.func_177709_a("east", BlockRedstoneWire.EnumAttachPosition.class); + public static final PropertyEnum field_176349_M = PropertyEnum.func_177709_a("south", BlockRedstoneWire.EnumAttachPosition.class); public static final PropertyEnum field_176350_N = PropertyEnum.func_177709_a("west", BlockRedstoneWire.EnumAttachPosition.class); public static final PropertyInteger field_176351_O = PropertyInteger.func_177719_a("power", 0, 15); - protected static final AxisAlignedBB[] field_185700_f = new AxisAlignedBB[] {new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 0.8125D), new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 0.8125D), new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 1.0D), new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 0.8125D, 0.0625D, 0.8125D), new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 0.8125D, 0.0625D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.8125D, 0.0625D, 0.8125D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.8125D, 0.0625D, 1.0D), new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 1.0D, 0.0625D, 0.8125D), new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 1.0D, 0.0625D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 1.0D, 0.0625D, 0.8125D), new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 1.0D, 0.0625D, 1.0D), new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 1.0D, 0.0625D, 0.8125D), new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 1.0D, 0.0625D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.0625D, 0.8125D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.0625D, 1.0D)}; +- protected static final AxisAlignedBB[] field_185700_f = new AxisAlignedBB[] {new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 0.8125D), new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 0.8125D), new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 1.0D), new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 0.8125D, 0.0625D, 0.8125D), new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 0.8125D, 0.0625D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.8125D, 0.0625D, 0.8125D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.8125D, 0.0625D, 1.0D), new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 1.0D, 0.0625D, 0.8125D), new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 1.0D, 0.0625D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 1.0D, 0.0625D, 0.8125D), new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 1.0D, 0.0625D, 1.0D), new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 1.0D, 0.0625D, 0.8125D), new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 1.0D, 0.0625D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.0625D, 0.8125D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.0625D, 1.0D)}; - private boolean field_150181_a = true; ++ protected static final AxisAlignedBB[] field_185700_f = new AxisAlignedBB[]{new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 0.8125D), new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 0.8125D), new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 0.8125D, 0.0625D, 1.0D), new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 0.8125D, 0.0625D, 0.8125D), new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 0.8125D, 0.0625D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.8125D, 0.0625D, 0.8125D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.8125D, 0.0625D, 1.0D), new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 1.0D, 0.0625D, 0.8125D), new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 1.0D, 0.0625D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 1.0D, 0.0625D, 0.8125D), new AxisAlignedBB(0.0D, 0.0D, 0.1875D, 1.0D, 0.0625D, 1.0D), new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 1.0D, 0.0625D, 0.8125D), new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 1.0D, 0.0625D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.0625D, 0.8125D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.0625D, 1.0D)}; + public boolean field_150181_a = true; private final Set field_150179_b = Sets.newHashSet(); +- public BlockRedstoneWire() +- { + RedstoneWireTurbo turbo = new RedstoneWireTurbo(this); + - public BlockRedstoneWire() - { ++ public BlockRedstoneWire() { super(Material.field_151594_q); -@@ -142,21 +149,26 @@ + this.func_180632_j(this.field_176227_L.func_177621_b().func_177226_a(field_176348_a, BlockRedstoneWire.EnumAttachPosition.NONE).func_177226_a(field_176347_b, BlockRedstoneWire.EnumAttachPosition.NONE).func_177226_a(field_176349_M, BlockRedstoneWire.EnumAttachPosition.NONE).func_177226_a(field_176350_N, BlockRedstoneWire.EnumAttachPosition.NONE).func_177226_a(field_176351_O, Integer.valueOf(0))); + } + +- public AxisAlignedBB func_185496_a(IBlockState p_185496_1_, IBlockAccess p_185496_2_, BlockPos p_185496_3_) +- { ++ public AxisAlignedBB func_185496_a(IBlockState p_185496_1_, IBlockAccess p_185496_2_, BlockPos p_185496_3_) { + return field_185700_f[func_185699_x(p_185496_1_.func_185899_b(p_185496_2_, p_185496_3_))]; + } + +- private static int func_185699_x(IBlockState p_185699_0_) +- { ++ private static int func_185699_x(IBlockState p_185699_0_) { + int i = 0; + boolean flag = p_185699_0_.func_177229_b(field_176348_a) != BlockRedstoneWire.EnumAttachPosition.NONE; + boolean flag1 = p_185699_0_.func_177229_b(field_176347_b) != BlockRedstoneWire.EnumAttachPosition.NONE; + boolean flag2 = p_185699_0_.func_177229_b(field_176349_M) != BlockRedstoneWire.EnumAttachPosition.NONE; + boolean flag3 = p_185699_0_.func_177229_b(field_176350_N) != BlockRedstoneWire.EnumAttachPosition.NONE; + +- if (flag || flag2 && !flag && !flag1 && !flag3) +- { ++ if (flag || flag2 && !flag && !flag1 && !flag3) { + i |= 1 << EnumFacing.NORTH.func_176736_b(); + } + +- if (flag1 || flag3 && !flag && !flag1 && !flag2) +- { ++ if (flag1 || flag3 && !flag && !flag1 && !flag2) { + i |= 1 << EnumFacing.EAST.func_176736_b(); + } + +- if (flag2 || flag && !flag1 && !flag2 && !flag3) +- { ++ if (flag2 || flag && !flag1 && !flag2 && !flag3) { + i |= 1 << EnumFacing.SOUTH.func_176736_b(); + } + +- if (flag3 || flag1 && !flag && !flag2 && !flag3) +- { ++ if (flag3 || flag1 && !flag && !flag2 && !flag3) { + i |= 1 << EnumFacing.WEST.func_176736_b(); + } + + return i; + } + +- public IBlockState func_176221_a(IBlockState p_176221_1_, IBlockAccess p_176221_2_, BlockPos p_176221_3_) +- { ++ public IBlockState func_176221_a(IBlockState p_176221_1_, IBlockAccess p_176221_2_, BlockPos p_176221_3_) { + p_176221_1_ = p_176221_1_.func_177226_a(field_176350_N, this.func_176341_c(p_176221_2_, p_176221_3_, EnumFacing.WEST)); + p_176221_1_ = p_176221_1_.func_177226_a(field_176347_b, this.func_176341_c(p_176221_2_, p_176221_3_, EnumFacing.EAST)); + p_176221_1_ = p_176221_1_.func_177226_a(field_176348_a, this.func_176341_c(p_176221_2_, p_176221_3_, EnumFacing.NORTH)); +@@ -89,23 +90,18 @@ + return p_176221_1_; + } + +- private BlockRedstoneWire.EnumAttachPosition func_176341_c(IBlockAccess p_176341_1_, BlockPos p_176341_2_, EnumFacing p_176341_3_) +- { ++ private BlockRedstoneWire.EnumAttachPosition func_176341_c(IBlockAccess p_176341_1_, BlockPos p_176341_2_, EnumFacing p_176341_3_) { + BlockPos blockpos = p_176341_2_.func_177972_a(p_176341_3_); + IBlockState iblockstate = p_176341_1_.func_180495_p(p_176341_2_.func_177972_a(p_176341_3_)); + +- if (!func_176343_a(p_176341_1_.func_180495_p(blockpos), p_176341_3_) && (iblockstate.func_185915_l() || !func_176346_d(p_176341_1_.func_180495_p(blockpos.func_177977_b())))) +- { ++ if (!func_176343_a(p_176341_1_.func_180495_p(blockpos), p_176341_3_) && (iblockstate.func_185915_l() || !func_176346_d(p_176341_1_.func_180495_p(blockpos.func_177977_b())))) { + IBlockState iblockstate1 = p_176341_1_.func_180495_p(p_176341_2_.func_177984_a()); + +- if (!iblockstate1.func_185915_l()) +- { ++ if (!iblockstate1.func_185915_l()) { + boolean flag = p_176341_1_.func_180495_p(blockpos).func_185896_q() || p_176341_1_.func_180495_p(blockpos).func_177230_c() == Blocks.field_150426_aN; + +- if (flag && func_176346_d(p_176341_1_.func_180495_p(blockpos.func_177984_a()))) +- { +- if (iblockstate.func_185898_k()) +- { ++ if (flag && func_176346_d(p_176341_1_.func_180495_p(blockpos.func_177984_a()))) { ++ if (iblockstate.func_185898_k()) { + return BlockRedstoneWire.EnumAttachPosition.UP; + } + +@@ -115,371 +111,359 @@ + + return BlockRedstoneWire.EnumAttachPosition.NONE; + } +- else +- { ++ else { + return BlockRedstoneWire.EnumAttachPosition.SIDE; + } + } + + @Nullable +- public AxisAlignedBB func_180646_a(IBlockState p_180646_1_, IBlockAccess p_180646_2_, BlockPos p_180646_3_) +- { ++ public AxisAlignedBB func_180646_a(IBlockState p_180646_1_, IBlockAccess p_180646_2_, BlockPos p_180646_3_) { + return field_185506_k; + } + +- public boolean func_149662_c(IBlockState p_149662_1_) +- { ++ public boolean func_149662_c(IBlockState p_149662_1_) { + return false; + } + +- public boolean func_149686_d(IBlockState p_149686_1_) +- { ++ public boolean func_149686_d(IBlockState p_149686_1_) { + return false; + } + +- public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) +- { ++ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { return p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_185896_q() || p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c() == Blocks.field_150426_aN; } - private IBlockState func_176338_e(World p_176338_1_, BlockPos p_176338_2_, IBlockState p_176338_3_) -+ private IBlockState updateSurroundingRedstone(World worldIn, BlockPos pos, IBlockState state, BlockPos source) - { +- { - p_176338_3_ = this.func_176345_a(p_176338_1_, p_176338_2_, p_176338_2_, p_176338_3_); -+ if(CarpetSettings.redstoneDustAlgorithm == CarpetSettings.RedstoneDustAlgorithm.fast) ++ private IBlockState updateSurroundingRedstone(World worldIn, BlockPos pos, IBlockState state, BlockPos source) { ++ if (CarpetSettings.redstoneDustAlgorithm == CarpetSettings.RedstoneDustAlgorithm.fast) { + return turbo.updateSurroundingRedstone(worldIn, pos, state, source); ++ } + + state = this.func_176345_a(worldIn, pos, pos, state); List list = Lists.newArrayList(this.field_150179_b); this.field_150179_b.clear(); -+ if (CarpetSettings.redstoneDustAlgorithm == CarpetSettings.RedstoneDustAlgorithm.random) ++ if (CarpetSettings.redstoneDustAlgorithm == CarpetSettings.RedstoneDustAlgorithm.random) { + Collections.shuffle(list); ++ } - for (BlockPos blockpos : list) - { +- for (BlockPos blockpos : list) +- { - p_176338_1_.func_175685_c(blockpos, this, false); ++ for (BlockPos blockpos : list) { + worldIn.func_175685_c(blockpos, this, false); } @@ -59,91 +188,95 @@ } - private IBlockState func_176345_a(World p_176345_1_, BlockPos p_176345_2_, BlockPos p_176345_3_, IBlockState p_176345_4_) -+ public IBlockState func_176345_a(World p_176345_1_, BlockPos p_176345_2_, BlockPos p_176345_3_, IBlockState p_176345_4_) - { +- { ++ public IBlockState func_176345_a(World p_176345_1_, BlockPos p_176345_2_, BlockPos p_176345_3_, IBlockState p_176345_4_) { IBlockState iblockstate = p_176345_4_; - int i = ((Integer)p_176345_4_.func_177229_b(field_176351_O)).intValue(); -@@ -166,54 +178,65 @@ +- int i = ((Integer)p_176345_4_.func_177229_b(field_176351_O)).intValue(); ++ int i = ((Integer) p_176345_4_.func_177229_b(field_176351_O)).intValue(); + int j = 0; + j = this.func_176342_a(p_176345_1_, p_176345_3_, j); + this.field_150181_a = false; int k = p_176345_1_.func_175687_A(p_176345_2_); this.field_150181_a = true; - if (k > 0 && k > j - 1) -+ if(CarpetSettings.redstoneDustAlgorithm != CarpetSettings.RedstoneDustAlgorithm.fast) - { +- { - j = k; -+ //skipping unnecessary check -+ if (k > 0 && k > j - 1) -+ { -+ j = k; -+ } - } +- } ++ if (CarpetSettings.redstoneDustAlgorithm != CarpetSettings.RedstoneDustAlgorithm.modern) { - int l = 0; +- int l = 0; ++ if (CarpetSettings.redstoneDustAlgorithm != CarpetSettings.RedstoneDustAlgorithm.fast) { ++ //skipping unnecessary check ++ if (k > 0 && k > j - 1) { ++ j = k; ++ } ++ } - for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) - { - BlockPos blockpos = p_176345_2_.func_177972_a(enumfacing); - boolean flag = blockpos.func_177958_n() != p_176345_3_.func_177958_n() || blockpos.func_177952_p() != p_176345_3_.func_177952_p(); -- ++ int l = 0; + - if (flag) -+ if(CarpetSettings.redstoneDustAlgorithm != CarpetSettings.RedstoneDustAlgorithm.fast || k < 15){ -+ for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) - { +- { - l = this.func_176342_a(p_176345_1_, blockpos, l); -- } -+ BlockPos blockpos = p_176345_2_.func_177972_a(enumfacing); -+ boolean flag = blockpos.func_177958_n() != p_176345_3_.func_177958_n() || blockpos.func_177952_p() != p_176345_3_.func_177952_p(); ++ if (CarpetSettings.redstoneDustAlgorithm != CarpetSettings.RedstoneDustAlgorithm.fast || k < 15) { ++ for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) { ++ BlockPos blockpos = p_176345_2_.func_177972_a(enumfacing); ++ boolean flag = blockpos.func_177958_n() != p_176345_3_.func_177958_n() || blockpos.func_177952_p() != p_176345_3_.func_177952_p(); ++ ++ if (flag) { ++ l = this.func_176342_a(p_176345_1_, blockpos, l); ++ } ++ ++ if (p_176345_1_.func_180495_p(blockpos).func_185915_l() && !p_176345_1_.func_180495_p(p_176345_2_.func_177984_a()).func_185915_l()) { ++ if (flag && p_176345_2_.func_177956_o() == p_176345_3_.func_177956_o()) { ++ l = this.func_176342_a(p_176345_1_, blockpos.func_177984_a(), l); ++ } ++ } ++ else if (!p_176345_1_.func_180495_p(blockpos).func_185915_l() && flag && p_176345_2_.func_177956_o() <= p_176345_3_.func_177956_o()) { ++ l = this.func_176342_a(p_176345_1_, blockpos.func_177977_b(), l); ++ } ++ } + } - if (p_176345_1_.func_180495_p(blockpos).func_185915_l() && !p_176345_1_.func_180495_p(p_176345_2_.func_177984_a()).func_185915_l()) - { - if (flag && p_176345_2_.func_177956_o() >= p_176345_3_.func_177956_o()) -+ if (flag) - { +- { - l = this.func_176342_a(p_176345_1_, blockpos.func_177984_a(), l); -+ l = this.func_176342_a(p_176345_1_, blockpos, l); ++ if (CarpetSettings.redstoneDustAlgorithm != CarpetSettings.RedstoneDustAlgorithm.fast) { ++ if (l > j) { ++ j = l - 1; } -+ -+ if (p_176345_1_.func_180495_p(blockpos).func_185915_l() && !p_176345_1_.func_180495_p(p_176345_2_.func_177984_a()).func_185915_l()) -+ { -+ if (flag && p_176345_2_.func_177956_o() >= p_176345_3_.func_177956_o()) -+ { -+ l = this.func_176342_a(p_176345_1_, blockpos.func_177984_a(), l); -+ } ++ else if (j > 0) { ++ --j; + } -+ else if (!p_176345_1_.func_180495_p(blockpos).func_185915_l() && flag && p_176345_2_.func_177956_o() <= p_176345_3_.func_177956_o()) -+ { -+ l = this.func_176342_a(p_176345_1_, blockpos.func_177977_b(), l); ++ else { ++ j = 0; ++ } ++ ++ if (k > j - 1) { ++ j = k; + } } - else if (!p_176345_1_.func_180495_p(blockpos).func_185915_l() && flag && p_176345_2_.func_177956_o() <= p_176345_3_.func_177956_o()) -+ } -+ -+ if(CarpetSettings.redstoneDustAlgorithm != CarpetSettings.RedstoneDustAlgorithm.fast){ -+ if (l > j) - { +- { - l = this.func_176342_a(p_176345_1_, blockpos.func_177977_b(), l); ++ else { + j = l - 1; ++ if (k > j) { ++ j = k; ++ } } - } -+ else if (j > 0) -+ { -+ --j; -+ } -+ else -+ { -+ j = 0; -+ } - if (l > j) - { -+ if (k > j - 1) -+ { -+ j = k; -+ } -+ }else{ - j = l - 1; -+ if (k > j) j = k; - } +- j = l - 1; +- } - else if (j > 0) - { - --j; @@ -152,104 +285,446 @@ - { - j = 0; - } ++ if (i != j) { ++ p_176345_4_ = p_176345_4_.func_177226_a(field_176351_O, Integer.valueOf(j)); - if (k > j - 1) - { - j = k; - } -- - if (i != j) - { - p_176345_4_ = p_176345_4_.func_177226_a(field_176351_O, Integer.valueOf(j)); -@@ -223,11 +246,15 @@ - p_176345_1_.func_180501_a(p_176345_2_, p_176345_4_, 2); - } ++ if (p_176345_1_.func_180495_p(p_176345_2_) == iblockstate) { ++ p_176345_1_.func_180501_a(p_176345_2_, p_176345_4_, 2); ++ } -- this.field_150179_b.add(p_176345_2_); -- -- for (EnumFacing enumfacing1 : EnumFacing.values()) -+ if(CarpetSettings.redstoneDustAlgorithm != CarpetSettings.RedstoneDustAlgorithm.fast) - { -- this.field_150179_b.add(p_176345_2_.func_177972_a(enumfacing1)); +- if (i != j) +- { +- p_176345_4_ = p_176345_4_.func_177226_a(field_176351_O, Integer.valueOf(j)); ++ if (CarpetSettings.redstoneDustAlgorithm != CarpetSettings.RedstoneDustAlgorithm.fast) { ++ //CM unneccessary ++ this.field_150179_b.add(p_176345_2_); + +- if (p_176345_1_.func_180495_p(p_176345_2_) == iblockstate) +- { +- p_176345_1_.func_180501_a(p_176345_2_, p_176345_4_, 2); ++ for (EnumFacing enumfacing1 : EnumFacing.values()) { ++ this.field_150179_b.add(p_176345_2_.func_177972_a(enumfacing1)); ++ } ++ } + } ++ } ++ else { ++ int l = 0; ++ for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) { ++ BlockPos blockpos = p_176345_2_.func_177972_a(enumfacing); ++ l = this.func_176342_a(p_176345_1_, blockpos, l); ++ if (p_176345_1_.func_180495_p(blockpos).func_185915_l() && !p_176345_1_.func_180495_p(p_176345_2_.func_177984_a()).func_185915_l()) { ++ l = this.func_176342_a(p_176345_1_, blockpos.func_177984_a(), l); ++ } ++ else if (!p_176345_1_.func_180495_p(blockpos).func_185915_l()) { ++ l = this.func_176342_a(p_176345_1_, blockpos.func_177977_b(), l); ++ } ++ } ++ int newSignalStrength = Math.max(k, l - 1); ++ if (i != newSignalStrength) { ++ p_176345_4_ = p_176345_4_.func_177226_a(field_176351_O, Integer.valueOf(newSignalStrength)); ++ p_176345_1_.func_180501_a(p_176345_2_, p_176345_4_, 2); + //CM unneccessary + this.field_150179_b.add(p_176345_2_); -+ -+ for (EnumFacing enumfacing1 : EnumFacing.values()) -+ { + +- this.field_150179_b.add(p_176345_2_); ++ for (EnumFacing enumfacing1 : EnumFacing.values()) { + this.field_150179_b.add(p_176345_2_.func_177972_a(enumfacing1)); + } + +- for (EnumFacing enumfacing1 : EnumFacing.values()) +- { +- this.field_150179_b.add(p_176345_2_.func_177972_a(enumfacing1)); + } +- } + ++ } + return p_176345_4_; + } + +- private void func_176344_d(World p_176344_1_, BlockPos p_176344_2_) +- { +- if (p_176344_1_.func_180495_p(p_176344_2_).func_177230_c() == this) +- { ++ private void func_176344_d(World p_176344_1_, BlockPos p_176344_2_) { ++ if (p_176344_1_.func_180495_p(p_176344_2_).func_177230_c() == this) { + p_176344_1_.func_175685_c(p_176344_2_, this, false); + +- for (EnumFacing enumfacing : EnumFacing.values()) +- { ++ for (EnumFacing enumfacing : EnumFacing.values()) { + p_176344_1_.func_175685_c(p_176344_2_.func_177972_a(enumfacing), this, false); } } + } -@@ -251,7 +278,7 @@ - { - if (!p_176213_1_.field_72995_K) - { +- public void func_176213_c(World p_176213_1_, BlockPos p_176213_2_, IBlockState p_176213_3_) +- { +- if (!p_176213_1_.field_72995_K) +- { - this.func_176338_e(p_176213_1_, p_176213_2_, p_176213_3_); ++ public void func_176213_c(World p_176213_1_, BlockPos p_176213_2_, IBlockState p_176213_3_) { ++ if (!p_176213_1_.field_72995_K) { + this.updateSurroundingRedstone(p_176213_1_, p_176213_2_, p_176213_3_, null); - for (EnumFacing enumfacing : EnumFacing.Plane.VERTICAL) - { -@@ -290,7 +317,7 @@ +- for (EnumFacing enumfacing : EnumFacing.Plane.VERTICAL) +- { ++ for (EnumFacing enumfacing : EnumFacing.Plane.VERTICAL) { + p_176213_1_.func_175685_c(p_176213_2_.func_177972_a(enumfacing), this, false); + } + +- for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL) +- { ++ for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL) { + this.func_176344_d(p_176213_1_, p_176213_2_.func_177972_a(enumfacing1)); + } + +- for (EnumFacing enumfacing2 : EnumFacing.Plane.HORIZONTAL) +- { ++ for (EnumFacing enumfacing2 : EnumFacing.Plane.HORIZONTAL) { + BlockPos blockpos = p_176213_2_.func_177972_a(enumfacing2); + +- if (p_176213_1_.func_180495_p(blockpos).func_185915_l()) +- { ++ if (p_176213_1_.func_180495_p(blockpos).func_185915_l()) { + this.func_176344_d(p_176213_1_, blockpos.func_177984_a()); + } +- else +- { ++ else { + this.func_176344_d(p_176213_1_, blockpos.func_177977_b()); + } + } + } + } + +- public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) +- { ++ public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) { + super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_); + +- if (!p_180663_1_.field_72995_K) +- { +- for (EnumFacing enumfacing : EnumFacing.values()) +- { ++ if (!p_180663_1_.field_72995_K) { ++ for (EnumFacing enumfacing : EnumFacing.values()) { p_180663_1_.func_175685_c(p_180663_2_.func_177972_a(enumfacing), this, false); } - this.func_176338_e(p_180663_1_, p_180663_2_, p_180663_3_); + this.updateSurroundingRedstone(p_180663_1_, p_180663_2_, p_180663_3_, null); - for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL) - { -@@ -332,7 +359,7 @@ - { - if (this.func_176196_c(p_189540_2_, p_189540_3_)) - { +- for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL) +- { ++ for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL) { + this.func_176344_d(p_180663_1_, p_180663_2_.func_177972_a(enumfacing1)); + } + +- for (EnumFacing enumfacing2 : EnumFacing.Plane.HORIZONTAL) +- { ++ for (EnumFacing enumfacing2 : EnumFacing.Plane.HORIZONTAL) { + BlockPos blockpos = p_180663_2_.func_177972_a(enumfacing2); + +- if (p_180663_1_.func_180495_p(blockpos).func_185915_l()) +- { ++ if (p_180663_1_.func_180495_p(blockpos).func_185915_l()) { + this.func_176344_d(p_180663_1_, blockpos.func_177984_a()); + } +- else +- { ++ else { + this.func_176344_d(p_180663_1_, blockpos.func_177977_b()); + } + } + } + } + +- private int func_176342_a(World p_176342_1_, BlockPos p_176342_2_, int p_176342_3_) +- { +- if (p_176342_1_.func_180495_p(p_176342_2_).func_177230_c() != this) +- { ++ private int func_176342_a(World p_176342_1_, BlockPos p_176342_2_, int p_176342_3_) { ++ if (p_176342_1_.func_180495_p(p_176342_2_).func_177230_c() != this) { + return p_176342_3_; + } +- else +- { +- int i = ((Integer)p_176342_1_.func_180495_p(p_176342_2_).func_177229_b(field_176351_O)).intValue(); ++ else { ++ int i = ((Integer) p_176342_1_.func_180495_p(p_176342_2_).func_177229_b(field_176351_O)).intValue(); + return i > p_176342_3_ ? i : p_176342_3_; + } + } + +- public void func_189540_a(IBlockState p_189540_1_, World p_189540_2_, BlockPos p_189540_3_, Block p_189540_4_, BlockPos p_189540_5_) +- { +- if (!p_189540_2_.field_72995_K) +- { +- if (this.func_176196_c(p_189540_2_, p_189540_3_)) +- { - this.func_176338_e(p_189540_2_, p_189540_3_, p_189540_1_); ++ public void func_189540_a(IBlockState p_189540_1_, World p_189540_2_, BlockPos p_189540_3_, Block p_189540_4_, BlockPos p_189540_5_) { ++ if (!p_189540_2_.field_72995_K) { ++ if (this.func_176196_c(p_189540_2_, p_189540_3_)) { + this.updateSurroundingRedstone(p_189540_2_, p_189540_3_, p_189540_1_, p_189540_5_); } - else - { -@@ -354,6 +381,12 @@ +- else +- { ++ else { + this.func_176226_b(p_189540_2_, p_189540_3_, p_189540_1_, 0); + p_189540_2_.func_175698_g(p_189540_3_); + } + } + } - public int func_180656_a(IBlockState p_180656_1_, IBlockAccess p_180656_2_, BlockPos p_180656_3_, EnumFacing p_180656_4_) - { +- public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) +- { ++ public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) { + return Items.field_151137_ax; + } + +- public int func_176211_b(IBlockState p_176211_1_, IBlockAccess p_176211_2_, BlockPos p_176211_3_, EnumFacing p_176211_4_) +- { ++ public int func_176211_b(IBlockState p_176211_1_, IBlockAccess p_176211_2_, BlockPos p_176211_3_, EnumFacing p_176211_4_) { + return !this.field_150181_a ? 0 : p_176211_1_.func_185911_a(p_176211_2_, p_176211_3_, p_176211_4_); + } + +- public int func_180656_a(IBlockState p_180656_1_, IBlockAccess p_180656_2_, BlockPos p_180656_3_, EnumFacing p_180656_4_) +- { +- if (!this.field_150181_a) +- { ++ public int func_180656_a(IBlockState p_180656_1_, IBlockAccess p_180656_2_, BlockPos p_180656_3_, EnumFacing p_180656_4_) { + // [CM] Redstone ore redirects dust -+ if (CarpetSettings.redstoneOreRedirectsDust) -+ { ++ if (CarpetSettings.redstoneOreRedirectsDust) { + RedstoneOreRedirectHelper redstoneOre = new RedstoneOreRedirectHelper(this); + return redstoneOre.getWeakPowerCM(p_180656_1_, p_180656_2_, p_180656_3_, p_180656_4_); + } - if (!this.field_150181_a) - { ++ if (!this.field_150181_a) { return 0; -@@ -361,6 +394,8 @@ - else - { - int i = ((Integer)p_180656_1_.func_177229_b(field_176351_O)).intValue(); -+ + } +- else +- { +- int i = ((Integer)p_180656_1_.func_177229_b(field_176351_O)).intValue(); ++ else { ++ int i = ((Integer) p_180656_1_.func_177229_b(field_176351_O)).intValue(); + +- if (i == 0) +- { + IBlockState iblockstate = p_180656_2_.func_180495_p(p_180656_3_.func_177972_a(p_180656_4_.func_176734_d())); // [CM] RS Ore redirects dust ++ ++ if (i == 0) { + return 0; + } +- else if (p_180656_4_ == EnumFacing.UP) +- { ++ else if (p_180656_4_ == EnumFacing.UP) { + return i; + } +- else +- { ++ else { + EnumSet enumset = EnumSet.noneOf(EnumFacing.class); - if (i == 0) - { -@@ -398,7 +433,8 @@ +- for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) +- { +- if (this.func_176339_d(p_180656_2_, p_180656_3_, enumfacing)) +- { ++ for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) { ++ if (this.func_176339_d(p_180656_2_, p_180656_3_, enumfacing)) { + enumset.add(enumfacing); + } + } + +- if (p_180656_4_.func_176740_k().func_176722_c() && enumset.isEmpty()) +- { ++ if (p_180656_4_.func_176740_k().func_176722_c() && enumset.isEmpty()) { + return i; + } +- else if (enumset.contains(p_180656_4_) && !enumset.contains(p_180656_4_.func_176735_f()) && !enumset.contains(p_180656_4_.func_176746_e())) +- { ++ else if (enumset.contains(p_180656_4_) && !enumset.contains(p_180656_4_.func_176735_f()) && !enumset.contains(p_180656_4_.func_176746_e())) { + return i; + } +- else +- { ++ else { + return 0; + } + } } } - private boolean func_176339_d(IBlockAccess p_176339_1_, BlockPos p_176339_2_, EnumFacing p_176339_3_) +- { + // [CM] Change access to public for redstone ore redirects dust -+ public boolean func_176339_d(IBlockAccess p_176339_1_, BlockPos p_176339_2_, EnumFacing p_176339_3_) - { ++ public boolean func_176339_d(IBlockAccess p_176339_1_, BlockPos p_176339_2_, EnumFacing p_176339_3_) { BlockPos blockpos = p_176339_2_.func_177972_a(p_176339_3_); IBlockState iblockstate = p_176339_1_.func_180495_p(blockpos); -@@ -435,6 +471,12 @@ + boolean flag = iblockstate.func_185915_l(); + boolean flag1 = p_176339_1_.func_180495_p(p_176339_2_.func_177984_a()).func_185915_l(); - protected static boolean func_176343_a(IBlockState p_176343_0_, @Nullable EnumFacing p_176343_1_) - { +- if (!flag1 && flag && func_176340_e(p_176339_1_, blockpos.func_177984_a())) +- { ++ if (!flag1 && flag && func_176340_e(p_176339_1_, blockpos.func_177984_a())) { + return true; + } +- else if (func_176343_a(iblockstate, p_176339_3_)) +- { ++ else if (func_176343_a(iblockstate, p_176339_3_)) { + return true; + } +- else if (iblockstate.func_177230_c() == Blocks.field_150416_aS && iblockstate.func_177229_b(BlockRedstoneDiode.field_185512_D) == p_176339_3_) +- { ++ else if (iblockstate.func_177230_c() == Blocks.field_150416_aS && iblockstate.func_177229_b(BlockRedstoneDiode.field_185512_D) == p_176339_3_) { + return true; + } +- else +- { ++ else { + return !flag && func_176340_e(p_176339_1_, blockpos.func_177977_b()); + } + } + +- protected static boolean func_176340_e(IBlockAccess p_176340_0_, BlockPos p_176340_1_) +- { ++ protected static boolean func_176340_e(IBlockAccess p_176340_0_, BlockPos p_176340_1_) { + return func_176346_d(p_176340_0_.func_180495_p(p_176340_1_)); + } + +- protected static boolean func_176346_d(IBlockState p_176346_0_) +- { +- return func_176343_a(p_176346_0_, (EnumFacing)null); ++ protected static boolean func_176346_d(IBlockState p_176346_0_) { ++ return func_176343_a(p_176346_0_, (EnumFacing) null); + } + +- protected static boolean func_176343_a(IBlockState p_176343_0_, @Nullable EnumFacing p_176343_1_) +- { ++ protected static boolean func_176343_a(IBlockState p_176343_0_, @Nullable EnumFacing p_176343_1_) { + // [CM] Redstone ore redirects dust -+ if (CarpetSettings.redstoneOreRedirectsDust) -+ { ++ if (CarpetSettings.redstoneOreRedirectsDust) { + return RedstoneOreRedirectHelper.canConnectToCM(p_176343_0_, p_176343_1_); + } -+ ++ Block block = p_176343_0_.func_177230_c(); - if (block == Blocks.field_150488_af) +- if (block == Blocks.field_150488_af) +- { ++ if (block == Blocks.field_150488_af) { + return true; + } +- else if (Blocks.field_150413_aR.func_185547_C(p_176343_0_)) +- { +- EnumFacing enumfacing = (EnumFacing)p_176343_0_.func_177229_b(BlockRedstoneRepeater.field_185512_D); ++ else if (Blocks.field_150413_aR.func_185547_C(p_176343_0_)) { ++ EnumFacing enumfacing = (EnumFacing) p_176343_0_.func_177229_b(BlockRedstoneRepeater.field_185512_D); + return enumfacing == p_176343_1_ || enumfacing.func_176734_d() == p_176343_1_; + } +- else if (Blocks.field_190976_dk == p_176343_0_.func_177230_c()) +- { ++ else if (Blocks.field_190976_dk == p_176343_0_.func_177230_c()) { + return p_176343_1_ == p_176343_0_.func_177229_b(BlockObserver.field_176387_N); + } +- else +- { ++ else { + return p_176343_0_.func_185897_m() && p_176343_1_ != null; + } + } + +- public boolean func_149744_f(IBlockState p_149744_1_) +- { ++ public boolean func_149744_f(IBlockState p_149744_1_) { + return this.field_150181_a; + } + +- public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) +- { ++ public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) { + return new ItemStack(Items.field_151137_ax); + } + +- public IBlockState func_176203_a(int p_176203_1_) +- { ++ public IBlockState func_176203_a(int p_176203_1_) { + return this.func_176223_P().func_177226_a(field_176351_O, Integer.valueOf(p_176203_1_)); + } + +- public int func_176201_c(IBlockState p_176201_1_) +- { +- return ((Integer)p_176201_1_.func_177229_b(field_176351_O)).intValue(); ++ public int func_176201_c(IBlockState p_176201_1_) { ++ return ((Integer) p_176201_1_.func_177229_b(field_176351_O)).intValue(); + } + +- public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_) +- { +- switch (p_185499_2_) +- { ++ public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_) { ++ switch (p_185499_2_) { + case CLOCKWISE_180: + return p_185499_1_.func_177226_a(field_176348_a, p_185499_1_.func_177229_b(field_176349_M)).func_177226_a(field_176347_b, p_185499_1_.func_177229_b(field_176350_N)).func_177226_a(field_176349_M, p_185499_1_.func_177229_b(field_176348_a)).func_177226_a(field_176350_N, p_185499_1_.func_177229_b(field_176347_b)); + case COUNTERCLOCKWISE_90: +@@ -491,10 +475,8 @@ + } + } + +- public IBlockState func_185471_a(IBlockState p_185471_1_, Mirror p_185471_2_) +- { +- switch (p_185471_2_) +- { ++ public IBlockState func_185471_a(IBlockState p_185471_1_, Mirror p_185471_2_) { ++ switch (p_185471_2_) { + case LEFT_RIGHT: + return p_185471_1_.func_177226_a(field_176348_a, p_185471_1_.func_177229_b(field_176349_M)).func_177226_a(field_176349_M, p_185471_1_.func_177229_b(field_176348_a)); + case FRONT_BACK: +@@ -504,36 +486,30 @@ + } + } + +- protected BlockStateContainer func_180661_e() +- { +- return new BlockStateContainer(this, new IProperty[] {field_176348_a, field_176347_b, field_176349_M, field_176350_N, field_176351_O}); ++ protected BlockStateContainer func_180661_e() { ++ return new BlockStateContainer(this, new IProperty[]{field_176348_a, field_176347_b, field_176349_M, field_176350_N, field_176351_O}); + } + +- public BlockFaceShape func_193383_a(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) +- { ++ public BlockFaceShape func_193383_a(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) { + return BlockFaceShape.UNDEFINED; + } + +- static enum EnumAttachPosition implements IStringSerializable +- { ++ static enum EnumAttachPosition implements IStringSerializable { + UP("up"), + SIDE("side"), + NONE("none"); + + private final String field_176820_d; + +- private EnumAttachPosition(String p_i45689_3_) +- { ++ private EnumAttachPosition(String p_i45689_3_) { + this.field_176820_d = p_i45689_3_; + } + +- public String toString() +- { ++ public String toString() { + return this.func_176610_l(); + } + +- public String func_176610_l() +- { ++ public String func_176610_l() { + return this.field_176820_d; + } + } diff --git a/patches/net/minecraft/server/management/PlayerProfileCache.java.patch b/patches/net/minecraft/server/management/PlayerProfileCache.java.patch index 0402662..374d514 100644 --- a/patches/net/minecraft/server/management/PlayerProfileCache.java.patch +++ b/patches/net/minecraft/server/management/PlayerProfileCache.java.patch @@ -36,7 +36,7 @@ { PlayerProfileCache.ProfileEntry playerprofilecache$profileentry1 = this.field_152662_d.get(uuid); - this.field_152661_c.remove(playerprofilecache$profileentry1.func_152668_a().getName().toLowerCase(Locale.ROOT)); -+ this.field_152661_c.remove(playerprofilecache$profileentry1.func_152668_a().getName()/*.toLowerCase(Locale.ROOT)*/);//Bullet TODO:Testear esto, ver si falta en algun lugar ++ this.field_152661_c.remove(playerprofilecache$profileentry1.func_152668_a().getName()/*.toLowerCase(Locale.ROOT)*/);//Bullet this.field_152663_e.remove(p_152651_1_); }