Skip to content

Commit

Permalink
implement changes from 50a branch
Browse files Browse the repository at this point in the history
  • Loading branch information
LemmaEOF committed Jan 10, 2019
1 parent 6141970 commit e06431c
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 15 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ archivesBaseName = "infraredstone"


ext {
standardVersion = "1.0.1"
standardVersion = "1.0.2"
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ public boolean activate(BlockState state, World world, BlockPos pos, PlayerEntit
blockCenteredHit = blockCenteredHit.subtract(0.5, 0.5, 0.5);
switch (state.get(AndGateBlock.FACING)) {
case SOUTH:
blockCenteredHit = blockCenteredHit.rotateX((float)Math.PI);
blockCenteredHit = blockCenteredHit.rotateY((float)Math.PI);
break;
case EAST:
blockCenteredHit = blockCenteredHit.rotateX((float)Math.PI/2);
blockCenteredHit = blockCenteredHit.rotateY((float)Math.PI/2);
break;
case WEST:
blockCenteredHit = blockCenteredHit.rotateX(3*(float)Math.PI/2);
blockCenteredHit = blockCenteredHit.rotateY(3*(float)Math.PI/2);
break;
default:
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,18 @@ public boolean activate(BlockState state, World world, BlockPos pos, PlayerEntit
blockCenteredHit = blockCenteredHit.subtract(0.5, 0.5, 0.5);
switch (state.get(DiodeBlock.FACING)) {
case SOUTH:
blockCenteredHit = blockCenteredHit.rotateX((float)Math.PI);
blockCenteredHit = blockCenteredHit.rotateY((float)Math.PI);
break;
case EAST:
blockCenteredHit = blockCenteredHit.rotateX((float)Math.PI/2);
blockCenteredHit = blockCenteredHit.rotateY((float)Math.PI/2);
break;
case WEST:
blockCenteredHit = blockCenteredHit.rotateX(3*(float)Math.PI/2);
blockCenteredHit = blockCenteredHit.rotateY(3*(float)Math.PI/2);
break;
default:
break;
}
blockCenteredHit = blockCenteredHit.add(0.5, 0.5, 0.5);
System.out.println(blockCenteredHit);
DiodeBlockEntity beDiode = (DiodeBlockEntity)be;
if (CLICK_BIT_0.getBoundingBox().contains(blockCenteredHit)) {
beDiode.setMask(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
import com.elytradev.infraredstone.block.entity.InfraRedstoneBlockEntity;
import net.fabricmc.fabric.block.FabricBlockSettings;
import net.fabricmc.fabric.tags.FabricItemTags;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.VerticalEntityPosition;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.ViewableWorld;

public class InfraRedstoneBlock extends ModuleBase {

Expand All @@ -18,4 +24,24 @@ public BlockEntity createBlockEntity(BlockView world) {
return new InfraRedstoneBlockEntity();
}

@Override
public boolean canPlaceAt(BlockState state, ViewableWorld world, BlockPos pos) {
return true;
}

@Override
public boolean isSimpleFullBlock(BlockState blockState, BlockView blockView, BlockPos blockPos) {
return true;
}

@Override
public VoxelShape getCollisionShape(BlockState blockState, BlockView blockView, BlockPos blockPos, VerticalEntityPosition verticalEntityPosition) {
return VoxelShapes.fullCube();
}

@Override
public VoxelShape getBoundingShape(BlockState state, BlockView view, BlockPos pos) {
return VoxelShapes.fullCube();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.ViewableWorld;
import net.minecraft.world.World;

public class InfraRedstoneCable extends BlockBase {
Expand Down Expand Up @@ -142,4 +143,9 @@ public void onBlockRemoved(BlockState state, World world, BlockPos pos, BlockSta
public boolean canBlockStay(World world, BlockPos pos) {
return world.getBlockState(pos.down()).hasSolidTopSurface(world, pos.down()) || world.getBlockState(pos.down()).getBlock() == ModBlocks.IN_RED_SCAFFOLD;
}

@Override
public boolean canPlaceAt(BlockState state, ViewableWorld world, BlockPos pos) {
return canBlockStay((World)world, pos);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,18 @@ public boolean activate(BlockState state, World world, BlockPos pos, PlayerEntit
blockCenteredHit = blockCenteredHit.subtract(0.5, 0.5, 0.5);
switch (state.get(NotGateBlock.FACING)) {
case SOUTH:
blockCenteredHit = blockCenteredHit.rotateX((float)Math.PI);
blockCenteredHit = blockCenteredHit.rotateY((float)Math.PI);
break;
case EAST:
blockCenteredHit = blockCenteredHit.rotateX((float)Math.PI/2);
blockCenteredHit = blockCenteredHit.rotateY((float)Math.PI/2);
break;
case WEST:
blockCenteredHit = blockCenteredHit.rotateX(3*(float)Math.PI/2);
blockCenteredHit = blockCenteredHit.rotateY(3*(float)Math.PI/2);
break;
default:
break;
}
blockCenteredHit = blockCenteredHit.add(0.5, 0.5, 0.5);
// blockCenteredHit = blockCenteredHit.multiply(16);
NotGateBlockEntity beNotGate = (NotGateBlockEntity)be;
if (NOT_CLICK_BOOLEAN.getBoundingBox().contains(blockCenteredHit)) {
beNotGate.toggleBooleanMode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ public boolean activate(BlockState state, World world, BlockPos pos, PlayerEntit
blockCenteredHit = blockCenteredHit.subtract(0.5, 0.5, 0.5);
switch (state.get(XorGateBlock.FACING)) {
case SOUTH:
blockCenteredHit = blockCenteredHit.rotateX((float)Math.PI);
blockCenteredHit = blockCenteredHit.rotateY((float)Math.PI);
break;
case EAST:
blockCenteredHit = blockCenteredHit.rotateX((float)Math.PI/2);
blockCenteredHit = blockCenteredHit.rotateY((float)Math.PI/2);
break;
case WEST:
blockCenteredHit = blockCenteredHit.rotateX(3*(float)Math.PI/2);
blockCenteredHit = blockCenteredHit.rotateY(3*(float)Math.PI/2);
break;
default:
break;
Expand Down

0 comments on commit e06431c

Please sign in to comment.