Skip to content

Commit

Permalink
Update to 0.2.0+prealpha.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Codetoil committed Feb 5, 2023
1 parent 86bcc3a commit 24ee5fe
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player
return InteractionResult.PASS;
}
SelectorOrientation current = state.getValue(REProperties.SELECTOR_ORIENTATION);
state.setValue(REProperties.SELECTOR_ORIENTATION, current.next(state));
state = state.setValue(REProperties.SELECTOR_ORIENTATION, current.next(state));
level.setBlock(pos, state, 3);
return InteractionResult.sidedSuccess(level.isClientSide);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
Expand Down Expand Up @@ -177,6 +178,14 @@ private boolean startRotation(Level level, BlockPos motorPos, Direction directio
return true;
}

@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
return (BlockState)this.defaultBlockState()
.setValue(FACING, context.getNearestLookingDirection().getOpposite().getOpposite())
.setValue(REProperties.SPINNING, Boolean.FALSE)
.setValue(REProperties.HAS_BEEN_ACTIVATED, Boolean.FALSE);
}

@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void tick(Level level, BlockPos pos, BlockState state) {
this.finalTick();
}
} else {
float f = this.progress + 0.5f;
float f = this.progress + ((this.goalOrientation == SelectorOrientation.LEFT) ? 0.25f : 0.5f);
this.progress = f;
if (this.progress >= 1.0f) {
this.progress = 1.0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public ServoMotorStructureResolver(Level level, BlockPos motorPos, Direction dir

public boolean resolve() {
this.toRotate.clear();
this.finalPos = this.motorPos.relative(this.direction); // TODO Temporary
this.finalPos = this.motorPos.relative(this.direction); // TODO Temporary. Add stick rotation.
BlockState state = this.level.getBlockState(this.finalPos);
if (!state.hasProperty(REProperties.SELECTOR_ORIENTATION))
{ // TODO Add stick rotation.
{
return false;
}
SelectorOrientation current = state.getValue(REProperties.SELECTOR_ORIENTATION);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,49 +1,95 @@
{
"variants": {
"spinning=false,facing=down": {
"spinning=false,facing=down,has_been_activated=false": {
"model": "redstoneelectronics:block/servo_motor",
"x": 90
},
"spinning=false,facing=east": {
"spinning=false,facing=east,has_been_activated=false": {
"model": "redstoneelectronics:block/servo_motor",
"y": 90
},
"spinning=false,facing=north": {
"spinning=false,facing=north,has_been_activated=false": {
"model": "redstoneelectronics:block/servo_motor"
},
"spinning=false,facing=south": {
"spinning=false,facing=south,has_been_activated=false": {
"model": "redstoneelectronics:block/servo_motor",
"y": 180
},
"spinning=false,facing=up": {
"spinning=false,facing=up,has_been_activated=false": {
"model": "redstoneelectronics:block/servo_motor",
"x": 270
},
"spinning=false,facing=west": {
"spinning=false,facing=west,has_been_activated=false": {
"model": "redstoneelectronics:block/servo_motor",
"y": 270
},
"spinning=true,facing=down": {
"model": "redstoneelectronics:block/servo_motor_spinning",
"spinning=true,facing=down,has_been_activated=false": {
"model": "redstoneelectronics:block/servo_motor",
"x": 90
},
"spinning=true,facing=east,has_been_activated=false": {
"model": "redstoneelectronics:block/servo_motor",
"y": 90
},
"spinning=true,facing=north,has_been_activated=false": {
"model": "redstoneelectronics:block/servo_motor"
},
"spinning=true,facing=south,has_been_activated=false": {
"model": "redstoneelectronics:block/servo_motor",
"y": 180
},
"spinning=true,facing=up,has_been_activated=false": {
"model": "redstoneelectronics:block/servo_motor",
"x": 270
},
"spinning=true,facing=west,has_been_activated=false": {
"model": "redstoneelectronics:block/servo_motor",
"y": 270
},
"spinning=false,facing=down,has_been_activated=true": {
"model": "redstoneelectronics:block/servo_motor",
"x": 90
},
"spinning=false,facing=east,has_been_activated=true": {
"model": "redstoneelectronics:block/servo_motor",
"y": 90
},
"spinning=false,facing=north,has_been_activated=true": {
"model": "redstoneelectronics:block/servo_motor"
},
"spinning=false,facing=south,has_been_activated=true": {
"model": "redstoneelectronics:block/servo_motor",
"y": 180
},
"spinning=false,facing=up,has_been_activated=true": {
"model": "redstoneelectronics:block/servo_motor",
"x": 270
},
"spinning=false,facing=west,has_been_activated=true": {
"model": "redstoneelectronics:block/servo_motor",
"y": 270
},
"spinning=true,facing=down,has_been_activated=true": {
"model": "redstoneelectronics:block/servo_motor",
"x": 90
},
"spinning=true,facing=east": {
"model": "redstoneelectronics:block/servo_motor_spinning",
"spinning=true,facing=east,has_been_activated=true": {
"model": "redstoneelectronics:block/servo_motor",
"y": 90
},
"spinning=true,facing=north": {
"model": "redstoneelectronics:block/servo_motor_spinning"
"spinning=true,facing=north,has_been_activated=true": {
"model": "redstoneelectronics:block/servo_motor"
},
"spinning=true,facing=south": {
"model": "redstoneelectronics:block/servo_motor_spinning",
"spinning=true,facing=south,has_been_activated=true": {
"model": "redstoneelectronics:block/servo_motor",
"y": 180
},
"spinning=true,facing=up": {
"model": "redstoneelectronics:block/servo_motor_spinning",
"spinning=true,facing=up,has_been_activated=true": {
"model": "redstoneelectronics:block/servo_motor",
"x": 270
},
"spinning=true,facing=west": {
"model": "redstoneelectronics:block/servo_motor_spinning",
"spinning=true,facing=west,has_been_activated=true": {
"model": "redstoneelectronics:block/servo_motor",
"y": 270
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "minecraft:block/dispenser_front_vertical",
"1": "minecraft:block/furnace_top",
"particle": "minecraft:block/furnace_top"
},
"elements": [
{
"from": [0, 0, 0],
"to": [16, 16, 16],
"color": 8,
"faces": {
"north": {"uv": [0, 0, 16, 16], "texture": "#missing"},
"east": {"uv": [0, 0, 16, 16], "texture": "#missing"},
"south": {"uv": [0, 0, 16, 16], "texture": "#missing"},
"west": {"uv": [0, 0, 16, 16], "texture": "#missing"},
"up": {"uv": [0, 0, 16, 16], "texture": "#missing"},
"down": {"uv": [0, 0, 16, 16], "texture": "#missing"}
"north": {"uv": [0, 0, 16, 16], "texture": "#0"},
"east": {"uv": [0, 0, 16, 16], "texture": "#1"},
"south": {"uv": [0, 0, 16, 16], "texture": "#1"},
"west": {"uv": [0, 0, 16, 16], "texture": "#1"},
"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
}
}
]
Expand Down

This file was deleted.

0 comments on commit 24ee5fe

Please sign in to comment.