Playtest VI

- Renamed sails to windmill sails
- Crushing gold ore now yields more experience nuggets
- Fixed valve handles not able to be picked up using the wrench
- Fixed andesite encased belts spawning brass textured destroy particles
- Fixed valve pipes sometimes not rotating their indicator fully
- Horizontal encased belts now render a support structure when solid blocks are above them
- Added placement assist for mechanical drills, saws and deployers
This commit is contained in:
simibubi 2023-04-21 15:11:18 +02:00
parent a925679552
commit af2c40c27d
24 changed files with 343 additions and 23 deletions

View file

@ -577,8 +577,8 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo
5616dda664dd106d576848124fc0fc1de18d0fd3 assets/create/blockstates/yellow_valve_handle.json
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
e4af08f4e51db9c4a722ebff44a04e8bd9a9dba6 assets/create/lang/en_ud.json
d2175e6c3f6eb92f6d92c9314014c175239a744e assets/create/lang/en_us.json
11c1ebd001468641aacda3e4ed11995ed37853da assets/create/lang/en_ud.json
6433e657b968debdc3f4a7f13afb3e62406fdaa8 assets/create/lang/en_us.json
487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json
b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json
3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 assets/create/models/block/acacia_window_pane_noside_alt.json
@ -4119,7 +4119,7 @@ c0f2d4de4d00504607a8f3e2d1327d754835eebe data/create/recipes/crushing/deepslate_
dedb4d7e958efa2218561686974ad9223848ec30 data/create/recipes/crushing/deepslate_copper_ore.json
2f9f26daadda2d291989bccd2b0ea5f85e3ef5ae data/create/recipes/crushing/deepslate_diamond_ore.json
ae3070fc3ae237192949ad06ebb8a4c157f7e832 data/create/recipes/crushing/deepslate_emerald_ore.json
ae0418f47a68c15247350e8b31fd24905f1bced8 data/create/recipes/crushing/deepslate_gold_ore.json
1b9512ffb1e7b2388755c51506aa6dc326388ad0 data/create/recipes/crushing/deepslate_gold_ore.json
21e591d215993dcecd92db86e14334958198d7c7 data/create/recipes/crushing/deepslate_iron_ore.json
b85ba487f2867564c10a0870b55ce213558156bf data/create/recipes/crushing/deepslate_lapis_ore.json
3384241f2441a047f9a226629238ece0b986e613 data/create/recipes/crushing/deepslate_redstone_ore.json
@ -4130,7 +4130,7 @@ f2b1c52cde3ecd83f021eff5114375e2f6526d90 data/create/recipes/crushing/diorite.js
38e958ba2e12daeed2fb0bc65a9ab9e04c98b816 data/create/recipes/crushing/diorite_recycling.json
1327589e844cb587a02167e4428fd604350d60e1 data/create/recipes/crushing/emerald_ore.json
b26b1f0dccf2ffb194ce12173890a83e93369b39 data/create/recipes/crushing/glowstone.json
ec88e04ee72d54a3ba22c8348369809a30d5a095 data/create/recipes/crushing/gold_ore.json
ed7af247e3fa35febcfd5ad54852595680e34d35 data/create/recipes/crushing/gold_ore.json
55c0656723bd5a87089965651fe268b2d2956771 data/create/recipes/crushing/golden_horse_armor.json
7ce0637578ab3198de54ac74111b6d458eaf08bd data/create/recipes/crushing/gravel.json
a7c97582bae243ab04ff5ff9914b24af25d40d59 data/create/recipes/crushing/iron_horse_armor.json
@ -4154,8 +4154,8 @@ b8321baf1d2427f5f83ac765b9f806a78414ad6a data/create/recipes/crushing/raw_alumin
d933949ff9e10b2574f72b7defdf69e01eaad902 data/create/recipes/crushing/raw_aluminum_ore.json
3602170b10ed1e0bb5e7aa806dcc73170b999517 data/create/recipes/crushing/raw_copper.json
ad62bd9e067efbc026ed7ed0a0e47232d14f2fe5 data/create/recipes/crushing/raw_copper_block.json
f2c64ade6ef62e73d7f5aa0a0706de55cf12e464 data/create/recipes/crushing/raw_gold.json
c9fc914e0762f8d9b4fef7d1c69dea6e7bae5a87 data/create/recipes/crushing/raw_gold_block.json
6b05d218a0fe8cd243bf2195ec541b25996196ad data/create/recipes/crushing/raw_gold.json
4a6b2f856fdf61083edc8a774bb94478b0a3ebe0 data/create/recipes/crushing/raw_gold_block.json
2ee02db1746e2297aa0860b5bb8554625724c964 data/create/recipes/crushing/raw_iron.json
cbdbad0020b8a48dd2f5a658e3f93ff9ab648406 data/create/recipes/crushing/raw_iron_block.json
27ecec6314eefcdb4b49ba567c243ead5a79174a data/create/recipes/crushing/raw_lead_block.json

