chainstone can stick to all blocks
This commit is contained in:
1 parent
70a59ccedd
commit
01afdf650d
2 files changed
+25
-9
No files matched your search
@@ -16,10 +16,11 @@ import net.minecraft.util.math.Box;
|
|||||||
import net.minecraft.util.math.ChunkPos;
|
import net.minecraft.util.math.ChunkPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import static carpet.settings.RuleCategory.BUGFIX;
|
import static carpet.settings.RuleCategory.BUGFIX;
|
||||||
import static carpet.settings.RuleCategory.COMMAND;
|
import static carpet.settings.RuleCategory.COMMAND;
|
||||||
import static carpet.settings.RuleCategory.CREATIVE;
|
import static carpet.settings.RuleCategory.CREATIVE;
|
||||||
@@ -35,13 +36,15 @@ import static carpet.settings.RuleCategory.CLIENT;
|
|||||||
@SuppressWarnings("CanBeFinal")
|
@SuppressWarnings("CanBeFinal")
|
||||||
public class CarpetSettings
|
public class CarpetSettings
|
||||||
{
|
{
|
||||||
public static final String carpetVersion = "1.4.12+v201001";
|
public static final String carpetVersion = "1.4.13+v201015";
|
||||||
public static final Logger LOG = LogManager.getLogger();
|
public static final Logger LOG = LogManager.getLogger();
|
||||||
public static boolean skipGenerationChecks = false;
|
public static boolean skipGenerationChecks = false;
|
||||||
public static boolean impendingFillSkipUpdates = false;
|
public static boolean impendingFillSkipUpdates = false;
|
||||||
public static Box currentTelepotingEntityBox = null;
|
public static Box currentTelepotingEntityBox = null;
|
||||||
public static Vec3d fixedPosition = null;
|
public static Vec3d fixedPosition = null;
|
||||||
public static int runPermissionLevel = 2;
|
public static int runPermissionLevel = 2;
|
||||||
|
public static boolean doChainStone = false;
|
||||||
|
public static boolean chainStoneStickToAll = false;
|
||||||
|
|
||||||
private static class LanguageValidator extends Validator<String> {
|
private static class LanguageValidator extends Validator<String> {
|
||||||
@Override public String validate(ServerCommandSource source, ParsedRule<String> currentRule, String newValue, String string) {
|
@Override public String validate(ServerCommandSource source, ParsedRule<String> currentRule, String newValue, String string) {
|
||||||
@@ -259,12 +262,23 @@ public class CarpetSettings
|
|||||||
@Rule( desc = "Pistons can push block entities, like hoppers, chests etc.", category = {EXPERIMENTAL, FEATURE} )
|
@Rule( desc = "Pistons can push block entities, like hoppers, chests etc.", category = {EXPERIMENTAL, FEATURE} )
|
||||||
public static boolean movableBlockEntities = false;
|
public static boolean movableBlockEntities = false;
|
||||||
|
|
||||||
|
|
||||||
|
private static class ChainStoneSetting extends Validator<String> {
|
||||||
|
@Override public String validate(ServerCommandSource source, ParsedRule<String> currentRule, String newValue, String string) {
|
||||||
|
CarpetSettings.doChainStone = !newValue.toLowerCase(Locale.ROOT).equals("false");
|
||||||
|
CarpetSettings.chainStoneStickToAll = newValue.toLowerCase(Locale.ROOT).equals("all");
|
||||||
|
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
@Rule(
|
@Rule(
|
||||||
desc = "Chains will stick to each other on the long end",
|
desc = "Chains will stick to each other on the long end",
|
||||||
extra = "and stick to other blocks that connect to them at the ends",
|
extra = "and stick to other blocks that connect to them at the ends",
|
||||||
category = {EXPERIMENTAL, FEATURE}
|
category = {EXPERIMENTAL, FEATURE},
|
||||||
|
options = {"true", "false", "all"},
|
||||||
|
validate = ChainStoneSetting.class
|
||||||
)
|
)
|
||||||
public static boolean chainStone = false;
|
public static String chainStone = "false";
|
||||||
|
|
||||||
@Rule( desc = "Saplings turn into dead shrubs in hot climates and no water access", category = FEATURE )
|
@Rule( desc = "Saplings turn into dead shrubs in hot climates and no water access", category = FEATURE )
|
||||||
public static boolean desertShrubs = false;
|
public static boolean desertShrubs = false;
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public abstract class PistonHandler_customStickyMixin
|
|||||||
//if(block == Blocks.STICKY_PISTON)
|
//if(block == Blocks.STICKY_PISTON)
|
||||||
// return blockState.get(FacingBlock.FACING) == motionDirection;
|
// return blockState.get(FacingBlock.FACING) == motionDirection;
|
||||||
}
|
}
|
||||||
if (CarpetSettings.chainStone && blockState.getBlock() == Blocks.CHAIN)
|
if (CarpetSettings.doChainStone && blockState.getBlock() == Blocks.CHAIN)
|
||||||
{
|
{
|
||||||
return isChainOnAxis(currentState, motionDirection);
|
return isChainOnAxis(currentState, motionDirection);
|
||||||
}
|
}
|
||||||
@@ -111,11 +111,12 @@ public abstract class PistonHandler_customStickyMixin
|
|||||||
)
|
)
|
||||||
private boolean isDraggingPreviousBlockBehind(Block previous, Block next)
|
private boolean isDraggingPreviousBlockBehind(Block previous, Block next)
|
||||||
{
|
{
|
||||||
if (CarpetSettings.chainStone)
|
if (CarpetSettings.doChainStone)
|
||||||
{
|
{
|
||||||
if (previousState.getBlock() == Blocks.CHAIN && isChainOnAxis(previousState, motionDirection))
|
if (previousState.getBlock() == Blocks.CHAIN && isChainOnAxis(previousState, motionDirection))
|
||||||
{
|
{
|
||||||
if ( (currentState.getBlock() == Blocks.CHAIN && isChainOnAxis(currentState, motionDirection))
|
if ( (currentState.getBlock() == Blocks.CHAIN && isChainOnAxis(currentState, motionDirection))
|
||||||
|
|| CarpetSettings.chainStoneStickToAll
|
||||||
|| isEndRodOnAxis(currentState, motionDirection.getAxis())
|
|| isEndRodOnAxis(currentState, motionDirection.getAxis())
|
||||||
|| Block.sideCoversSmallSquare(world, currentPos, motionDirection))
|
|| Block.sideCoversSmallSquare(world, currentPos, motionDirection))
|
||||||
{
|
{
|
||||||
@@ -164,7 +165,7 @@ public abstract class PistonHandler_customStickyMixin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CarpetSettings.chainStone)
|
if (CarpetSettings.doChainStone)
|
||||||
{
|
{
|
||||||
BlockPos pos = this.movedBlocks.get(int_1);
|
BlockPos pos = this.movedBlocks.get(int_1);
|
||||||
BlockState chainState = world.getBlockState(pos);
|
BlockState chainState = world.getBlockState(pos);
|
||||||
@@ -215,7 +216,7 @@ public abstract class PistonHandler_customStickyMixin
|
|||||||
private void redirectIsStickyBlock(BlockPos pos, Direction dir, CallbackInfoReturnable<Boolean> cir,
|
private void redirectIsStickyBlock(BlockPos pos, Direction dir, CallbackInfoReturnable<Boolean> cir,
|
||||||
BlockState blockState, Block block, int i, int j, int l, BlockPos blockPos2, int m, int n, BlockPos blockPos3)
|
BlockState blockState, Block block, int i, int j, int l, BlockPos blockPos2, int m, int n, BlockPos blockPos3)
|
||||||
{
|
{
|
||||||
if (CarpetSettings.chainStone)
|
if (CarpetSettings.doChainStone)
|
||||||
{
|
{
|
||||||
BlockState chainState = world.getBlockState(blockPos3);
|
BlockState chainState = world.getBlockState(blockPos3);
|
||||||
if (chainState.getBlock() == Blocks.CHAIN && !isChainOnAxis(chainState, motionDirection) && !canMoveAdjacentBlock(blockPos3))
|
if (chainState.getBlock() == Blocks.CHAIN && !isChainOnAxis(chainState, motionDirection) && !canMoveAdjacentBlock(blockPos3))
|
||||||
@@ -237,12 +238,13 @@ public abstract class PistonHandler_customStickyMixin
|
|||||||
private void otherSideStickyCases(BlockPos pos, CallbackInfoReturnable<Boolean> cir,
|
private void otherSideStickyCases(BlockPos pos, CallbackInfoReturnable<Boolean> cir,
|
||||||
BlockState blockState, Direction var3[], int var4, int var5, Direction direction, BlockPos blockPos, BlockState blockState2)
|
BlockState blockState, Direction var3[], int var4, int var5, Direction direction, BlockPos blockPos, BlockState blockState2)
|
||||||
{
|
{
|
||||||
if (CarpetSettings.chainStone)
|
if (CarpetSettings.doChainStone)
|
||||||
{
|
{
|
||||||
if (blockState.getBlock() == Blocks.CHAIN && isChainOnAxis(blockState, direction) && !blockState2.isAir())
|
if (blockState.getBlock() == Blocks.CHAIN && isChainOnAxis(blockState, direction) && !blockState2.isAir())
|
||||||
{
|
{
|
||||||
Block otherBlock = blockState2.getBlock();
|
Block otherBlock = blockState2.getBlock();
|
||||||
if ((otherBlock == Blocks.CHAIN && (blockState.get(ChainBlock.AXIS) == blockState2.get(ChainBlock.AXIS)))
|
if ((otherBlock == Blocks.CHAIN && (blockState.get(ChainBlock.AXIS) == blockState2.get(ChainBlock.AXIS)))
|
||||||
|
|| CarpetSettings.chainStoneStickToAll
|
||||||
|| isEndRodOnAxis(blockState2, blockState.get(ChainBlock.AXIS))
|
|| isEndRodOnAxis(blockState2, blockState.get(ChainBlock.AXIS))
|
||||||
|| otherBlock == Blocks.HONEY_BLOCK
|
|| otherBlock == Blocks.HONEY_BLOCK
|
||||||
|| Block.sideCoversSmallSquare(world, blockPos, direction.getOpposite()))
|
|| Block.sideCoversSmallSquare(world, blockPos, direction.getOpposite()))
|
||||||
|
|||||||
Reference in new issue
Block a user