Refactor and Bugs

- Added missing recipe for Dark Scoria
- Refactored Cart Assembler
- Removed reinforced rails from creative tab
- Fixed blockzappers placing waterlogged blocks #350
This commit is contained in:
simibubi 2020-06-13 20:41:08 +02:00
parent 0bee531b7e
commit 0d616b7a21
24 changed files with 461 additions and 444 deletions

View File

@ -23,7 +23,7 @@ cf9045eb16e5299a1d917c4cb536289f49411276 assets\create\blockstates\birch_window.
94a1a91403eb4b035fec48071e7fcae57a8a6abd assets\create\blockstates\birch_window_pane.json 94a1a91403eb4b035fec48071e7fcae57a8a6abd assets\create\blockstates\birch_window_pane.json
8b1dd00adcc7e74c5a9feed069e2610b15a338cb assets\create\blockstates\brass_block.json 8b1dd00adcc7e74c5a9feed069e2610b15a338cb assets\create\blockstates\brass_block.json
b8dd6e505943e06706d0718ece620ab3cf943650 assets\create\blockstates\brass_casing.json b8dd6e505943e06706d0718ece620ab3cf943650 assets\create\blockstates\brass_casing.json
dd1e9a928702415722f99d165571c2d63d847987 assets\create\blockstates\cart_assembler.json 26f3b6a8f8249e4e622ab200057d75e228762817 assets\create\blockstates\cart_assembler.json
7299cea212d879d6d5611bd139b24768b9af236f assets\create\blockstates\chiseled_dark_scoria.json 7299cea212d879d6d5611bd139b24768b9af236f assets\create\blockstates\chiseled_dark_scoria.json
0f01f813388d3e6907c1cfd992e4b21c914e267e assets\create\blockstates\chiseled_dolomite.json 0f01f813388d3e6907c1cfd992e4b21c914e267e assets\create\blockstates\chiseled_dolomite.json
324488e0c228f38f2597b2f76849e962bc1a7d90 assets\create\blockstates\chiseled_gabbro.json 324488e0c228f38f2597b2f76849e962bc1a7d90 assets\create\blockstates\chiseled_gabbro.json
@ -273,7 +273,7 @@ b7829c2ef2c47188713f8cab21b2c9bc7f9c5b79 assets\create\blockstates\portable_stor
e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets\create\blockstates\powered_toggle_latch.json e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets\create\blockstates\powered_toggle_latch.json
3a739f9d4276828d83f2d2750bf3227c87bcd438 assets\create\blockstates\pulley_magnet.json 3a739f9d4276828d83f2d2750bf3227c87bcd438 assets\create\blockstates\pulley_magnet.json
469e430d96cb0a5e1aaf6b7cc5d401d488c9e600 assets\create\blockstates\pulse_repeater.json 469e430d96cb0a5e1aaf6b7cc5d401d488c9e600 assets\create\blockstates\pulse_repeater.json
5d1b30c2bab556f57c78e7780fd445b08f541a50 assets\create\blockstates\radial_chassis.json 4e1fb033316e9230d2f024d67c27940ea731643a assets\create\blockstates\radial_chassis.json
8929677f2cc5354aa19ef182af69f9f0b41eb242 assets\create\blockstates\redstone_contact.json 8929677f2cc5354aa19ef182af69f9f0b41eb242 assets\create\blockstates\redstone_contact.json
c29213b77ac0c78d8979c5f6188d2b265696f9b9 assets\create\blockstates\redstone_link.json c29213b77ac0c78d8979c5f6188d2b265696f9b9 assets\create\blockstates\redstone_link.json
1eac804cba08aebb5f4646758ae1ef9b32e01365 assets\create\blockstates\reinforced_rail.json 1eac804cba08aebb5f4646758ae1ef9b32e01365 assets\create\blockstates\reinforced_rail.json
@ -326,7 +326,7 @@ c77b46d8b459e5c7cc495393546f3fcca8a1fa1d assets\create\blockstates\weathered_lim
7f39521b211441f5c3e06d60c5978cebe16cacfb assets\create\blockstates\zinc_block.json 7f39521b211441f5c3e06d60c5978cebe16cacfb assets\create\blockstates\zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets\create\blockstates\zinc_ore.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets\create\blockstates\zinc_ore.json
6bf74a9e1f74b41f53399c1f817942b01a010bf0 assets\create\lang\en_ud.json 6bf74a9e1f74b41f53399c1f817942b01a010bf0 assets\create\lang\en_ud.json
fd0932555a5afde9c3c5f990f78de545814cc4ab assets\create\lang\en_us.json 966d4802e7f260d852e422c5f47b2a9389557373 assets\create\lang\en_us.json
846200eb548d3bfa2e77b41039de159b4b6cfb45 assets\create\models\block\acacia_window.json 846200eb548d3bfa2e77b41039de159b4b6cfb45 assets\create\models\block\acacia_window.json
1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets\create\models\block\acacia_window_pane_noside.json 1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets\create\models\block\acacia_window_pane_noside.json
1763ea2c9b981d187f5031ba608f3d5d3be3986a assets\create\models\block\acacia_window_pane_noside_alt.json 1763ea2c9b981d187f5031ba608f3d5d3be3986a assets\create\models\block\acacia_window_pane_noside_alt.json
@ -925,7 +925,7 @@ f5a18f4279c2e845a5967b1c2f9e807c2bb77afb assets\create\models\item\brass_casing.
1786bdffa2ab5a07c88d2797db3d7b54461323c4 assets\create\models\item\brass_ingot.json 1786bdffa2ab5a07c88d2797db3d7b54461323c4 assets\create\models\item\brass_ingot.json
a37be4a0ec9bf6c381527403c57ced4f81abd67c assets\create\models\item\brass_nugget.json a37be4a0ec9bf6c381527403c57ced4f81abd67c assets\create\models\item\brass_nugget.json
14ea6ee4db6e7e76446e331a70b6b6bec31e8eb7 assets\create\models\item\brass_sheet.json 14ea6ee4db6e7e76446e331a70b6b6bec31e8eb7 assets\create\models\item\brass_sheet.json
b362b940fe9074f0a9b8d53d8a12b41f18c2c292 assets\create\models\item\cart_assembler.json 3e232a103f7f916fc11edb4d541ca99fe7b44181 assets\create\models\item\cart_assembler.json
99d64b76b3baa84c3bd4b96ccd3376ca12425950 assets\create\models\item\chiseled_dark_scoria.json 99d64b76b3baa84c3bd4b96ccd3376ca12425950 assets\create\models\item\chiseled_dark_scoria.json
83d3571eacde52568786802b268f24c6578c1e5d assets\create\models\item\chiseled_dolomite.json 83d3571eacde52568786802b268f24c6578c1e5d assets\create\models\item\chiseled_dolomite.json
afd697168c9786eb80e54eccdc6a23afa6c7fb0e assets\create\models\item\chiseled_gabbro.json afd697168c9786eb80e54eccdc6a23afa6c7fb0e assets\create\models\item\chiseled_gabbro.json