View file

@ -433,7 +433,7 @@
"block.create.rose_quartz_lamp": "d\u026F\u0250\uA780 z\u0287\u0279\u0250n\u1F49 \u01DDso\u1D1A",
"block.create.rose_quartz_tiles": "s\u01DD\u05DF\u0131\u27D8 z\u0287\u0279\u0250n\u1F49 \u01DDso\u1D1A",
"block.create.rotation_speed_controller": "\u0279\u01DD\u05DF\u05DFo\u0279\u0287uo\u0186 p\u01DD\u01DDdS uo\u0131\u0287\u0250\u0287o\u1D1A",
"block.create.sail_frame": "\u01DD\u026F\u0250\u0279\u2132 \u05DF\u0131\u0250S",
"block.create.sail_frame": "\u01DD\u026F\u0250\u0279\u2132 \u05DF\u0131\u0250S \u05DF\u05DF\u0131\u026Fpu\u0131M",
"block.create.schematic_table": "\u01DD\u05DFq\u0250\u27D8 \u0254\u0131\u0287\u0250\u026F\u01DD\u0265\u0254S",
"block.create.schematicannon": "uouu\u0250\u0254\u0131\u0287\u0250\u026F\u01DD\u0265\u0254S",
"block.create.scorchia": "\u0250\u0131\u0265\u0254\u0279o\u0254S",
@ -565,7 +565,7 @@
"block.create.weathered_copper_tiles": "s\u01DD\u05DF\u0131\u27D8 \u0279\u01DDddo\u0186 p\u01DD\u0279\u01DD\u0265\u0287\u0250\u01DDM",
"block.create.weighted_ejector": "\u0279o\u0287\u0254\u01DD\u0638\u018E p\u01DD\u0287\u0265b\u0131\u01DDM",
"block.create.white_nixie_tube": "\u01DDqn\u27D8 \u01DD\u0131x\u0131N \u01DD\u0287\u0131\u0265M",
"block.create.white_sail": "\u05DF\u0131\u0250S \u01DD\u0287\u0131\u0265M",
"block.create.white_sail": "\u05DF\u0131\u0250S \u05DF\u05DF\u0131\u026Fpu\u0131M",
"block.create.white_seat": "\u0287\u0250\u01DDS \u01DD\u0287\u0131\u0265M",
"block.create.white_toolbox": "xoq\u05DFoo\u27D8 \u01DD\u0287\u0131\u0265M",
"block.create.white_valve_handle": "\u01DD\u05DFpu\u0250H \u01DD\u028C\u05DF\u0250\u039B \u01DD\u0287\u0131\u0265M",

View file

@ -436,7 +436,7 @@
"block.create.rose_quartz_lamp": "Rose Quartz Lamp",
"block.create.rose_quartz_tiles": "Rose Quartz Tiles",
"block.create.rotation_speed_controller": "Rotation Speed Controller",
"block.create.sail_frame": "Sail Frame",
"block.create.sail_frame": "Windmill Sail Frame",
"block.create.schematic_table": "Schematic Table",
"block.create.schematicannon": "Schematicannon",
"block.create.scorchia": "Scorchia",
@ -568,7 +568,7 @@
"block.create.weathered_copper_tiles": "Weathered Copper Tiles",
"block.create.weighted_ejector": "Weighted Ejector",
"block.create.white_nixie_tube": "White Nixie Tube",
"block.create.white_sail": "White Sail",
"block.create.white_sail": "Windmill Sail",
"block.create.white_seat": "White Seat",
"block.create.white_toolbox": "White Toolbox",
"block.create.white_valve_handle": "White Valve Handle",

