mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-04-22 10:43:13 +00:00
[1.16] Make blocks rotatable for structures (#1083)
This commit is contained in:
parent
6239dbe9ca
commit
e909e11e05
@ -4,5 +4,5 @@ mod_version=1.100.5
|
||||
# Minecraft properties (update mods.toml when changing)
|
||||
mc_version=1.16.5
|
||||
mapping_version=2021.08.08
|
||||
forge_version=36.2.20
|
||||
forge_version=36.2.34
|
||||
# NO SERIOUSLY, UPDATE mods.toml WHEN CHANGING
|
||||
|
@ -18,6 +18,8 @@ import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@ -50,6 +52,20 @@ public class BlockComputer extends BlockComputerBase<TileComputer>
|
||||
return defaultBlockState().setValue( FACING, placement.getHorizontalDirection().getOpposite() );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState mirror( BlockState state, Mirror mirrorIn )
|
||||
{
|
||||
return state.rotate( mirrorIn.getRotation( state.getValue( FACING ) ) );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState rotate( BlockState state, Rotation rot )
|
||||
{
|
||||
return state.setValue( FACING, rot.rotate( state.getValue( FACING ) ) );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
protected ItemStack getItem( TileComputerBase tile )
|
||||
|
@ -21,6 +21,8 @@ import net.minecraft.stats.Stats;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.INameable;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -47,6 +49,20 @@ public class BlockDiskDrive extends BlockGeneric
|
||||
properties.add( FACING, STATE );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState mirror( BlockState state, Mirror mirrorIn )
|
||||
{
|
||||
return state.rotate( mirrorIn.getRotation( state.getValue( FACING ) ) );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState rotate( BlockState state, Rotation rot )
|
||||
{
|
||||
return state.setValue( FACING, rot.rotate( state.getValue( FACING ) ) );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockState getStateForPlacement( BlockItemUseContext placement )
|
||||
|
@ -18,6 +18,8 @@ import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
@ -94,4 +96,18 @@ public class BlockWirelessModem extends BlockGeneric implements IWaterLoggable
|
||||
.setValue( FACING, placement.getClickedFace().getOpposite() )
|
||||
.setValue( WATERLOGGED, getWaterloggedStateForPlacement( placement ) );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState mirror( BlockState state, Mirror mirrorIn )
|
||||
{
|
||||
return state.rotate( mirrorIn.getRotation( state.getValue( FACING ) ) );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState rotate( BlockState state, Rotation rot )
|
||||
{
|
||||
return state.setValue( FACING, rot.rotate( state.getValue( FACING ) ) );
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
@ -51,6 +53,20 @@ public class BlockMonitor extends BlockGeneric
|
||||
builder.add( ORIENTATION, FACING, STATE );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState mirror( BlockState state, Mirror mirrorIn )
|
||||
{
|
||||
return state.rotate( mirrorIn.getRotation( state.getValue( FACING ) ) );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState rotate( BlockState state, Rotation rot )
|
||||
{
|
||||
return state.setValue( FACING, rot.rotate( state.getValue( FACING ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BlockState getStateForPlacement( BlockItemUseContext context )
|
||||
|
@ -21,6 +21,8 @@ import net.minecraft.stats.Stats;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.INameable;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -48,6 +50,20 @@ public class BlockPrinter extends BlockGeneric
|
||||
properties.add( FACING, TOP, BOTTOM );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState mirror( BlockState state, Mirror mirrorIn )
|
||||
{
|
||||
return state.rotate( mirrorIn.getRotation( state.getValue( FACING ) ) );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState rotate( BlockState state, Rotation rot )
|
||||
{
|
||||
return state.setValue( FACING, rot.rotate( state.getValue( FACING ) ) );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockState getStateForPlacement( BlockItemUseContext placement )
|
||||
|
@ -14,7 +14,10 @@ import net.minecraft.state.DirectionProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockSpeaker extends BlockGeneric
|
||||
@ -34,6 +37,20 @@ public class BlockSpeaker extends BlockGeneric
|
||||
properties.add( FACING );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState mirror( BlockState state, Mirror mirrorIn )
|
||||
{
|
||||
return state.rotate( mirrorIn.getRotation( state.getValue( FACING ) ) );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState rotate( BlockState state, Rotation rot )
|
||||
{
|
||||
return state.setValue( FACING, rot.rotate( state.getValue( FACING ) ) );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockState getStateForPlacement( BlockItemUseContext placement )
|
||||
|
@ -29,7 +29,9 @@ import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
@ -71,6 +73,20 @@ public class BlockTurtle extends BlockComputerBase<TileTurtle> implements IWater
|
||||
builder.add( FACING, WATERLOGGED );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState mirror( BlockState state, Mirror mirrorIn )
|
||||
{
|
||||
return state.rotate( mirrorIn.getRotation( state.getValue( FACING ) ) );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState rotate( BlockState state, Rotation rot )
|
||||
{
|
||||
return state.setValue( FACING, rot.rotate( state.getValue( FACING ) ) );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@Deprecated
|
||||
|
@ -20,6 +20,6 @@ CC: Tweaked is a fork of ComputerCraft, adding programmable computers, turtles a
|
||||
[[dependencies.computercraft]]
|
||||
modId="forge"
|
||||
mandatory=true
|
||||
versionRange="[36.2.20,37)"
|
||||
versionRange="[36.2.34,37)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
Loading…
x
Reference in New Issue
Block a user