View File

@ -1,73 +1,59 @@
{ {
"variants": { "variants": {
"powered=false,rail_type=0,shape=north_south": { "powered=false,rail_type=regular,shape=north_south": {
"model": "create:block/cart_assembler/block_none" "model": "create:block/cart_assembler/block_regular"
}, },
"powered=true,rail_type=0,shape=north_south": { "powered=true,rail_type=regular,shape=north_south": {
"model": "create:block/cart_assembler/block_powered_none" "model": "create:block/cart_assembler/block_regular_powered"
}, },
"powered=false,rail_type=1,shape=north_south": { "powered=false,rail_type=powered_rail,shape=north_south": {
"model": "create:block/cart_assembler/block_rail_normal" "model": "create:block/cart_assembler/block_powered_rail"
}, },
"powered=true,rail_type=1,shape=north_south": { "powered=true,rail_type=powered_rail,shape=north_south": {
"model": "create:block/cart_assembler/block_powered_rail_normal"
},
"powered=false,rail_type=2,shape=north_south": {
"model": "create:block/cart_assembler/block_rail_powered"
},
"powered=true,rail_type=2,shape=north_south": {
"model": "create:block/cart_assembler/block_powered_rail_powered" "model": "create:block/cart_assembler/block_powered_rail_powered"
}, },
"powered=false,rail_type=3,shape=north_south": { "powered=false,rail_type=detector_rail,shape=north_south": {
"model": "create:block/cart_assembler/block_rail_detector" "model": "create:block/cart_assembler/block_detector_rail"
}, },
"powered=true,rail_type=3,shape=north_south": { "powered=true,rail_type=detector_rail,shape=north_south": {
"model": "create:block/cart_assembler/block_powered_rail_detector" "model": "create:block/cart_assembler/block_detector_rail_powered"
}, },
"powered=false,rail_type=4,shape=north_south": { "powered=false,rail_type=activator_rail,shape=north_south": {
"model": "create:block/cart_assembler/block_rail_activator" "model": "create:block/cart_assembler/block_activator_rail"
}, },
"powered=true,rail_type=4,shape=north_south": { "powered=true,rail_type=activator_rail,shape=north_south": {
"model": "create:block/cart_assembler/block_powered_rail_activator" "model": "create:block/cart_assembler/block_activator_rail_powered"
}, },
"powered=false,rail_type=0,shape=east_west": { "powered=false,rail_type=regular,shape=east_west": {
"model": "create:block/cart_assembler/block_none", "model": "create:block/cart_assembler/block_regular",
"y": 90 "y": 90
}, },
"powered=true,rail_type=0,shape=east_west": { "powered=true,rail_type=regular,shape=east_west": {
"model": "create:block/cart_assembler/block_powered_none", "model": "create:block/cart_assembler/block_regular_powered",
"y": 90 "y": 90
}, },
"powered=false,rail_type=1,shape=east_west": { "powered=false,rail_type=powered_rail,shape=east_west": {
"model": "create:block/cart_assembler/block_rail_normal", "model": "create:block/cart_assembler/block_powered_rail",
"y": 90 "y": 90
}, },
"powered=true,rail_type=1,shape=east_west": { "powered=true,rail_type=powered_rail,shape=east_west": {
"model": "create:block/cart_assembler/block_powered_rail_normal",
"y": 90
},
"powered=false,rail_type=2,shape=east_west": {
"model": "create:block/cart_assembler/block_rail_powered",
"y": 90
},
"powered=true,rail_type=2,shape=east_west": {
"model": "create:block/cart_assembler/block_powered_rail_powered", "model": "create:block/cart_assembler/block_powered_rail_powered",
"y": 90 "y": 90
}, },
"powered=false,rail_type=3,shape=east_west": { "powered=false,rail_type=detector_rail,shape=east_west": {
"model": "create:block/cart_assembler/block_rail_detector", "model": "create:block/cart_assembler/block_detector_rail",
"y": 90 "y": 90
}, },
"powered=true,rail_type=3,shape=east_west": { "powered=true,rail_type=detector_rail,shape=east_west": {
"model": "create:block/cart_assembler/block_powered_rail_detector", "model": "create:block/cart_assembler/block_detector_rail_powered",
"y": 90 "y": 90
}, },
"powered=false,rail_type=4,shape=east_west": { "powered=false,rail_type=activator_rail,shape=east_west": {
"model": "create:block/cart_assembler/block_rail_activator", "model": "create:block/cart_assembler/block_activator_rail",
"y": 90 "y": 90
}, },
"powered=true,rail_type=4,shape=east_west": { "powered=true,rail_type=activator_rail,shape=east_west": {
"model": "create:block/cart_assembler/block_powered_rail_activator", "model": "create:block/cart_assembler/block_activator_rail_powered",
"y": 90 "y": 90
} }
} }

View File

@ -89,8 +89,8 @@
}, },
{ {
"when": { "when": {
"axis": "x", "sticky_west": "true",
"sticky_west": "true" "axis": "x"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky", "model": "create:block/radial_chassis_side_x_sticky",
@ -99,8 +99,8 @@
}, },
{ {
"when": { "when": {
"axis": "y", "sticky_west": "true",
"sticky_west": "true" "axis": "y"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y_sticky", "model": "create:block/radial_chassis_side_y_sticky",
@ -109,8 +109,8 @@
}, },
{ {
"when": { "when": {
"axis": "z", "sticky_west": "true",
"sticky_west": "true" "axis": "z"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_z_sticky", "model": "create:block/radial_chassis_side_z_sticky",
@ -119,8 +119,8 @@
}, },
{ {
"when": { "when": {
"axis": "x", "sticky_west": "false",
"sticky_west": "false" "axis": "x"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x", "model": "create:block/radial_chassis_side_x",
@ -129,8 +129,8 @@
}, },
{ {
"when": { "when": {
"axis": "y", "sticky_west": "false",
"sticky_west": "false" "axis": "y"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y", "model": "create:block/radial_chassis_side_y",
@ -139,8 +139,8 @@
}, },
{ {
"when": { "when": {
"axis": "z", "sticky_west": "false",
"sticky_west": "false" "axis": "z"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_z", "model": "create:block/radial_chassis_side_z",
@ -149,8 +149,8 @@
}, },
{ {
"when": { "when": {
"axis": "x", "sticky_north": "true",
"sticky_north": "true" "axis": "x"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky" "model": "create:block/radial_chassis_side_x_sticky"
@ -158,8 +158,8 @@
}, },
{ {
"when": { "when": {
"axis": "y", "sticky_north": "true",
"sticky_north": "true" "axis": "y"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y_sticky", "model": "create:block/radial_chassis_side_y_sticky",
@ -168,8 +168,8 @@
}, },
{ {
"when": { "when": {
"axis": "z", "sticky_north": "true",
"sticky_north": "true" "axis": "z"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky", "model": "create:block/radial_chassis_side_x_sticky",
@ -178,8 +178,8 @@
}, },
{ {
"when": { "when": {
"axis": "x", "sticky_north": "false",
"sticky_north": "false" "axis": "x"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x" "model": "create:block/radial_chassis_side_x"
@ -187,8 +187,8 @@
}, },
{ {
"when": { "when": {
"axis": "y", "sticky_north": "false",
"sticky_north": "false" "axis": "y"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y", "model": "create:block/radial_chassis_side_y",
@ -197,8 +197,8 @@
}, },
{ {
"when": { "when": {
"axis": "z", "sticky_north": "false",
"sticky_north": "false" "axis": "z"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x", "model": "create:block/radial_chassis_side_x",
@ -207,8 +207,8 @@
}, },
{ {
"when": { "when": {
"sticky_east": "true", "axis": "x",
"axis": "x" "sticky_east": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky", "model": "create:block/radial_chassis_side_x_sticky",
@ -217,8 +217,8 @@
}, },
{ {
"when": { "when": {
"sticky_east": "true", "axis": "y",
"axis": "y" "sticky_east": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y_sticky", "model": "create:block/radial_chassis_side_y_sticky",
@ -227,8 +227,8 @@
}, },
{ {
"when": { "when": {
"sticky_east": "true", "axis": "z",
"axis": "z" "sticky_east": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_z_sticky" "model": "create:block/radial_chassis_side_z_sticky"
@ -236,8 +236,8 @@
}, },
{ {
"when": { "when": {
"sticky_east": "false", "axis": "x",
"axis": "x" "sticky_east": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x", "model": "create:block/radial_chassis_side_x",
@ -246,8 +246,8 @@
}, },
{ {
"when": { "when": {
"sticky_east": "false", "axis": "y",
"axis": "y" "sticky_east": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y", "model": "create:block/radial_chassis_side_y",
@ -256,8 +256,8 @@
}, },
{ {
"when": { "when": {
"sticky_east": "false", "axis": "z",
"axis": "z" "sticky_east": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_z" "model": "create:block/radial_chassis_side_z"

View File

@ -484,8 +484,7 @@
"death.attack.create.cuckoo_clock_explosion": "%1$s was blown up by tampered cuckoo clock", "death.attack.create.cuckoo_clock_explosion": "%1$s was blown up by tampered cuckoo clock",
"create.block.deployer.damage_source_name": "a rogue Deployer", "create.block.deployer.damage_source_name": "a rogue Deployer",
"create.block.cart_assembler.invalid": "Can not place a Cart Assembler on this rail type", "create.block.cart_assembler.invalid": "Place your Cart Assembler on a rail block",
"create.block.cart_assembler.invalid_update": "Invalid rail to update this Cart Assembler",
"create.recipe.crushing": "Crushing", "create.recipe.crushing": "Crushing",
"create.recipe.milling": "Milling", "create.recipe.milling": "Milling",

View File

@ -1,3 +1,3 @@
{ {
"parent": "create:block/cart_assembler/block_none" "parent": "create:block/cart_assembler/item"
} }

View File

@ -453,9 +453,7 @@ public class AllBlocks {
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::getCutoutMipped)
.tag(BlockTags.RAILS) .tag(BlockTags.RAILS)
.item(CartAssemblerBlockItem::new) .item(CartAssemblerBlockItem::new)
.model((c, p) -> p.blockItem(() -> c.getEntry() .transform(customItemModel())
.getBlock(), "/block_none"))
.build()
.register(); .register();
public static final BlockEntry<ReinforcedRailBlock> REINFORCED_RAIL = public static final BlockEntry<ReinforcedRailBlock> REINFORCED_RAIL =

View File

@ -0,0 +1,32 @@
package com.simibubi.create.content.contraptions.components.structureMovement.mounted;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.IStringSerializable;
public enum CartAssembleRailType implements IStringSerializable {
REGULAR(Blocks.RAIL),
POWERED_RAIL(Blocks.POWERED_RAIL),
DETECTOR_RAIL(Blocks.DETECTOR_RAIL),
ACTIVATOR_RAIL(Blocks.ACTIVATOR_RAIL),
;
public Block railBlock;
public Item railItem;
private CartAssembleRailType(Block block) {
this.railBlock = block;
this.railItem = block.asItem();
}
@Override
public String getName() {
return Lang.asId(name());
}
}

View File

@ -1,14 +1,12 @@
package com.simibubi.create.content.contraptions.components.structureMovement.mounted; package com.simibubi.create.content.contraptions.components.structureMovement.mounted;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionEntity; import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionEntity;
@ -18,31 +16,23 @@ import com.simibubi.create.content.schematics.ISpecialBlockItemRequirement;
import com.simibubi.create.content.schematics.ItemRequirement; import com.simibubi.create.content.schematics.ItemRequirement;
import com.simibubi.create.content.schematics.ItemRequirement.ItemUseType; import com.simibubi.create.content.schematics.ItemRequirement.ItemUseType;
import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.AbstractRailBlock; import net.minecraft.block.AbstractRailBlock;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.DetectorRailBlock;
import net.minecraft.block.PoweredRailBlock;
import net.minecraft.block.RailBlock;
import net.minecraft.block.material.PushReaction; import net.minecraft.block.material.PushReaction;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity; import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
import net.minecraft.entity.item.minecart.FurnaceMinecartEntity; import net.minecraft.entity.item.minecart.FurnaceMinecartEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext; import net.minecraft.item.ItemUseContext;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.BooleanProperty;
import net.minecraft.state.EnumProperty; import net.minecraft.state.EnumProperty;
import net.minecraft.state.IProperty; import net.minecraft.state.IProperty;
import net.minecraft.state.IntegerProperty;
import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.StateContainer.Builder;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.state.properties.RailShape; import net.minecraft.state.properties.RailShape;
@ -57,7 +47,6 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -65,22 +54,19 @@ import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.storage.loot.LootContext; import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.world.storage.loot.LootParameters; import net.minecraft.world.storage.loot.LootParameters;
public class CartAssemblerBlock extends AbstractRailBlock implements ITE<CartAssemblerTileEntity>, IWrenchable, ISpecialBlockItemRequirement { public class CartAssemblerBlock extends AbstractRailBlock
implements ITE<CartAssemblerTileEntity>, IWrenchable, ISpecialBlockItemRequirement {
public static final int RAIL_NONE = 0; public static final IProperty<RailShape> RAIL_SHAPE =
public static final int RAIL_NORMAL = 1;
public static final int RAIL_POWERED = 2;
public static final int RAIL_DETECTOR = 3;
public static final int RAIL_ACTIVATOR = 4;
public static IProperty<RailShape> RAIL_SHAPE =
EnumProperty.create("shape", RailShape.class, RailShape.EAST_WEST, RailShape.NORTH_SOUTH); EnumProperty.create("shape", RailShape.class, RailShape.EAST_WEST, RailShape.NORTH_SOUTH);
public static IProperty<Integer> RAIL_TYPE = IntegerProperty.create("rail_type", 0, 4); public static final IProperty<CartAssembleRailType> RAIL_TYPE =
EnumProperty.create("rail_type", CartAssembleRailType.class);
public static BooleanProperty POWERED = BlockStateProperties.POWERED; public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
public CartAssemblerBlock(Properties properties) { public CartAssemblerBlock(Properties properties) {
super(true, properties); super(true, properties);
setDefaultState(getDefaultState().with(POWERED, false).with(RAIL_TYPE, RAIL_POWERED)); setDefaultState(getDefaultState().with(POWERED, false)
.with(RAIL_TYPE, CartAssembleRailType.POWERED_RAIL));
} }
public static BlockState createAnchor(BlockState state) { public static BlockState createAnchor(BlockState state) {
@ -90,33 +76,13 @@ public class CartAssemblerBlock extends AbstractRailBlock implements ITE<CartAss
} }
private static Item getRailItem(BlockState state) { private static Item getRailItem(BlockState state) {
switch (state.get(RAIL_TYPE)) { return state.get(RAIL_TYPE).railItem;
case RAIL_NORMAL:
return Items.RAIL;
case RAIL_DETECTOR:
return Items.DETECTOR_RAIL;
case RAIL_POWERED:
return Items.POWERED_RAIL;
case RAIL_ACTIVATOR:
return Items.ACTIVATOR_RAIL;
default:
return Items.AIR;
}
} }
public static BlockState getRailBlock(BlockState assembler) { public static BlockState getRailBlock(BlockState state) {
switch (assembler.get(RAIL_TYPE)) { AbstractRailBlock railBlock = (AbstractRailBlock) state.get(RAIL_TYPE).railBlock;
case RAIL_NORMAL: return railBlock.getDefaultState()
return Blocks.RAIL.getDefaultState().with(RailBlock.SHAPE, assembler.get(RAIL_SHAPE)); .with(railBlock.getShapeProperty(), state.get(RAIL_SHAPE));
case RAIL_DETECTOR:
return Blocks.DETECTOR_RAIL.getDefaultState().with(DetectorRailBlock.SHAPE, assembler.get(RAIL_SHAPE));
case RAIL_POWERED:
return Blocks.POWERED_RAIL.getDefaultState().with(PoweredRailBlock.SHAPE, assembler.get(RAIL_SHAPE));
case RAIL_ACTIVATOR:
return Blocks.ACTIVATOR_RAIL.getDefaultState().with(PoweredRailBlock.SHAPE, assembler.get(RAIL_SHAPE));
default:
return Blocks.AIR.getDefaultState();
}
} }
@Override @Override
@ -141,19 +107,21 @@ public class CartAssemblerBlock extends AbstractRailBlock implements ITE<CartAss
} }
@Override @Override
public void onMinecartPass(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, AbstractMinecartEntity cart) { public void onMinecartPass(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos,
AbstractMinecartEntity cart) {
if (!cart.canBeRidden() && !(cart instanceof FurnaceMinecartEntity)) if (!cart.canBeRidden() && !(cart instanceof FurnaceMinecartEntity))
return; return;
withTileEntityDo(world, pos, te -> { withTileEntityDo(world, pos, te -> {
if (te.isMinecartUpdateValid()) { if (te.isMinecartUpdateValid()) {
switch (state.get(RAIL_TYPE)) { switch (state.get(RAIL_TYPE)) {
case RAIL_POWERED: case POWERED_RAIL:
if (state.get(POWERED)) { if (state.get(POWERED)) {
assemble(world, pos, cart); assemble(world, pos, cart);
Direction facing = cart.getAdjustedHorizontalFacing(); Direction facing = cart.getAdjustedHorizontalFacing();
float speed = getRailMaxSpeed(state, world, pos, cart); float speed = getRailMaxSpeed(state, world, pos, cart);
cart.setMotion(facing.getXOffset() * speed, facing.getYOffset() * speed, facing.getZOffset() * speed); cart.setMotion(facing.getXOffset() * speed, facing.getYOffset() * speed,
facing.getZOffset() * speed);
} else { } else {
disassemble(world, pos, cart); disassemble(world, pos, cart);
Vec3d diff = VecHelper.getCenterOf(pos) Vec3d diff = VecHelper.getCenterOf(pos)
@ -161,24 +129,26 @@ public class CartAssemblerBlock extends AbstractRailBlock implements ITE<CartAss
cart.setMotion(diff.x / 16f, 0, diff.z / 16f); cart.setMotion(diff.x / 16f, 0, diff.z / 16f);
} }
break; break;
case RAIL_NORMAL: case REGULAR:
if (state.get(POWERED)) { if (state.get(POWERED)) {
assemble(world, pos, cart); assemble(world, pos, cart);
} else { } else {
disassemble(world, pos, cart); disassemble(world, pos, cart);
} }
break; break;
case RAIL_ACTIVATOR: case ACTIVATOR_RAIL:
if (state.get(POWERED)) { if (state.get(POWERED)) {
disassemble(world, pos, cart); disassemble(world, pos, cart);
} }
break; break;
case RAIL_DETECTOR: case DETECTOR_RAIL:
if (cart.getPassengers().isEmpty()) { if (cart.getPassengers()
.isEmpty()) {
assemble(world, pos, cart); assemble(world, pos, cart);
Direction facing = cart.getAdjustedHorizontalFacing(); Direction facing = cart.getAdjustedHorizontalFacing();
float speed = getRailMaxSpeed(state, world, pos, cart); float speed = getRailMaxSpeed(state, world, pos, cart);
cart.setMotion(facing.getXOffset() * speed, facing.getYOffset() * speed, facing.getZOffset() * speed); cart.setMotion(facing.getXOffset() * speed, facing.getYOffset() * speed,
facing.getZOffset() * speed);
} else { } else {
disassemble(world, pos, cart); disassemble(world, pos, cart);
} }
@ -197,25 +167,22 @@ public class CartAssemblerBlock extends AbstractRailBlock implements ITE<CartAss
PlayerEntity player, @Nonnull Hand hand, @Nonnull BlockRayTraceResult blockRayTraceResult) { PlayerEntity player, @Nonnull Hand hand, @Nonnull BlockRayTraceResult blockRayTraceResult) {
ItemStack itemStack = player.getHeldItem(hand); ItemStack itemStack = player.getHeldItem(hand);
if (itemStack.getItem() != getRailItem(state)) { Item previousItem = getRailItem(state);
Item heldItem = itemStack.getItem();
if (heldItem != previousItem) {
if (itemStack.getItem() == Items.RAIL) { CartAssembleRailType newType = null;
world.setBlockState(pos, state.with(RAIL_TYPE, RAIL_NORMAL)); for (CartAssembleRailType type : CartAssembleRailType.values())
} else if (itemStack.getItem() == Items.POWERED_RAIL) { if (heldItem == type.railItem)
world.setBlockState(pos, state.with(RAIL_TYPE, RAIL_POWERED)); newType = type;
} else if (itemStack.getItem() == Items.ACTIVATOR_RAIL) { if (newType == null)
world.setBlockState(pos, state.with(RAIL_TYPE, RAIL_ACTIVATOR));
} else if (itemStack.getItem() == Items.DETECTOR_RAIL) {
world.setBlockState(pos, state.with(RAIL_TYPE, RAIL_DETECTOR));
} else {
if(itemStack.getItem() instanceof BlockItem && ((BlockItem) itemStack.getItem()).getBlock() instanceof AbstractRailBlock) {
player.sendStatusMessage(new StringTextComponent(Lang.translate("block.cart_assembler.invalid_update")), true);
}
return ActionResultType.PASS; return ActionResultType.PASS;
}
world.setBlockState(pos, state.with(RAIL_TYPE, newType));
if (!player.isCreative()) { if (!player.isCreative()) {
itemStack.setCount(itemStack.getCount() - 1); itemStack.shrink(1);
player.inventory.placeItemBackInInventory(world, new ItemStack(getRailItem(state))); player.inventory.placeItemBackInInventory(world, new ItemStack(previousItem));
} }
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
} }
@ -269,8 +236,8 @@ public class CartAssemblerBlock extends AbstractRailBlock implements ITE<CartAss
} }
@Override @Override
public void neighborChanged(@Nonnull BlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Block blockIn, @Nonnull BlockPos fromPos, public void neighborChanged(@Nonnull BlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos,
boolean isMoving) { @Nonnull Block blockIn, @Nonnull BlockPos fromPos, boolean isMoving) {
super.neighborChanged(state, worldIn, pos, blockIn, fromPos, isMoving); super.neighborChanged(state, worldIn, pos, blockIn, fromPos, isMoving);
if (worldIn.isRemote) if (worldIn.isRemote)
@ -290,7 +257,8 @@ public class CartAssemblerBlock extends AbstractRailBlock implements ITE<CartAss
@Override @Override
@Nonnull @Nonnull
public VoxelShape getShape(BlockState state, @Nonnull IBlockReader worldIn, @Nonnull BlockPos pos, @Nonnull ISelectionContext context) { public VoxelShape getShape(BlockState state, @Nonnull IBlockReader worldIn, @Nonnull BlockPos pos,
@Nonnull ISelectionContext context) {
return AllShapes.CART_ASSEMBLER return AllShapes.CART_ASSEMBLER
.get(state.get(RAIL_SHAPE) == RailShape.NORTH_SOUTH ? Direction.Axis.Z : Direction.Axis.X); .get(state.get(RAIL_SHAPE) == RailShape.NORTH_SOUTH ? Direction.Axis.Z : Direction.Axis.X);
} }
@ -328,7 +296,8 @@ public class CartAssemblerBlock extends AbstractRailBlock implements ITE<CartAss
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Nonnull @Nonnull
public List<ItemStack> getDrops(@Nonnull BlockState state, @Nonnull net.minecraft.world.storage.loot.LootContext.Builder builder) { public List<ItemStack> getDrops(@Nonnull BlockState state,
@Nonnull net.minecraft.world.storage.loot.LootContext.Builder builder) {
List<ItemStack> drops = super.getDrops(state, builder); List<ItemStack> drops = super.getDrops(state, builder);
drops.addAll(getRailBlock(state).getDrops(builder)); drops.addAll(getRailBlock(state).getDrops(builder));
return drops; return drops;
@ -343,8 +312,13 @@ public class CartAssemblerBlock extends AbstractRailBlock implements ITE<CartAss
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public List<ItemStack> getDropedAssembler(BlockState p_220077_0_, ServerWorld p_220077_1_, BlockPos p_220077_2_, @Nullable TileEntity p_220077_3_, @Nullable Entity p_220077_4_, ItemStack p_220077_5_) { public List<ItemStack> getDropedAssembler(BlockState p_220077_0_, ServerWorld p_220077_1_, BlockPos p_220077_2_,
return super.getDrops(p_220077_0_, (new LootContext.Builder(p_220077_1_)).withRandom(p_220077_1_.rand).withParameter(LootParameters.POSITION, p_220077_2_).withParameter(LootParameters.TOOL, p_220077_5_).withNullableParameter(LootParameters.THIS_ENTITY, p_220077_4_).withNullableParameter(LootParameters.BLOCK_ENTITY, p_220077_3_)); @Nullable TileEntity p_220077_3_, @Nullable Entity p_220077_4_, ItemStack p_220077_5_) {
return super.getDrops(p_220077_0_, (new LootContext.Builder(p_220077_1_)).withRandom(p_220077_1_.rand)
.withParameter(LootParameters.POSITION, p_220077_2_)
.withParameter(LootParameters.TOOL, p_220077_5_)
.withNullableParameter(LootParameters.THIS_ENTITY, p_220077_4_)
.withNullableParameter(LootParameters.BLOCK_ENTITY, p_220077_3_));
} }
@Override @Override
@ -352,7 +326,9 @@ public class CartAssemblerBlock extends AbstractRailBlock implements ITE<CartAss
World world = context.getWorld(); World world = context.getWorld();
BlockPos pos = context.getPos(); BlockPos pos = context.getPos();
PlayerEntity player = context.getPlayer(); PlayerEntity player = context.getPlayer();
if (world instanceof ServerWorld) { if (world.isRemote)
return ActionResultType.SUCCESS;
if (player != null && !player.isCreative()) if (player != null && !player.isCreative())
getDropedAssembler(state, (ServerWorld) world, pos, world.getTileEntity(pos), player, context.getItem()) getDropedAssembler(state, (ServerWorld) world, pos, world.getTileEntity(pos), player, context.getItem())
.forEach(itemStack -> { .forEach(itemStack -> {
@ -360,7 +336,6 @@ public class CartAssemblerBlock extends AbstractRailBlock implements ITE<CartAss
}); });
state.spawnAdditionalDrops(world, pos, ItemStack.EMPTY); state.spawnAdditionalDrops(world, pos, ItemStack.EMPTY);
world.setBlockState(pos, getRailBlock(state)); world.setBlockState(pos, getRailBlock(state));
}
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
} }
@ -378,8 +353,8 @@ public class CartAssemblerBlock extends AbstractRailBlock implements ITE<CartAss
@Override @Override
@Nonnull @Nonnull
public VoxelShape getShape(@Nonnull BlockState p_220053_1_, @Nonnull IBlockReader p_220053_2_, @Nonnull BlockPos p_220053_3_, public VoxelShape getShape(@Nonnull BlockState p_220053_1_, @Nonnull IBlockReader p_220053_2_,
@Nonnull ISelectionContext p_220053_4_) { @Nonnull BlockPos p_220053_3_, @Nonnull ISelectionContext p_220053_4_) {
return VoxelShapes.empty(); return VoxelShapes.empty();
} }
} }

View File

@ -1,19 +1,21 @@
package com.simibubi.create.content.contraptions.components.structureMovement.mounted; package com.simibubi.create.content.contraptions.components.structureMovement.mounted;
import javax.annotation.Nonnull;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.*;
import net.minecraft.block.AbstractRailBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemUseContext; import net.minecraft.item.ItemUseContext;
import net.minecraft.state.properties.RailShape; import net.minecraft.state.properties.RailShape;
import net.minecraft.util.ActionResultType; import net.minecraft.util.ActionResultType;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class CartAssemblerBlockItem extends BlockItem { public class CartAssemblerBlockItem extends BlockItem {
public CartAssemblerBlockItem(Block block, Properties properties) { public CartAssemblerBlockItem(Block block, Properties properties) {
@ -23,36 +25,44 @@ public class CartAssemblerBlockItem extends BlockItem {
@Override @Override
@Nonnull @Nonnull
public ActionResultType onItemUse(ItemUseContext context) { public ActionResultType onItemUse(ItemUseContext context) {
if (tryPlaceAssembler(context))
return ActionResultType.SUCCESS;
return super.onItemUse(context);
}
public boolean tryPlaceAssembler(ItemUseContext context) {
BlockPos pos = context.getPos(); BlockPos pos = context.getPos();
World world = context.getWorld(); World world = context.getWorld();
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
Block block = state.getBlock(); Block block = state.getBlock();
PlayerEntity player = context.getPlayer(); PlayerEntity player = context.getPlayer();
if (block instanceof AbstractRailBlock && player != null) {
RailShape shape = state.get(((AbstractRailBlock) block).getShapeProperty()); if (player == null)
if (shape == RailShape.EAST_WEST || shape == RailShape.NORTH_SOUTH) { return false;
BlockState defaultState = AllBlocks.CART_ASSEMBLER.getDefaultState().with(CartAssemblerBlock.RAIL_SHAPE, shape); if (!(block instanceof AbstractRailBlock)) {
if (block.getClass() == RailBlock.class) { Lang.sendStatus(player, "block.cart_assembler.invalid");
world.setBlockState(pos, defaultState.with(CartAssemblerBlock.RAIL_TYPE, CartAssemblerBlock.RAIL_NORMAL)); return false;
} else if (block.getClass() == PoweredRailBlock.class) {
if (((PoweredRailBlock) block).isActivatorRail()) {
world.setBlockState(pos, defaultState.with(CartAssemblerBlock.RAIL_TYPE, CartAssemblerBlock.RAIL_ACTIVATOR));
} else {
world.setBlockState(pos, defaultState.with(CartAssemblerBlock.RAIL_TYPE, CartAssemblerBlock.RAIL_POWERED));
} }
} else if (block.getClass() == DetectorRailBlock.class) { RailShape shape = state.get(((AbstractRailBlock) block).getShapeProperty());
world.setBlockState(pos, defaultState.with(CartAssemblerBlock.RAIL_TYPE, CartAssemblerBlock.RAIL_DETECTOR)); if (shape != RailShape.EAST_WEST && shape != RailShape.NORTH_SOUTH)
} else { return false;
player.sendStatusMessage(new StringTextComponent(Lang.translate("block.cart_assembler.invalid")), true);
return super.onItemUse(context); BlockState newState = AllBlocks.CART_ASSEMBLER.getDefaultState()
} .with(CartAssemblerBlock.RAIL_SHAPE, shape);
CartAssembleRailType newType = null;
for (CartAssembleRailType type : CartAssembleRailType.values())
if (block == type.railBlock)
newType = type;
if (newType == null)
return false;
if (world.isRemote)
return true;
newState = newState.with(CartAssemblerBlock.RAIL_TYPE, newType);
world.setBlockState(pos, newState);
if (!player.isCreative()) if (!player.isCreative())
context.getItem().setCount(context.getItem().getCount() - 1); context.getItem().shrink(1);
return ActionResultType.SUCCESS; return true;
}
player.sendStatusMessage(new StringTextComponent(Lang.translate("block.cart_assembler.invalid")), true);
}
return super.onItemUse(context);
} }
} }

View File

@ -6,11 +6,14 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.material.PushReaction; import net.minecraft.block.material.PushReaction;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity; import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.BooleanProperty;
import net.minecraft.state.EnumProperty; import net.minecraft.state.EnumProperty;
import net.minecraft.state.IProperty; import net.minecraft.state.IProperty;
import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.StateContainer.Builder;
import net.minecraft.state.properties.RailShape; import net.minecraft.state.properties.RailShape;
import net.minecraft.util.NonNullList;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.ISelectionContext;
@ -34,6 +37,10 @@ public class ReinforcedRailBlock extends AbstractRailBlock {
super(true, properties); super(true, properties);
} }
@Override
public void fillItemGroup(ItemGroup p_149666_1_, NonNullList<ItemStack> p_149666_2_) {
// TODO re-add when finished
}
@Nonnull @Nonnull
@Override @Override

View File

@ -18,15 +18,13 @@ public class WrenchItem extends Item {
if (!player.isAllowEdit()) if (!player.isAllowEdit())
return super.onItemUse(context); return super.onItemUse(context);
BlockState state = context.getWorld().getBlockState(context.getPos()); BlockState state = context.getWorld().getBlockState(context.getPos());
if (!(state.getBlock() instanceof IWrenchable)) if (!(state.getBlock() instanceof IWrenchable))
return super.onItemUse(context); return super.onItemUse(context);
IWrenchable actor = (IWrenchable) state.getBlock(); IWrenchable actor = (IWrenchable) state.getBlock();
if (player.isSneaking()) { if (player.isSneaking())
return actor.onSneakWrenched(state, context); return actor.onSneakWrenched(state, context);
}
return actor.onWrenched(state, context); return actor.onWrenched(state, context);
} }
} }

View File

@ -82,6 +82,8 @@ public class ZapperInteractionHandler {
newState = newState.with(BlockStateProperties.STAIRS_SHAPE, StairsShape.STRAIGHT); newState = newState.with(BlockStateProperties.STAIRS_SHAPE, StairsShape.STRAIGHT);
if (newState.has(BlockStateProperties.PERSISTENT)) if (newState.has(BlockStateProperties.PERSISTENT))
newState = newState.with(BlockStateProperties.PERSISTENT, true); newState = newState.with(BlockStateProperties.PERSISTENT, true);
if (newState.has(BlockStateProperties.WATERLOGGED))
newState = newState.with(BlockStateProperties.WATERLOGGED, false);
CompoundNBT tag = stack.getOrCreateTag(); CompoundNBT tag = stack.getOrCreateTag();
if (tag.contains("BlockUsed") && NBTUtil.readBlockState(stack.getTag() if (tag.contains("BlockUsed") && NBTUtil.readBlockState(stack.getTag()

View File

@ -11,6 +11,7 @@ import java.util.function.Function;
import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock; import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock;
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.LinearChassisBlock; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.LinearChassisBlock;
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.RadialChassisBlock; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.RadialChassisBlock;
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssembleRailType;
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlock; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlock;
import com.simibubi.create.content.contraptions.components.tracks.ReinforcedRailBlock; import com.simibubi.create.content.contraptions.components.tracks.ReinforcedRailBlock;
import com.simibubi.create.content.logistics.block.belts.observer.BeltObserverBlock; import com.simibubi.create.content.logistics.block.belts.observer.BeltObserverBlock;
@ -166,21 +167,17 @@ public class BlockStateGen {
} }
public static NonNullBiConsumer<DataGenContext<Block, CartAssemblerBlock>, RegistrateBlockstateProvider> cartAssembler() { public static NonNullBiConsumer<DataGenContext<Block, CartAssemblerBlock>, RegistrateBlockstateProvider> cartAssembler() {
HashMap<Integer, String> railTypes = new HashMap<Integer, String>();
railTypes.put(CartAssemblerBlock.RAIL_NONE, "_none");
railTypes.put(CartAssemblerBlock.RAIL_NORMAL, "_rail_normal");
railTypes.put(CartAssemblerBlock.RAIL_POWERED, "_rail_powered");
railTypes.put(CartAssemblerBlock.RAIL_DETECTOR, "_rail_detector");
railTypes.put(CartAssemblerBlock.RAIL_ACTIVATOR, "_rail_activator");
return (c, p) -> p.getVariantBuilder(c.get()) return (c, p) -> p.getVariantBuilder(c.get())
.forAllStates(state -> { .forAllStates(state -> {
CartAssembleRailType type = state.get(CartAssemblerBlock.RAIL_TYPE);
Boolean powered = state.get(CartAssemblerBlock.POWERED);
RailShape shape = state.get(CartAssemblerBlock.RAIL_SHAPE);
return ConfiguredModel.builder() return ConfiguredModel.builder()
.modelFile(p.models() .modelFile(p.models()
.getExistingFile(p.modLoc("block/" + c.getName() + "/block" .getExistingFile(p
+ (state.get(CartAssemblerBlock.POWERED) ? "_powered" : "") .modLoc("block/" + c.getName() + "/block_" + type.getName() + (powered ? "_powered" : ""))))
+ railTypes.get(state.get(CartAssemblerBlock.RAIL_TYPE))))) .rotationY(shape == RailShape.EAST_WEST ? 90 : 0)
.rotationY(state.get(CartAssemblerBlock.RAIL_SHAPE) == RailShape.EAST_WEST ? 90 : 0)
.build(); .build();
}); });
} }
@ -190,8 +187,8 @@ public class BlockStateGen {
.forAllStates(state -> { .forAllStates(state -> {
return ConfiguredModel.builder() return ConfiguredModel.builder()
.modelFile(p.models() .modelFile(p.models()
.getExistingFile(p.modLoc("block/" + c.getName() + "/block" .getExistingFile(p.modLoc(
+ (state.get(ReinforcedRailBlock.CONNECTS_S) ? "_s" : "") "block/" + c.getName() + "/block" + (state.get(ReinforcedRailBlock.CONNECTS_S) ? "_s" : "")
+ (state.get(ReinforcedRailBlock.CONNECTS_N) ? "_n" : "")))) + (state.get(ReinforcedRailBlock.CONNECTS_N) ? "_n" : ""))))
.rotationY(state.get(ReinforcedRailBlock.RAIL_SHAPE) == RailShape.EAST_WEST ? 90 : 0) .rotationY(state.get(ReinforcedRailBlock.RAIL_SHAPE) == RailShape.EAST_WEST ? 90 : 0)
.build(); .build();

View File

@ -10,8 +10,7 @@
"death.attack.create.mechanical_saw": "%1$s got cut in half by Mechanical mechanical_saw", "death.attack.create.mechanical_saw": "%1$s got cut in half by Mechanical mechanical_saw",
"death.attack.create.cuckoo_clock_explosion": "%1$s was blown up by tampered cuckoo clock", "death.attack.create.cuckoo_clock_explosion": "%1$s was blown up by tampered cuckoo clock",
"create.block.deployer.damage_source_name": "a rogue Deployer", "create.block.deployer.damage_source_name": "a rogue Deployer",
"create.block.cart_assembler.invalid": "Can not place a Cart Assembler on this rail type", "create.block.cart_assembler.invalid": "Place your Cart Assembler on a rail block",
"create.block.cart_assembler.invalid_update": "Invalid rail to update this Cart Assembler",
"create.recipe.crushing": "Crushing", "create.recipe.crushing": "Crushing",
"create.recipe.milling": "Milling", "create.recipe.milling": "Milling",

View File

@ -1,6 +0,0 @@
{
"parent": "create:block/cart_assembler/block_none",
"textures": {
"clutch_off": "create:block/clutch_on"
}
}

View File

@ -0,0 +1,20 @@
{
"type": "crafting_shaped",
"pattern": [
"III",
"ISI",
"III"
],
"key": {
"I": {
"item": "create:scoria"
},
"S": {
"tag": "forge:dyes/black"
}
},
"result": {
"item": "create:dark_scoria",
"count": 8
}
}