View file

@ -16,6 +16,7 @@
},
{
"item": "create:experience_nugget",
"count": 2,
"chance": 0.75
},
{

View file

@ -15,6 +15,7 @@
},
{
"item": "create:experience_nugget",
"count": 2,
"chance": 0.75
},
{

View file

@ -11,6 +11,7 @@
},
{
"item": "create:experience_nugget",
"count": 2,
"chance": 0.75
}
],

View file

@ -12,7 +12,7 @@
},
{
"item": "create:experience_nugget",
"count": 9,
"count": 18,
"chance": 0.75
}
],

View file

@ -1450,6 +1450,7 @@ public class AllBlocks {
.noOcclusion())
.transform(axeOnly())
.blockstate(BlockStateGen.directionalBlockProvider(false))
.lang("Windmill Sail Frame")
.tag(AllBlockTags.WINDMILL_SAILS.tag)
.tag(AllBlockTags.FAN_TRANSPARENT.tag)
.simpleItem()
@ -1463,6 +1464,7 @@ public class AllBlocks {
.noOcclusion())
.transform(axeOnly())
.blockstate(BlockStateGen.directionalBlockProvider(false))
.lang("Windmill Sail")
.tag(AllBlockTags.WINDMILL_SAILS.tag)
.item(BlankSailBlockItem::new)
.build()

View file

@ -28,6 +28,10 @@ public class AllPartialModels {
BELT_MIDDLE_BOTTOM = block("belt/middle_bottom"), BELT_END_BOTTOM = block("belt/end_bottom"),
BELT_DIAGONAL_START = block("belt/diagonal_start"), BELT_DIAGONAL_MIDDLE = block("belt/diagonal_middle"),
BELT_DIAGONAL_END = block("belt/diagonal_end"),
ANDESITE_BELT_COVER_X = block("belt_cover/andesite_belt_cover_x"),
BRASS_BELT_COVER_X = block("belt_cover/brass_belt_cover_x"),
ANDESITE_BELT_COVER_Z = block("belt_cover/andesite_belt_cover_z"),
BRASS_BELT_COVER_Z = block("belt_cover/brass_belt_cover_z"),
ENCASED_FAN_INNER = block("encased_fan/propeller"), HAND_CRANK_HANDLE = block("hand_crank/handle"),
MECHANICAL_PRESS_HEAD = block("mechanical_press/head"), MECHANICAL_MIXER_POLE = block("mechanical_mixer/pole"),

View file

@ -1,20 +1,32 @@
package com.simibubi.create.content.contraptions.components.actors;
import java.util.List;
import java.util.function.Predicate;
import javax.annotation.ParametersAreNonnullByDefault;
import com.simibubi.create.AllBlockEntityTypes;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes;
import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock;
import com.simibubi.create.foundation.block.IBE;
import com.simibubi.create.foundation.utility.placement.IPlacementHelper;
import com.simibubi.create.foundation.utility.placement.PlacementHelpers;
import com.simibubi.create.foundation.utility.placement.PlacementOffset;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis;
import net.minecraft.util.Mth;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
@ -31,6 +43,7 @@ import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
@ -39,6 +52,8 @@ import net.minecraft.world.phys.shapes.VoxelShape;
public class DrillBlock extends DirectionalKineticBlock implements IBE<DrillBlockEntity>, SimpleWaterloggedBlock {
public static DamageSource damageSourceDrill = new DamageSource("create.mechanical_drill").bypassArmor();
private static final int placementHelperId = PlacementHelpers.register(new PlacementHelper());
public DrillBlock(Properties properties) {
super(properties);
registerDefaultState(super.defaultBlockState().setValue(BlockStateProperties.WATERLOGGED, false));
@ -133,4 +148,54 @@ public class DrillBlock extends DirectionalKineticBlock implements IBE<DrillBloc
public BlockEntityType<? extends DrillBlockEntity> getBlockEntityType() {
return AllBlockEntityTypes.DRILL.get();
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand,
BlockHitResult ray) {
ItemStack heldItem = player.getItemInHand(hand);
IPlacementHelper placementHelper = PlacementHelpers.get(placementHelperId);
if (!player.isShiftKeyDown() && player.mayBuild()) {
if (placementHelper.matchesItem(heldItem)) {
placementHelper.getOffset(player, world, state, pos, ray)
.placeInWorld(world, (BlockItem) heldItem.getItem(), player, hand, ray);
return InteractionResult.SUCCESS;
}
}
return InteractionResult.PASS;
}
@MethodsReturnNonnullByDefault
private static class PlacementHelper implements IPlacementHelper {
@Override
public Predicate<ItemStack> getItemPredicate() {
return AllBlocks.MECHANICAL_DRILL::isIn;
}
@Override
public Predicate<BlockState> getStatePredicate() {
return AllBlocks.MECHANICAL_DRILL::has;
}
@Override
public PlacementOffset getOffset(Player player, Level world, BlockState state, BlockPos pos,
BlockHitResult ray) {
List<Direction> directions = IPlacementHelper.orderedByDistanceExceptAxis(pos, ray.getLocation(),
state.getValue(FACING)
.getAxis(),
dir -> world.getBlockState(pos.relative(dir))
.getMaterial()
.isReplaceable());
if (directions.isEmpty())
return PlacementOffset.fail();
else {
return PlacementOffset.success(pos.relative(directions.get(0)),
s -> s.setValue(FACING, state.getValue(FACING)));
}
}
}
}

View file

@ -4,6 +4,7 @@ import javax.annotation.ParametersAreNonnullByDefault;
import com.simibubi.create.AllBlockEntityTypes;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllShapes;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.Couple;
@ -63,6 +64,8 @@ public class ValveHandleBlock extends HandCrankBlock {
if (!(blockState.getBlock() instanceof ValveHandleBlock vhb))
return;
if (AllItems.WRENCH.isIn(player.getItemInHand(event.getHand())) && player.isSteppingCarefully())
return;
if (vhb.clicked(level, pos, blockState, player, event.getHand())) {
event.setCanceled(true);

View file

@ -1,13 +1,21 @@
package com.simibubi.create.content.contraptions.components.deployer;
import java.util.List;
import java.util.function.Predicate;
import javax.annotation.ParametersAreNonnullByDefault;
import com.simibubi.create.AllBlockEntityTypes;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllShapes;
import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock;
import com.simibubi.create.content.contraptions.base.KineticBlock;
import com.simibubi.create.content.contraptions.components.AssemblyOperatorUseContext;
import com.simibubi.create.foundation.block.IBE;
import com.simibubi.create.foundation.utility.placement.IPlacementHelper;
import com.simibubi.create.foundation.utility.placement.PlacementHelpers;
import com.simibubi.create.foundation.utility.placement.PlacementOffset;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos;
@ -17,6 +25,7 @@ import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.item.context.UseOnContext;
@ -35,6 +44,8 @@ import net.minecraft.world.phys.shapes.VoxelShape;
@MethodsReturnNonnullByDefault
public class DeployerBlock extends DirectionalAxisKineticBlock implements IBE<DeployerBlockEntity> {
private static final int placementHelperId = PlacementHelpers.register(new PlacementHelper());
public DeployerBlock(Properties properties) {
super(properties);
}
@ -65,7 +76,7 @@ public class DeployerBlock extends DirectionalAxisKineticBlock implements IBE<De
if (placer instanceof ServerPlayer)
withBlockEntityDo(worldIn, pos, dbe -> dbe.owner = placer.getUUID());
}
@Override
public void onRemove(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
if (!isMoving && !state.is(newState.getBlock()))
@ -78,6 +89,15 @@ public class DeployerBlock extends DirectionalAxisKineticBlock implements IBE<De
BlockHitResult hit) {
ItemStack heldByPlayer = player.getItemInHand(handIn)
.copy();
IPlacementHelper placementHelper = PlacementHelpers.get(placementHelperId);
if (!player.isShiftKeyDown() && player.mayBuild()) {
if (placementHelper.matchesItem(heldByPlayer) && placementHelper.getOffset(player, worldIn, state, pos, hit)
.placeInWorld(worldIn, (BlockItem) heldByPlayer.getItem(), player, handIn, hit)
.consumesAction())
return InteractionResult.SUCCESS;
}
if (AllItems.WRENCH.isIn(heldByPlayer))
return InteractionResult.PASS;
@ -134,4 +154,36 @@ public class DeployerBlock extends DirectionalAxisKineticBlock implements IBE<De
else
return super.getFacingForPlacement(context);
}
@MethodsReturnNonnullByDefault
private static class PlacementHelper implements IPlacementHelper {
@Override
public Predicate<ItemStack> getItemPredicate() {
return AllBlocks.DEPLOYER::isIn;
}
@Override
public Predicate<BlockState> getStatePredicate() {
return AllBlocks.DEPLOYER::has;
}
@Override
public PlacementOffset getOffset(Player player, Level world, BlockState state, BlockPos pos,
BlockHitResult ray) {
List<Direction> directions = IPlacementHelper.orderedByDistanceOnlyAxis(pos, ray.getLocation(),
((KineticBlock) state.getBlock()).getRotationAxis(state), dir -> world.getBlockState(pos.relative(dir))
.getMaterial()
.isReplaceable());
if (directions.isEmpty())
return PlacementOffset.fail();
else {
return PlacementOffset.success(pos.relative(directions.get(0)),
s -> s.setValue(FACING, state.getValue(FACING))
.setValue(AXIS_ALONG_FIRST_COORDINATE, state.getValue(AXIS_ALONG_FIRST_COORDINATE)));
}
}
}
}

View file

@ -1,12 +1,19 @@
package com.simibubi.create.content.contraptions.components.saw;
import java.util.List;
import java.util.function.Predicate;
import javax.annotation.ParametersAreNonnullByDefault;
import com.simibubi.create.AllBlockEntityTypes;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes;
import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock;
import com.simibubi.create.content.contraptions.components.actors.DrillBlock;
import com.simibubi.create.foundation.block.IBE;
import com.simibubi.create.foundation.utility.placement.IPlacementHelper;
import com.simibubi.create.foundation.utility.placement.PlacementHelpers;
import com.simibubi.create.foundation.utility.placement.PlacementOffset;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos;
@ -18,6 +25,7 @@ import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
@ -37,6 +45,8 @@ import net.minecraft.world.phys.shapes.VoxelShape;
public class SawBlock extends DirectionalAxisKineticBlock implements IBE<SawBlockEntity> {
public static DamageSource damageSourceSaw = new DamageSource("create.mechanical_saw").bypassArmor();
private static final int placementHelperId = PlacementHelpers.register(new PlacementHelper());
public SawBlock(Properties properties) {
super(properties);
}
@ -59,12 +69,22 @@ public class SawBlock extends DirectionalAxisKineticBlock implements IBE<SawBloc
@Override
public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn,
BlockHitResult hit) {
ItemStack heldItem = player.getItemInHand(handIn);
IPlacementHelper placementHelper = PlacementHelpers.get(placementHelperId);
if (!player.isShiftKeyDown() && player.mayBuild()) {
if (placementHelper.matchesItem(heldItem) && placementHelper.getOffset(player, worldIn, state, pos, hit)
.placeInWorld(worldIn, (BlockItem) heldItem.getItem(), player, handIn, hit)
.consumesAction())
return InteractionResult.SUCCESS;
}
if (player.isSpectator() || !player.getItemInHand(handIn)
.isEmpty())
return InteractionResult.PASS;
if (state.getOptionalValue(FACING)
.orElse(Direction.WEST) != Direction.UP)
return InteractionResult.PASS;
return onBlockEntityUse(worldIn, pos, be -> {
for (int i = 0; i < be.inventory.getSlots(); i++) {
ItemStack heldItemStack = be.inventory.getStackInSlot(i);
@ -146,4 +166,43 @@ public class SawBlock extends DirectionalAxisKineticBlock implements IBE<SawBloc
return false;
}
@MethodsReturnNonnullByDefault
private static class PlacementHelper implements IPlacementHelper {
@Override
public Predicate<ItemStack> getItemPredicate() {
return AllBlocks.MECHANICAL_SAW::isIn;
}
@Override
public Predicate<BlockState> getStatePredicate() {
return state -> AllBlocks.MECHANICAL_SAW.has(state) && state.getValue(FACING)
.getAxis() != Axis.Y;
}
@Override
public PlacementOffset getOffset(Player player, Level world, BlockState state, BlockPos pos,
BlockHitResult ray) {
if (state.getValue(FACING)
.getAxis() == Axis.Y)
return PlacementOffset.fail();
List<Direction> directions = IPlacementHelper.orderedByDistanceOnlyAxis(pos, ray.getLocation(),
state.getValue(FACING)
.getClockWise()
.getAxis(),
dir -> world.getBlockState(pos.relative(dir))
.getMaterial()
.isReplaceable());
if (directions.isEmpty())
return PlacementOffset.fail();
else {
return PlacementOffset.success(pos.relative(directions.get(0)),
s -> s.setValue(FACING, state.getValue(FACING))
.setValue(AXIS_ALONG_FIRST_COORDINATE, state.getValue(AXIS_ALONG_FIRST_COORDINATE)));
}
}
}
}

View file

@ -16,6 +16,7 @@ import net.minecraft.util.Mth;
public class FluidValveInstance extends ShaftInstance<FluidValveBlockEntity> implements DynamicInstance {
protected ModelData pointer;
protected boolean settled;
protected final double xRot;
protected final double yRot;
@ -34,6 +35,7 @@ public class FluidValveInstance extends ShaftInstance<FluidValveBlockEntity> imp
boolean twist = pipeAxis.isHorizontal() && shaftAxis == Direction.Axis.X || pipeAxis.isVertical();
pointerRotationOffset = twist ? 90 : 0;
settled = false;
pointer = materialManager.defaultSolid()
.material(Materials.TRANSFORMED)
@ -42,15 +44,18 @@ public class FluidValveInstance extends ShaftInstance<FluidValveBlockEntity> imp
transformPointer();
}
@Override
public void beginFrame() {
if (blockEntity.pointer.settled()) return;
@Override
public void beginFrame() {
if (blockEntity.pointer.settled() && settled)
return;
transformPointer();
}
transformPointer();
}
private void transformPointer() {
float pointerRotation = Mth.lerp(blockEntity.pointer.getValue(AnimationTickHolder.getPartialTicks()), 0, -90);
private void transformPointer() {
float value = blockEntity.pointer.getValue(AnimationTickHolder.getPartialTicks());
float pointerRotation = Mth.lerp(value, 0, -90);
settled = (value == 0 || value == 1) && blockEntity.pointer.settled();
pointer.loadIdentity()
.translate(getInstancePosition())

View file

@ -24,6 +24,7 @@ import com.simibubi.create.content.contraptions.relays.belt.transport.BeltMoveme
import com.simibubi.create.content.contraptions.relays.belt.transport.BeltTunnelInteractionHandler;
import com.simibubi.create.content.curiosities.armor.DivingBootsItem;
import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock;
import com.simibubi.create.content.logistics.block.funnel.FunnelBlock;
import com.simibubi.create.content.schematics.ISpecialBlockItemRequirement;
import com.simibubi.create.content.schematics.ItemRequirement;
import com.simibubi.create.content.schematics.ItemRequirement.ItemUseType;
@ -71,6 +72,7 @@ import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
@ -299,11 +301,13 @@ public class BeltBlock extends HorizontalKineticBlock implements IBE<BeltBlockEn
if (AllBlocks.BRASS_CASING.isIn(heldItem)) {
withBlockEntityDo(world, pos, be -> be.setCasingType(CasingType.BRASS));
updateCoverProperty(world, pos, state);
return InteractionResult.SUCCESS;
}
if (AllBlocks.ANDESITE_CASING.isIn(heldItem)) {
withBlockEntityDo(world, pos, be -> be.setCasingType(CasingType.ANDESITE));
updateCoverProperty(world, pos, state);
return InteractionResult.SUCCESS;
}
@ -487,9 +491,35 @@ public class BeltBlock extends HorizontalKineticBlock implements IBE<BeltBlockEn
if (side.getAxis()
.isHorizontal())
updateTunnelConnections(world, pos.above());
if (side == Direction.UP)
updateCoverProperty(world, pos, state);
return state;
}
public void updateCoverProperty(LevelAccessor world, BlockPos pos, BlockState state) {
if (world.isClientSide())
return;
if (state.getValue(CASING) && state.getValue(SLOPE) == BeltSlope.HORIZONTAL)
withBlockEntityDo(world, pos, bbe -> bbe.setCovered(isBlockCoveringBelt(world, pos.above())));
}
public static boolean isBlockCoveringBelt(LevelAccessor world, BlockPos pos) {
BlockState blockState = world.getBlockState(pos);
VoxelShape collisionShape = blockState.getCollisionShape(world, pos);
if (collisionShape.isEmpty())
return false;
AABB bounds = collisionShape.bounds();
if (bounds.getXsize() < .5f || bounds.getZsize() < .5f)
return false;
if (bounds.minY > 0)
return false;
if (FunnelBlock.isFunnel(blockState) && FunnelBlock.getFunnelFacing(blockState) != Direction.UP)
return false;
if (blockState.getBlock() instanceof BeltTunnelBlock)
return false;
return true;
}
private void updateTunnelConnections(LevelAccessor world, BlockPos pos) {
Block tunnelBlock = world.getBlockState(pos)
.getBlock();

View file

@ -70,6 +70,7 @@ public class BeltBlockEntity extends KineticBlockEntity {
public int index;
public Direction lastInsert;
public CasingType casing;
public boolean covered;
protected BlockPos controller;
protected BeltInventory inventory;
@ -215,6 +216,7 @@ public class BeltBlockEntity extends KineticBlockEntity {
compound.putInt("Length", beltLength);
compound.putInt("Index", index);
NBTHelper.writeEnum(compound, "Casing", casing);
compound.putBoolean("Covered", covered);
if (color.isPresent())
NBTHelper.writeEnum(compound, "Dye", color.get());
@ -254,12 +256,14 @@ public class BeltBlockEntity extends KineticBlockEntity {
getInventory().read(compound.getCompound("Inventory"));
CasingType casingBefore = casing;
boolean coverBefore = covered;
casing = NBTHelper.readEnum(compound, "Casing", CasingType.class);
covered = compound.getBoolean("Covered");
if (!clientPacket)
return;
if (casingBefore == casing)
if (casingBefore == casing && coverBefore == covered)
return;
if (!isVirtual())
requestModelDataUpdate();
@ -531,6 +535,7 @@ public class BeltBlockEntity extends KineticBlockEntity {
@Override
public IModelData getModelData() {
return new ModelDataMap.Builder().withInitial(BeltModel.CASING_PROPERTY, casing)
.withInitial(BeltModel.COVER_PROPERTY, covered)
.build();
}
@ -661,4 +666,11 @@ public class BeltBlockEntity extends KineticBlockEntity {
}
}
}
public void setCovered(boolean blockCoveringBelt) {
if (blockCoveringBelt == covered)
return;
covered = blockCoveringBelt;
notifyUpdate();
}
}

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.simibubi.create.AllPartialModels;
import com.simibubi.create.AllSpriteShifts;
import com.simibubi.create.content.contraptions.relays.belt.BeltBlockEntity.CasingType;
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
@ -13,6 +14,7 @@ import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.model.BakedModelWrapper;
import net.minecraftforge.client.model.data.IModelData;
@ -21,24 +23,51 @@ import net.minecraftforge.client.model.data.ModelProperty;
public class BeltModel extends BakedModelWrapper<BakedModel> {
public static final ModelProperty<CasingType> CASING_PROPERTY = new ModelProperty<>();
public static final ModelProperty<Boolean> COVER_PROPERTY = new ModelProperty<>();
private static final SpriteShiftEntry SPRITE_SHIFT = AllSpriteShifts.ANDESIDE_BELT_CASING;
public BeltModel(BakedModel template) {
super(template);
}
@Override
public TextureAtlasSprite getParticleIcon(IModelData data) {
if (!data.hasProperty(CASING_PROPERTY))
return super.getParticleIcon(data);
CasingType type = data.getData(CASING_PROPERTY);
if (type == CasingType.NONE || type == CasingType.BRASS)
return super.getParticleIcon(data);
return AllSpriteShifts.ANDESITE_CASING.getOriginal();
}
@Override
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData extraData) {
List<BakedQuad> quads = super.getQuads(state, side, rand, extraData);
if (!extraData.hasProperty(CASING_PROPERTY))
return quads;
boolean cover = extraData.getData(COVER_PROPERTY);
CasingType type = extraData.getData(CASING_PROPERTY);
if (type == CasingType.NONE || type == CasingType.BRASS)
boolean brassCasing = type == CasingType.BRASS;
if (type == CasingType.NONE || brassCasing && !cover)
return quads;
quads = new ArrayList<>(quads);
if (cover) {
boolean alongX = state.getValue(BeltBlock.HORIZONTAL_FACING)
.getAxis() == Axis.X;
BakedModel coverModel =
(brassCasing ? alongX ? AllPartialModels.BRASS_BELT_COVER_X : AllPartialModels.BRASS_BELT_COVER_Z
: alongX ? AllPartialModels.ANDESITE_BELT_COVER_X : AllPartialModels.ANDESITE_BELT_COVER_Z).get();
quads.addAll(coverModel.getQuads(state, side, rand, extraData));
}
if (brassCasing)
return quads;
for (int i = 0; i < quads.size(); i++) {
BakedQuad quad = quads.get(i);
TextureAtlasSprite original = quad.getSprite();

View file

@ -225,7 +225,7 @@ public class CrushingRecipeGen extends ProcessingRecipeGen {
float extra = expectedAmount - Mth.floor(expectedAmount);
if (extra > 0)
builder.output(extra, raw.get(), 1);
builder.output(.75f, AllItems.EXP_NUGGET.get(), 1);
builder.output(.75f, AllItems.EXP_NUGGET.get(), raw.get() == AllItems.CRUSHED_GOLD.get() ? 2 : 1);
return builder.output(.125f, stoneType);
});
}
@ -233,7 +233,7 @@ public class CrushingRecipeGen extends ProcessingRecipeGen {
protected GeneratedRecipe rawOre(Supplier<ItemLike> input, Supplier<ItemLike> result, int amount) {
return create(input, b -> b.duration(400)
.output(result.get(), amount)
.output(.75f, AllItems.EXP_NUGGET.get(), amount));
.output(.75f, AllItems.EXP_NUGGET.get(), (result.get() == AllItems.CRUSHED_GOLD.get() ? 2 : 1) * amount));
}
protected GeneratedRecipe moddedRawOre(CompatMetals metal, Supplier<ItemLike> result, int amount) {

View file

@ -0,0 +1,21 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/funnel/andesite_funnel_frame",
"1": "create:block/andesite_belt_cover"
},
"elements": [
{
"name": "cover",
"from": [0, 11, 0],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 16, 5], "texture": "#1"},
"east": {"uv": [0, 6, 16, 11], "texture": "#1"},
"south": {"uv": [0, 0, 16, 5], "texture": "#1"},
"west": {"uv": [0, 6, 16, 11], "texture": "#1"},
"up": {"uv": [0, 0, 16, 16], "texture": "#0"}
}
}
]
}

View file

@ -0,0 +1,21 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/funnel/andesite_funnel_frame",
"1": "create:block/andesite_belt_cover"
},
"elements": [
{
"name": "cover",
"from": [0, 11, 0],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 6, 16, 11], "texture": "#1"},
"east": {"uv": [0, 0, 16, 5], "texture": "#1"},
"south": {"uv": [0, 6, 16, 11], "texture": "#1"},
"west": {"uv": [0, 0, 16, 5], "texture": "#1"},
"up": {"uv": [0, 0, 16, 16], "texture": "#0"}
}
}
]
}

View file

@ -0,0 +1,7 @@
{
"parent": "create:block/belt_cover/andesite_belt_cover_x",
"textures": {
"0": "create:block/funnel/brass_funnel_frame",
"1": "create:block/brass_belt_cover"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "create:block/belt_cover/andesite_belt_cover_z",
"textures": {
"0": "create:block/funnel/brass_funnel_frame",
"1": "create:block/brass_belt_cover"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB