-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #395 from littlecube8152/pcb-multis
PCB Multiblocks
- Loading branch information
Showing
32 changed files
with
634 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
src/main/java/supersymmetry/common/blocks/BlockConveyor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
package supersymmetry.common.blocks; | ||
|
||
import gregtech.api.cover.CoverRayTracer; | ||
import gregtech.common.items.tool.rotation.CustomBlockRotations; | ||
import gregtech.common.items.tool.rotation.ICustomRotationBehavior; | ||
import net.minecraft.block.BlockHorizontal; | ||
import net.minecraft.util.EnumFacing; | ||
import net.minecraft.util.math.RayTraceResult; | ||
import net.minecraft.world.World; | ||
import supersymmetry.api.blocks.VariantHorizontalRotatableBlock; | ||
import net.minecraft.block.SoundType; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.entity.EntityLiving; | ||
import net.minecraft.util.IStringSerializable; | ||
import net.minecraft.util.math.AxisAlignedBB; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.IBlockAccess; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import static net.minecraft.block.material.Material.IRON; | ||
|
||
public class BlockConveyor extends VariantHorizontalRotatableBlock<BlockConveyor.ConveyorType> { | ||
|
||
static final AxisAlignedBB AABB_BOTTOM_HALF = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.25D, 1.0D); | ||
|
||
public static final ICustomRotationBehavior BLOCK_FLAT_HORIZONTAL_BEHAVIOR = new ICustomRotationBehavior() { | ||
|
||
@Override | ||
public boolean customRotate(IBlockState state, World world, BlockPos pos, RayTraceResult hitResult) { | ||
// Prohibit rotate other than up/down faces, as base GT does not support non-square faces | ||
if (hitResult.sideHit != EnumFacing.UP && hitResult.sideHit != EnumFacing.DOWN) | ||
return false; | ||
// The rest is the same with BLOCK_HORIZONTAL_BEHAVIOR | ||
EnumFacing gridSide = CoverRayTracer.determineGridSideHit(hitResult); | ||
if (gridSide == null) return false; | ||
if (gridSide.getAxis() == EnumFacing.Axis.Y) return false; | ||
|
||
if (gridSide != state.getValue(BlockHorizontal.FACING)) { | ||
state = state.withProperty(BlockHorizontal.FACING, gridSide); | ||
world.setBlockState(pos, state); | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean showGrid() { | ||
return false; | ||
} | ||
}; | ||
|
||
public BlockConveyor() { | ||
super(IRON); | ||
CustomBlockRotations.registerCustomRotation(this, BLOCK_FLAT_HORIZONTAL_BEHAVIOR); | ||
setTranslationKey("conveyor_belt"); | ||
setHardness(5.0f); | ||
setResistance(10.0f); | ||
setSoundType(SoundType.METAL); | ||
setHarvestLevel("wrench", 2); | ||
setDefaultState(getState(ConveyorType.LV_CONVEYOR)); | ||
} | ||
|
||
@Override | ||
public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, | ||
@NotNull EntityLiving.SpawnPlacementType type) { | ||
return false; | ||
} | ||
|
||
@Override | ||
@NotNull | ||
@SuppressWarnings("deprecation") | ||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) | ||
{ | ||
return AABB_BOTTOM_HALF; | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("deprecation") | ||
public boolean isFullCube(@NotNull IBlockState state) { | ||
return false; | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("deprecation") | ||
public boolean isOpaqueCube(@NotNull IBlockState state) { | ||
return false; | ||
} | ||
|
||
public enum ConveyorType implements IStringSerializable { | ||
LV_CONVEYOR("lv"); | ||
|
||
public final String name; | ||
|
||
ConveyorType(String name) { | ||
this.name = name; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public String getName() { | ||
return this.name; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public String toString() { | ||
return getName(); | ||
} | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
src/main/java/supersymmetry/common/blocks/BlockDrillBit.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package supersymmetry.common.blocks; | ||
|
||
import gregtech.api.block.IStateHarvestLevel; | ||
import gregtech.api.block.VariantBlock; | ||
import net.minecraft.block.SoundType; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.entity.EntityLiving; | ||
import net.minecraft.util.BlockRenderLayer; | ||
import net.minecraft.util.IStringSerializable; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.IBlockAccess; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
public class BlockDrillBit extends VariantBlock<BlockDrillBit.DrillBitType> { | ||
public BlockDrillBit(){ | ||
super(net.minecraft.block.material.Material.IRON); | ||
setTranslationKey("drill_bit"); | ||
setHardness(5.0f); | ||
setResistance(10.0f); | ||
setSoundType(SoundType.METAL); | ||
setHarvestLevel("wrench", 2); | ||
setDefaultState(getState(DrillBitType.STEEL)); | ||
} | ||
|
||
@Override | ||
public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos, | ||
@NotNull EntityLiving.SpawnPlacementType type) { | ||
return false; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public BlockRenderLayer getRenderLayer() { | ||
return BlockRenderLayer.SOLID; | ||
} | ||
|
||
public enum DrillBitType implements IStringSerializable, IStateHarvestLevel { | ||
STEEL("steel", 3); | ||
|
||
private final String name; | ||
private final int harvestLevel; | ||
|
||
DrillBitType(String name, int harvestLevel) { | ||
this.name = name; | ||
this.harvestLevel = harvestLevel; | ||
} | ||
|
||
@Nonnull | ||
public String getName() { | ||
return this.name; | ||
} | ||
|
||
public int getHarvestLevel(IBlockState state) { | ||
return this.harvestLevel; | ||
} | ||
|
||
public String getHarvestTool(IBlockState state) { | ||
return "wrench"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.