mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 07:27:15 +01:00
Merge branch 'mc1.15/dev' of https://github.com/Creators-of-Create/Create into mc1.15/dev
This commit is contained in:
commit
1433bcb4ef
47 changed files with 150 additions and 91 deletions
|
@ -42,7 +42,7 @@ public class CreateClient {
|
|||
public static SchematicHandler schematicHandler;
|
||||
public static SchematicAndQuillHandler schematicAndQuillHandler;
|
||||
public static SuperByteBufferCache bufferCache;
|
||||
public static Outliner outliner;
|
||||
public static final Outliner outliner = new Outliner();
|
||||
|
||||
private static CustomBlockModels customBlockModels;
|
||||
private static CustomItemModels customItemModels;
|
||||
|
@ -62,7 +62,6 @@ public class CreateClient {
|
|||
schematicSender = new ClientSchematicLoader();
|
||||
schematicHandler = new SchematicHandler();
|
||||
schematicAndQuillHandler = new SchematicAndQuillHandler();
|
||||
outliner = new Outliner();
|
||||
|
||||
bufferCache = new SuperByteBufferCache();
|
||||
bufferCache.registerCompartment(KineticTileEntityRenderer.KINETIC_TILE);
|
||||
|
|
|
@ -18,6 +18,7 @@ import com.simibubi.create.content.contraptions.relays.encased.EncasedBeltBlock;
|
|||
import com.simibubi.create.content.contraptions.relays.encased.SplitShaftTileEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.gearbox.GearboxTileEntity;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -431,7 +432,7 @@ public class RotationPropagator {
|
|||
.isAreaLoaded(te.getPos(), 1))
|
||||
return neighbours;
|
||||
|
||||
for (Direction facing : Direction.values())
|
||||
for (Direction facing : Iterate.directions)
|
||||
neighbours.add(te.getPos()
|
||||
.offset(facing));
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.content.contraptions.base;
|
||||
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
|
@ -26,7 +28,7 @@ public abstract class DirectionalKineticBlock extends KineticBlock {
|
|||
|
||||
public Direction getPreferredFacing(BlockItemUseContext context) {
|
||||
Direction prefferedSide = null;
|
||||
for (Direction side : Direction.values()) {
|
||||
for (Direction side : Iterate.directions) {
|
||||
BlockState blockState = context.getWorld()
|
||||
.getBlockState(context.getPos()
|
||||
.offset(side));
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.content.contraptions.base;
|
||||
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
|
@ -38,9 +40,7 @@ public abstract class HorizontalAxisKineticBlock extends KineticBlock {
|
|||
|
||||
public static Axis getPreferredHorizontalAxis(BlockItemUseContext context) {
|
||||
Direction prefferedSide = null;
|
||||
for (Direction side : Direction.values()) {
|
||||
if (side.getAxis().isVertical())
|
||||
continue;
|
||||
for (Direction side : Iterate.horizontalDirections) {
|
||||
BlockState blockState = context.getWorld().getBlockState(context.getPos().offset(side));
|
||||
if (blockState.getBlock() instanceof IRotate) {
|
||||
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getWorld(), context.getPos().offset(side),
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.content.contraptions.base;
|
||||
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
|
@ -40,7 +42,7 @@ public abstract class RotatedPillarKineticBlock extends KineticBlock {
|
|||
|
||||
public static Axis getPreferredAxis(BlockItemUseContext context) {
|
||||
Axis prefferedAxis = null;
|
||||
for (Direction side : Direction.values()) {
|
||||
for (Direction side : Iterate.directions) {
|
||||
BlockState blockState = context.getWorld()
|
||||
.getBlockState(context.getPos()
|
||||
.offset(side));
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
@ -74,7 +75,7 @@ public class ConnectedInputHandler {
|
|||
positions.remove(pos);
|
||||
while (!frontier.isEmpty()) {
|
||||
BlockPos current = frontier.remove(0);
|
||||
for (Direction direction : Direction.values()) {
|
||||
for (Direction direction : Iterate.directions) {
|
||||
BlockPos next = current.offset(direction);
|
||||
if (!positions.remove(next))
|
||||
continue;
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.simibubi.create.content.contraptions.components.crafter.ConnectedInpu
|
|||
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity.Phase;
|
||||
import com.simibubi.create.foundation.block.ITE;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.Pointing;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
|
@ -109,7 +110,7 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock implements IT
|
|||
crafter.ejectWholeGrid();
|
||||
}
|
||||
|
||||
for (Direction direction : Direction.values()) {
|
||||
for (Direction direction : Iterate.directions) {
|
||||
if (direction.getAxis() == state.get(HORIZONTAL_FACING)
|
||||
.getAxis())
|
||||
continue;
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.google.common.base.Predicates;
|
|||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllRecipeTypes;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.Pointing;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -109,7 +110,7 @@ public class RecipeGridHandler {
|
|||
|
||||
Direction blockFacing = blockState.get(HORIZONTAL_FACING);
|
||||
Direction blockPointing = MechanicalCrafterBlock.getTargetDirection(blockState);
|
||||
for (Direction facing : Direction.values()) {
|
||||
for (Direction facing : Iterate.directions) {
|
||||
if (blockFacing.getAxis() == facing.getAxis())
|
||||
continue;
|
||||
if (blockPointing == facing)
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.simibubi.create.AllShapes;
|
|||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock;
|
||||
import com.simibubi.create.foundation.block.ITE;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -52,9 +53,8 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock implements ITE
|
|||
@Override
|
||||
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
|
||||
for (Direction d : Direction.values()) {
|
||||
if (d.getAxis() == state.get(AXIS) || d.getAxis()
|
||||
.isVertical())
|
||||
for (Direction d : Iterate.horizontalDirections) {
|
||||
if (d.getAxis() == state.get(AXIS))
|
||||
continue;
|
||||
if (AllBlocks.CRUSHING_WHEEL_CONTROLLER.has(worldIn.getBlockState(pos.offset(d))))
|
||||
worldIn.setBlockState(pos.offset(d), Blocks.AIR.getDefaultState());
|
||||
|
@ -153,7 +153,7 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock implements ITE
|
|||
|
||||
@Override
|
||||
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
|
||||
for (Direction direction : Direction.values()) {
|
||||
for (Direction direction : Iterate.directions) {
|
||||
BlockPos neighbourPos = pos.offset(direction);
|
||||
BlockState neighbourState = worldIn.getBlockState(neighbourPos);
|
||||
Axis stateAxis = state.get(AXIS);
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.simibubi.create.AllTileEntities;
|
|||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.foundation.block.ITE;
|
||||
import com.simibubi.create.foundation.item.ItemHelper;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -127,9 +128,7 @@ public class CrushingWheelControllerBlock extends Block
|
|||
return;
|
||||
}
|
||||
|
||||
for (Direction d : Direction.values()) {
|
||||
if (d.getAxis().isVertical())
|
||||
continue;
|
||||
for (Direction d : Iterate.horizontalDirections) {
|
||||
BlockState neighbour = world.getBlockState(pos.offset(d));
|
||||
if (!AllBlocks.CRUSHING_WHEEL.has(neighbour))
|
||||
continue;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.simibubi.create.content.contraptions.components.crusher;
|
||||
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
@ -29,7 +30,7 @@ public class CrushingWheelTileEntity extends KineticTileEntity {
|
|||
}
|
||||
|
||||
public void fixControllers() {
|
||||
for (Direction d : Direction.values())
|
||||
for (Direction d : Iterate.directions)
|
||||
((CrushingWheelBlock) getBlockState().getBlock()).updateControllers(getBlockState(), getWorld(), getPos(),
|
||||
d);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import javax.annotation.Nullable;
|
|||
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -75,9 +76,7 @@ public abstract class EngineBlock extends HorizontalBlock implements IWrenchable
|
|||
BlockPos baseBlockPos = getBaseBlockPos(state, pos);
|
||||
if (!isValidBaseBlock(world.getBlockState(baseBlockPos), world, pos))
|
||||
return false;
|
||||
for (Direction otherFacing : Direction.values()) {
|
||||
if (otherFacing.getAxis().isVertical())
|
||||
continue;
|
||||
for (Direction otherFacing : Iterate.horizontalDirections) {
|
||||
if (otherFacing == facing)
|
||||
continue;
|
||||
BlockPos otherPos = baseBlockPos.offset(otherFacing);
|
||||
|
|
|
@ -296,7 +296,7 @@ public abstract class Contraption {
|
|||
|
||||
// Slime blocks and super glue drag adjacent blocks if possible
|
||||
boolean isSlimeBlock = state.getBlock() instanceof SlimeBlock;
|
||||
for (Direction offset : Direction.values()) {
|
||||
for (Direction offset : Iterate.directions) {
|
||||
BlockPos offsetPos = pos.offset(offset);
|
||||
BlockState blockState = world.getBlockState(offsetPos);
|
||||
if (isAnchoringBlockAt(offsetPos))
|
||||
|
@ -755,7 +755,7 @@ public abstract class Contraption {
|
|||
continue;
|
||||
|
||||
if (nonBrittles)
|
||||
for (Direction face : Direction.values())
|
||||
for (Direction face : Iterate.directions)
|
||||
state = state.updatePostPlacement(face, world.getBlockState(targetPos.offset(face)), world,
|
||||
targetPos, targetPos.offset(face));
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.cha
|
|||
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.BeltSlope;
|
||||
import com.simibubi.create.foundation.utility.DirectionHelper;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.block.BellBlock;
|
||||
|
@ -310,13 +311,13 @@ public class StructureTransform {
|
|||
BlockState rotated = state.with(AXIS, transformAxis(state.get(AXIS)));
|
||||
AbstractChassisBlock block = (AbstractChassisBlock) state.getBlock();
|
||||
|
||||
for (Direction face : Direction.values()) {
|
||||
for (Direction face : Iterate.directions) {
|
||||
BooleanProperty glueableSide = block.getGlueableSide(rotated, face);
|
||||
if (glueableSide != null)
|
||||
rotated = rotated.with(glueableSide, false);
|
||||
}
|
||||
|
||||
for (Direction face : Direction.values()) {
|
||||
for (Direction face : Iterate.directions) {
|
||||
BooleanProperty glueableSide = block.getGlueableSide(state, face);
|
||||
if (glueableSide == null || !state.get(glueableSide))
|
||||
continue;
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Set;
|
|||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
|
||||
|
||||
|
@ -38,6 +39,15 @@ public abstract class TranslatingContraption extends Contraption {
|
|||
return cachedColliders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBlocksFromWorld(IWorld world, BlockPos offset) {
|
||||
int count = blocks.size();
|
||||
super.removeBlocksFromWorld(world, offset);
|
||||
if (count != blocks.size()) {
|
||||
cachedColliders = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canAxisBeStabilized(Axis axis) {
|
||||
return false;
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.simibubi.create.AllItems;
|
|||
import com.simibubi.create.AllSoundEvents;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.RotatedPillarBlock;
|
||||
|
@ -56,7 +57,7 @@ public abstract class AbstractChassisBlock extends RotatedPillarBlock implements
|
|||
return ActionResultType.PASS;
|
||||
|
||||
if (isSlimeBall && state.get(affectedSide)) {
|
||||
for (Direction face : Direction.values()) {
|
||||
for (Direction face : Iterate.directions) {
|
||||
BooleanProperty glueableSide = getGlueableSide(state, face);
|
||||
if (glueableSide != null && !state.get(glueableSide)) {
|
||||
if (worldIn.isRemote) {
|
||||
|
@ -95,13 +96,13 @@ public abstract class AbstractChassisBlock extends RotatedPillarBlock implements
|
|||
return state;
|
||||
|
||||
BlockState rotated = super.rotate(state, rotation);
|
||||
for (Direction face : Direction.values()) {
|
||||
for (Direction face : Iterate.directions) {
|
||||
BooleanProperty glueableSide = getGlueableSide(rotated, face);
|
||||
if (glueableSide != null)
|
||||
rotated = rotated.with(glueableSide, false);
|
||||
}
|
||||
|
||||
for (Direction face : Direction.values()) {
|
||||
for (Direction face : Iterate.directions) {
|
||||
BooleanProperty glueableSide = getGlueableSide(state, face);
|
||||
if (glueableSide == null || !state.get(glueableSide))
|
||||
continue;
|
||||
|
@ -120,13 +121,13 @@ public abstract class AbstractChassisBlock extends RotatedPillarBlock implements
|
|||
return state;
|
||||
|
||||
BlockState mirrored = state;
|
||||
for (Direction face : Direction.values()) {
|
||||
for (Direction face : Iterate.directions) {
|
||||
BooleanProperty glueableSide = getGlueableSide(mirrored, face);
|
||||
if (glueableSide != null)
|
||||
mirrored = mirrored.with(glueableSide, false);
|
||||
}
|
||||
|
||||
for (Direction face : Direction.values()) {
|
||||
for (Direction face : Iterate.directions) {
|
||||
BooleanProperty glueableSide = getGlueableSide(state, face);
|
||||
if (glueableSide == null || !state.get(glueableSide))
|
||||
continue;
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
|||
import com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.BulkScrollValueBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -122,7 +123,7 @@ public class ChassisTileEntity extends SmartTileEntity {
|
|||
}
|
||||
|
||||
// Collect group of connected linear chassis
|
||||
for (Direction offset : Direction.values()) {
|
||||
for (Direction offset : Iterate.directions) {
|
||||
if (offset.getAxis() == axis)
|
||||
continue;
|
||||
BlockPos current = pos.offset(offset);
|
||||
|
@ -187,7 +188,7 @@ public class ChassisTileEntity extends SmartTileEntity {
|
|||
AbstractChassisBlock block = (AbstractChassisBlock) state.getBlock();
|
||||
int chassisRange = visualize ? range.scrollableValue : getRange();
|
||||
|
||||
for (Direction facing : Direction.values()) {
|
||||
for (Direction facing : Iterate.directions) {
|
||||
if (facing.getAxis() == axis)
|
||||
continue;
|
||||
if (!state.get(block.getGlueableSide(state, facing)))
|
||||
|
@ -215,7 +216,7 @@ public class ChassisTileEntity extends SmartTileEntity {
|
|||
if (!searchPos.equals(pos))
|
||||
positions.add(searchPos);
|
||||
|
||||
for (Direction offset : Direction.values()) {
|
||||
for (Direction offset : Iterate.directions) {
|
||||
if (offset.getAxis() == axis)
|
||||
continue;
|
||||
if (searchPos.equals(pos) && offset != facing)
|
||||
|
|
|
@ -81,8 +81,7 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
|||
world.setBlockState(offset, Blocks.AIR.getDefaultState(), 66);
|
||||
}
|
||||
|
||||
if (contraption != null && !contraption.getBlocks()
|
||||
.isEmpty()) {
|
||||
if (!contraption.getBlocks().isEmpty()) {
|
||||
contraption.removeBlocksFromWorld(world, BlockPos.ZERO);
|
||||
movedContraption = ControlledContraptionEntity.create(world, this, contraption);
|
||||
movedContraption.setPosition(anchor.getX(), anchor.getY(), anchor.getZ());
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock;
|
|||
import com.simibubi.create.foundation.advancement.AllTriggers;
|
||||
import com.simibubi.create.foundation.block.ITE;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
|
||||
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
|
@ -44,7 +45,7 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
|
|||
|
||||
@Override
|
||||
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
|
||||
for (Direction direction : Direction.values()) {
|
||||
for (Direction direction : Iterate.directions) {
|
||||
BlockPos neighbourPos = pos.offset(direction);
|
||||
BlockState neighbourState = worldIn.getBlockState(neighbourPos);
|
||||
if (!AllBlocks.WATER_WHEEL.has(neighbourState))
|
||||
|
@ -77,7 +78,7 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
|
|||
}
|
||||
|
||||
public void updateAllSides(BlockState state, World worldIn, BlockPos pos) {
|
||||
for (Direction d : Direction.values())
|
||||
for (Direction d : Iterate.directions)
|
||||
updateFlowAt(state, worldIn, pos, d);
|
||||
updateWheelSpeed(worldIn, pos);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.Map;
|
|||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.contraptions.base.GeneratingKineticTileEntity;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
|
@ -19,7 +20,7 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity {
|
|||
public WaterWheelTileEntity(TileEntityType<? extends WaterWheelTileEntity> type) {
|
||||
super(type);
|
||||
flows = new HashMap<>();
|
||||
for (Direction d : Direction.values())
|
||||
for (Direction d : Iterate.directions)
|
||||
setFlow(d, 0);
|
||||
setLazyTickRate(20);
|
||||
}
|
||||
|
@ -28,7 +29,7 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity {
|
|||
protected void read(CompoundNBT compound, boolean clientPacket) {
|
||||
super.read(compound, clientPacket);
|
||||
if (compound.contains("Flows")) {
|
||||
for (Direction d : Direction.values())
|
||||
for (Direction d : Iterate.directions)
|
||||
setFlow(d, compound.getCompound("Flows")
|
||||
.getFloat(d.getName()));
|
||||
}
|
||||
|
@ -42,7 +43,7 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity {
|
|||
@Override
|
||||
public void write(CompoundNBT compound, boolean clientPacket) {
|
||||
CompoundNBT flows = new CompoundNBT();
|
||||
for (Direction d : Direction.values())
|
||||
for (Direction d : Iterate.directions)
|
||||
flows.putFloat(d.getName(), this.flows.get(d));
|
||||
compound.put("Flows", flows);
|
||||
|
||||
|
|
|
@ -3,13 +3,18 @@ package com.simibubi.create.content.contraptions.goggles;
|
|||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonExtensionPoleBlock;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonPolePlacementHelper;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.gui.GuiGameElement;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBox;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.outliner.Outline;
|
||||
import com.simibubi.create.foundation.utility.outliner.Outliner.OutlineEntry;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
|
@ -30,12 +35,15 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation.spacing;
|
||||
|
||||
@EventBusSubscriber(value = Dist.CLIENT)
|
||||
public class GoggleOverlayRenderer {
|
||||
|
||||
private static final Map<Object, OutlineEntry> outlines = CreateClient.outliner.getOutlines();
|
||||
|
||||
@SubscribeEvent
|
||||
public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEvent.Post event) {
|
||||
if (event.getType() != ElementType.HOTBAR)
|
||||
|
@ -45,6 +53,15 @@ public class GoggleOverlayRenderer {
|
|||
if (!(objectMouseOver instanceof BlockRayTraceResult))
|
||||
return;
|
||||
|
||||
for (OutlineEntry entry : outlines.values()) {
|
||||
if (!entry.isAlive())
|
||||
continue;
|
||||
Outline outline = entry.getOutline();
|
||||
if (outline instanceof ValueBox && !((ValueBox) outline).isPassive) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BlockRayTraceResult result = (BlockRayTraceResult) objectMouseOver;
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
ClientWorld world = mc.world;
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.simibubi.create.AllBlocks;
|
|||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.content.contraptions.base.IRotate;
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerBlock;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -55,7 +56,7 @@ public class CogWheelBlock extends AbstractShaftBlock {
|
|||
|
||||
@Override
|
||||
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
|
||||
for (Direction facing : Direction.values()) {
|
||||
for (Direction facing : Iterate.directions) {
|
||||
if (facing.getAxis() == state.get(AXIS))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.simibubi.create.AllTileEntities;
|
|||
import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -62,7 +63,7 @@ public class EncasedBeltBlock extends RotatedPillarKineticBlock {
|
|||
axis = placedAxis;
|
||||
|
||||
BlockState state = getDefaultState().with(AXIS, axis);
|
||||
for (Direction facing : Direction.values()) {
|
||||
for (Direction facing : Iterate.directions) {
|
||||
if (facing.getAxis() == axis)
|
||||
continue;
|
||||
BlockPos pos = context.getPos();
|
||||
|
@ -130,7 +131,7 @@ public class EncasedBeltBlock extends RotatedPillarKineticBlock {
|
|||
.updateNeighbors(context.getWorld(), context.getPos(), 1);
|
||||
Axis axis = newState.get(AXIS);
|
||||
newState = getDefaultState().with(AXIS, axis);
|
||||
for (Direction facing : Direction.values()) {
|
||||
for (Direction facing : Iterate.directions) {
|
||||
if (facing.getAxis() == axis)
|
||||
continue;
|
||||
BlockPos pos = context.getPos();
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.simibubi.create.content.contraptions.base.IRotate;
|
|||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -30,7 +31,7 @@ public class SplitShaftRenderer extends KineticTileEntityRenderer {
|
|||
final BlockPos pos = te.getPos();
|
||||
float time = AnimationTickHolder.getRenderTick();
|
||||
|
||||
for (Direction direction : Direction.values()) {
|
||||
for (Direction direction : Iterate.directions) {
|
||||
Axis axis = direction.getAxis();
|
||||
if (boxAxis != axis)
|
||||
continue;
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.simibubi.create.AllTileEntities;
|
|||
import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock;
|
||||
import com.simibubi.create.content.contraptions.base.IRotate;
|
||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
|
||||
|
@ -143,7 +144,7 @@ public class GaugeBlock extends DirectionalAxisKineticBlock {
|
|||
return;
|
||||
int color = gaugeTE.color;
|
||||
|
||||
for (Direction face : Direction.values()) {
|
||||
for (Direction face : Iterate.directions) {
|
||||
if (!shouldRenderHeadOnFace(worldIn, pos, stateIn, face))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.simibubi.create.AllBlockPartials;
|
|||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.content.contraptions.relays.gauge.GaugeBlock.Type;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -46,7 +47,7 @@ public class GaugeRenderer extends KineticTileEntityRenderer {
|
|||
.renderOn(gaugeState);
|
||||
SuperByteBuffer dialBuffer = AllBlockPartials.GAUGE_DIAL.renderOn(gaugeState);
|
||||
|
||||
for (Direction facing : Direction.values()) {
|
||||
for (Direction facing : Iterate.directions) {
|
||||
if (!((GaugeBlock) gaugeState.getBlock()).shouldRenderHeadOnFace(te.getWorld(), te.getPos(), gaugeState,
|
||||
facing))
|
||||
continue;
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.simibubi.create.AllBlockPartials;
|
|||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
|
@ -28,7 +29,7 @@ public class GearboxRenderer extends KineticTileEntityRenderer {
|
|||
final BlockPos pos = te.getPos();
|
||||
float time = AnimationTickHolder.getRenderTick();
|
||||
|
||||
for (Direction direction : Direction.values()) {
|
||||
for (Direction direction : Iterate.directions) {
|
||||
final Axis axis = direction.getAxis();
|
||||
if (boxAxis == axis)
|
||||
continue;
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Map;
|
|||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.contraptions.base.IRotate;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -41,10 +42,7 @@ public class VerticalGearboxItem extends BlockItem {
|
|||
@Override
|
||||
protected boolean onBlockPlaced(BlockPos pos, World world, PlayerEntity player, ItemStack stack, BlockState state) {
|
||||
Axis prefferedAxis = null;
|
||||
for (Direction side : Direction.values()) {
|
||||
if (side.getAxis()
|
||||
.isVertical())
|
||||
continue;
|
||||
for (Direction side : Iterate.horizontalDirections) {
|
||||
BlockState blockState = world.getBlockState(pos.offset(side));
|
||||
if (blockState.getBlock() instanceof IRotate) {
|
||||
if (((IRotate) blockState.getBlock()).hasShaftTowards(world, pos.offset(side), blockState,
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.simibubi.create.foundation.config.AllConfigs;
|
|||
import com.simibubi.create.foundation.gui.ScreenOpener;
|
||||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -207,7 +208,7 @@ public class SymmetryWandItem extends Item {
|
|||
|
||||
if (world.canPlace(block, position, ISelectionContext.forEntity(player))) {
|
||||
BlockState blockState = blockSet.get(position);
|
||||
for (Direction face : Direction.values())
|
||||
for (Direction face : Iterate.directions)
|
||||
blockState = blockState.updatePostPlacement(face, world.getBlockState(position.offset(face)), world,
|
||||
position, position.offset(face));
|
||||
|
||||
|
|
|
@ -137,11 +137,11 @@ public abstract class ZapperItem extends Item {
|
|||
player.setActiveHand(hand);
|
||||
|
||||
// Check if can be used
|
||||
String msg = validateUsage(item);
|
||||
ITextComponent msg = validateUsage(item);
|
||||
if (msg != null) {
|
||||
world.playSound(player, player.getPosition(), AllSoundEvents.BLOCKZAPPER_DENY.get(), SoundCategory.BLOCKS,
|
||||
1f, 0.5f);
|
||||
player.sendStatusMessage(new StringTextComponent(TextFormatting.RED + msg), true);
|
||||
player.sendStatusMessage(msg.applyTextStyle(TextFormatting.RED), true);
|
||||
return new ActionResult<ItemStack>(ActionResultType.FAIL, item);
|
||||
}
|
||||
|
||||
|
@ -192,10 +192,10 @@ public abstract class ZapperItem extends Item {
|
|||
return new ActionResult<ItemStack>(ActionResultType.SUCCESS, item);
|
||||
}
|
||||
|
||||
public String validateUsage(ItemStack item) {
|
||||
public ITextComponent validateUsage(ItemStack item) {
|
||||
CompoundNBT tag = item.getOrCreateTag();
|
||||
if (!canActivateWithoutSelectedBlock(item) && !tag.contains("BlockUsed"))
|
||||
return Lang.translate("blockzapper.leftClickToSet");
|
||||
return Lang.createTranslationTextComponent("blockzapper.leftClickToSet");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,12 +15,14 @@ import com.simibubi.create.foundation.gui.ScreenOpener;
|
|||
import com.simibubi.create.foundation.item.ItemDescription;
|
||||
import com.simibubi.create.foundation.item.ItemDescription.Palette;
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.RedstoneLampBlock;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -47,6 +49,7 @@ import net.minecraft.world.server.ServerWorld;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.util.BlockSnapshot;
|
||||
import net.minecraftforge.common.util.Constants.BlockFlags;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
|
||||
public class BlockzapperItem extends ZapperItem {
|
||||
|
@ -92,6 +95,7 @@ public class BlockzapperItem extends ZapperItem {
|
|||
items.add(gunWithPurpurStuff);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean activate(World world, PlayerEntity player, ItemStack stack, BlockState selectedState,
|
||||
BlockRayTraceResult raytrace) {
|
||||
CompoundNBT nbt = stack.getOrCreateTag();
|
||||
|
@ -119,14 +123,15 @@ public class BlockzapperItem extends ZapperItem {
|
|||
if (!player.isCreative() && replace)
|
||||
dropBlocks(world, player, stack, face, placed);
|
||||
|
||||
for (Direction updateDirection : Direction.values())
|
||||
selectedState = selectedState.updatePostPlacement(updateDirection,
|
||||
BlockState state = selectedState;
|
||||
for (Direction updateDirection : Iterate.directions)
|
||||
state = state.updatePostPlacement(updateDirection,
|
||||
world.getBlockState(placed.offset(updateDirection)), world, placed, placed.offset(updateDirection));
|
||||
|
||||
BlockSnapshot blocksnapshot = BlockSnapshot.getBlockSnapshot(world, placed);
|
||||
IFluidState ifluidstate = world.getFluidState(placed);
|
||||
world.setBlockState(placed, ifluidstate.getBlockState(), 18);
|
||||
world.setBlockState(placed, selectedState);
|
||||
world.setBlockState(placed, ifluidstate.getBlockState(), BlockFlags.UPDATE_NEIGHBORS);
|
||||
world.setBlockState(placed, state);
|
||||
if (ForgeEventFactory.onBlockPlace(player, blocksnapshot, Direction.UP)) {
|
||||
blocksnapshot.restore(true, false);
|
||||
return false;
|
||||
|
@ -134,7 +139,7 @@ public class BlockzapperItem extends ZapperItem {
|
|||
|
||||
if (player instanceof ServerPlayerEntity && world instanceof ServerWorld) {
|
||||
ServerPlayerEntity serverPlayer = (ServerPlayerEntity) player;
|
||||
CriteriaTriggers.PLACED_BLOCK.trigger(serverPlayer, placed, new ItemStack(selectedState.getBlock()));
|
||||
CriteriaTriggers.PLACED_BLOCK.trigger(serverPlayer, placed, new ItemStack(state.getBlock()));
|
||||
|
||||
boolean fullyUpgraded = true;
|
||||
for (Components c : Components.values()) {
|
||||
|
@ -147,6 +152,9 @@ public class BlockzapperItem extends ZapperItem {
|
|||
AllTriggers.UPGRADED_ZAPPER.trigger(serverPlayer);
|
||||
}
|
||||
}
|
||||
for (BlockPos placed : selectedBlocks) {
|
||||
world.neighborChanged(placed, selectedState.getBlock(), placed);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.nbt.CompoundNBT;
|
|||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -43,10 +44,10 @@ public class WorldshaperItem extends ZapperItem {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String validateUsage(ItemStack item) {
|
||||
public ITextComponent validateUsage(ItemStack item) {
|
||||
if (!item.getOrCreateTag()
|
||||
.contains("BrushParams"))
|
||||
return Lang.translate("terrainzapper.shiftRightClickToSet");
|
||||
return Lang.createTranslationTextComponent("terrainzapper.shiftRightClickToSet");
|
||||
return super.validateUsage(item);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.mojang.blaze3d.vertex.IVertexBuilder;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
@ -32,7 +33,7 @@ public class BeltTunnelRenderer extends SmartTileEntityRenderer<BeltTunnelTileEn
|
|||
Vec3d pivot = VecHelper.voxelSpace(0, 10, 1f);
|
||||
MatrixStacker msr = MatrixStacker.of(ms);
|
||||
|
||||
for (Direction direction : Direction.values()) {
|
||||
for (Direction direction : Iterate.directions) {
|
||||
if (!te.flaps.containsKey(direction))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -109,10 +109,7 @@ public class BeltTunnelTileEntity extends SmartTileEntity {
|
|||
public void updateTunnelConnections() {
|
||||
flaps.clear();
|
||||
BlockState tunnelState = getBlockState();
|
||||
for (Direction direction : Direction.values()) {
|
||||
if (direction.getAxis()
|
||||
.isVertical())
|
||||
continue;
|
||||
for (Direction direction : Iterate.horizontalDirections) {
|
||||
BlockState blockState = world.getBlockState(pos.offset(direction));
|
||||
if (blockState.getBlock() instanceof BeltTunnelBlock)
|
||||
continue;
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.simibubi.create.content.logistics.block.inventories;
|
|||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
|
@ -62,7 +64,7 @@ public class CrateBlock extends ProperDirectionalBlock implements IWrenchable {
|
|||
|
||||
if (context.getPlayer() == null || !context.getPlayer()
|
||||
.isSneaking()) {
|
||||
for (Direction d : Direction.values()) {
|
||||
for (Direction d : Iterate.directions) {
|
||||
BlockState state = world.getBlockState(pos.offset(d));
|
||||
if (state.getBlock() == this && !state.get(DOUBLE))
|
||||
return getDefaultState().with(FACING, d)
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.simibubi.create.AllTileEntities;
|
|||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||
import com.simibubi.create.foundation.block.ITE;
|
||||
import com.simibubi.create.foundation.gui.ScreenOpener;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -115,11 +116,7 @@ public class StockpileSwitchBlock extends HorizontalBlock implements ITE<Stockpi
|
|||
BlockState state = getDefaultState();
|
||||
|
||||
Direction preferredFacing = null;
|
||||
for (Direction face : Direction.values()) {
|
||||
if (face.getAxis()
|
||||
.isVertical())
|
||||
continue;
|
||||
|
||||
for (Direction face : Iterate.horizontalDirections) {
|
||||
TileEntity te = context.getWorld()
|
||||
.getTileEntity(context.getPos()
|
||||
.offset(face));
|
||||
|
|
|
@ -327,15 +327,15 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
}
|
||||
|
||||
if (hoveredSlot != null && !hoveredSlot.getHasStack()) {
|
||||
if (hoveredSlot.getSlotIndex() == 0)
|
||||
if (hoveredSlot.slotNumber == 0)
|
||||
renderTooltip(
|
||||
TooltipHelper.cutString(Lang.translate(_slotSchematic), TextFormatting.GRAY, TextFormatting.BLUE),
|
||||
mouseX, mouseY);
|
||||
if (hoveredSlot.getSlotIndex() == 2)
|
||||
if (hoveredSlot.slotNumber == 2)
|
||||
renderTooltip(
|
||||
TooltipHelper.cutString(Lang.translate(_slotListPrinter), TextFormatting.GRAY, TextFormatting.BLUE),
|
||||
mouseX, mouseY);
|
||||
if (hoveredSlot.getSlotIndex() == 4)
|
||||
if (hoveredSlot.slotNumber == 4)
|
||||
renderTooltip(
|
||||
TooltipHelper.cutString(Lang.translate(_slotGunpowder), TextFormatting.GRAY, TextFormatting.BLUE),
|
||||
mouseX, mouseY);
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode;
|
|||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
|
@ -143,7 +144,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
|||
public void findInventories() {
|
||||
hasCreativeCrate = false;
|
||||
attachedInventories.clear();
|
||||
for (Direction facing : Direction.values()) {
|
||||
for (Direction facing : Iterate.directions) {
|
||||
|
||||
if (!world.isBlockPresent(pos.offset(facing)))
|
||||
continue;
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour.CTContext;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -54,7 +55,7 @@ public class CTModel extends BakedModelWrapperWithData {
|
|||
|
||||
protected CTData createCTData(ILightReader world, BlockPos pos, BlockState state) {
|
||||
CTData data = new CTData();
|
||||
for (Direction face : Direction.values()) {
|
||||
for (Direction face : Iterate.directions) {
|
||||
if (!Block.shouldSideBeRendered(state, world, pos, face) && !behaviour.buildContextForOccludedDirections())
|
||||
continue;
|
||||
CTSpriteShiftEntry spriteShift = behaviour.get(state, face);
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.simibubi.create.foundation.entity;
|
|||
|
||||
import java.util.Optional;
|
||||
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.IDataSerializer;
|
||||
|
@ -19,7 +21,7 @@ public class CreateDataSerializers {
|
|||
|
||||
public Optional<Direction> read(PacketBuffer buffer) {
|
||||
int i = buffer.readVarInt();
|
||||
return i == 0 ? Optional.empty() : Optional.of(Direction.values()[i - 1]);
|
||||
return i == 0 ? Optional.empty() : Optional.of(Iterate.directions[i - 1]);
|
||||
}
|
||||
|
||||
public Optional<Direction> copyValue(Optional<Direction> opt) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.Random;
|
|||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.simibubi.create.foundation.renderState.RenderTypes;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -81,7 +82,7 @@ public class PartialItemModelRenderer {
|
|||
Random random = new Random();
|
||||
IModelData data = EmptyModelData.INSTANCE;
|
||||
|
||||
for (Direction direction : Direction.values()) {
|
||||
for (Direction direction : Iterate.directions) {
|
||||
random.setSeed(42L);
|
||||
ir.renderBakedItemQuads(ms, p_229114_6_, model.getQuads((BlockState) null, direction, random, data), stack,
|
||||
light, overlay);
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ValueBox extends ChasingAABBOutline {
|
|||
|
||||
protected int passiveColor;
|
||||
protected int highlightColor;
|
||||
protected boolean isPassive;
|
||||
public boolean isPassive;
|
||||
|
||||
protected BlockPos pos;
|
||||
protected ValueBoxTransform transform;
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.RaycastHelper;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -64,7 +65,7 @@ public class EdgeInteractionHandler {
|
|||
if (Block.hasSolidSide(world.getBlockState(pos.offset(face)), world, pos.offset(face), face.getOpposite()))
|
||||
return sides;
|
||||
|
||||
for (Direction direction : Direction.values()) {
|
||||
for (Direction direction : Iterate.directions) {
|
||||
if (direction.getAxis() == face.getAxis())
|
||||
continue;
|
||||
BlockPos neighbourPos = pos.offset(direction);
|
||||
|
|
|
@ -124,7 +124,7 @@ public class TreeCutter {
|
|||
leaves.add(currentPos);
|
||||
|
||||
int distance = isLog ? 0 : blockState.get(LeavesBlock.DISTANCE);
|
||||
for (Direction direction : Direction.values()) {
|
||||
for (Direction direction : Iterate.directions) {
|
||||
BlockPos offset = currentPos.offset(direction);
|
||||
if (visited.contains(offset))
|
||||
continue;
|
||||
|
@ -182,7 +182,7 @@ public class TreeCutter {
|
|||
if (!lowerLayer && !pos.equals(currentPos.down()) && isLog(reader.getBlockState(currentPos.down())))
|
||||
return false;
|
||||
|
||||
for (Direction direction : Direction.values()) {
|
||||
for (Direction direction : Iterate.directions) {
|
||||
if (direction == Direction.DOWN)
|
||||
continue;
|
||||
if (direction == Direction.UP && !lowerLayer)
|
||||
|
|
|
@ -36,7 +36,7 @@ public class VoxelShaper {
|
|||
}
|
||||
|
||||
public static VoxelShaper forDirectional(VoxelShape shape, Direction facing){
|
||||
return forDirectionsWithRotation(shape, facing, Arrays.asList(Direction.values()), new DefaultRotationValues());
|
||||
return forDirectionsWithRotation(shape, facing, Arrays.asList(Iterate.directions), new DefaultRotationValues());
|
||||
}
|
||||
|
||||
public static VoxelShaper forAxis(VoxelShape shape, Axis along){
|
||||
|
|
|
@ -21,7 +21,11 @@ import net.minecraft.util.math.Vec3d;
|
|||
|
||||
public class Outliner {
|
||||
|
||||
Map<Object, OutlineEntry> outlines;
|
||||
final Map<Object, OutlineEntry> outlines;
|
||||
|
||||
public Map<Object, OutlineEntry> getOutlines() {
|
||||
return Collections.unmodifiableMap(outlines);
|
||||
}
|
||||
|
||||
// Facade
|
||||
|
||||
|
@ -136,7 +140,7 @@ public class Outliner {
|
|||
if (entry.ticksTillRemoval < 0) {
|
||||
|
||||
int prevTicks = entry.ticksTillRemoval + 1;
|
||||
float fadeticks = (float) OutlineEntry.fadeTicks;
|
||||
float fadeticks = OutlineEntry.fadeTicks;
|
||||
float lastAlpha = prevTicks >= 0 ? 1 : 1 + (prevTicks / fadeticks);
|
||||
float currentAlpha = 1 + (entry.ticksTillRemoval / fadeticks);
|
||||
float alpha = MathHelper.lerp(Minecraft.getInstance()
|
||||
|
@ -150,7 +154,7 @@ public class Outliner {
|
|||
});
|
||||
}
|
||||
|
||||
private class OutlineEntry {
|
||||
public static class OutlineEntry {
|
||||
|
||||
static final int fadeTicks = 8;
|
||||
private Outline outline;
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.Random;
|
|||
|
||||
import com.simibubi.create.content.curiosities.tools.SandPaperItem;
|
||||
import com.simibubi.create.content.palettes.MetalBlock;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -54,7 +55,7 @@ public class OxidizingBlock extends MetalBlock {
|
|||
int currentState = state.get(OXIDIZATION);
|
||||
boolean canIncrease = false;
|
||||
LinkedList<Integer> neighbors = new LinkedList<>();
|
||||
for (Direction facing : Direction.values()) {
|
||||
for (Direction facing : Iterate.directions) {
|
||||
BlockPos neighbourPos = pos.offset(facing);
|
||||
if (!worldIn.isAreaLoaded(neighbourPos, 0))
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue