mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 12:33:57 +01:00
BlockState gen progress
- Clutch, Gearshift and Gearbox joined the registrate - Fixed belt and gearbox items not being assigned creative tabs properly - Cleaned up and extended the blockstate generator helpers - Removed advancements from static assets - Added datagen .cache to gitignore - Split the palettes section into its own Creative tab - Fixed Clutch and Gearshift rendering their casing in the TER
This commit is contained in:
parent
7832e79b13
commit
2696fc2a51
1
.gitignore
vendored
1
.gitignore
vendored
@ -40,3 +40,4 @@ local.properties
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
src/generated/resources/.cache/cache
|
||||
|
@ -0,0 +1,28 @@
|
||||
{
|
||||
"variants": {
|
||||
"axis=x,powered=false": {
|
||||
"model": "create:block/clutch/block",
|
||||
"x": 90,
|
||||
"y": 90
|
||||
},
|
||||
"axis=y,powered=false": {
|
||||
"model": "create:block/clutch/block"
|
||||
},
|
||||
"axis=z,powered=false": {
|
||||
"model": "create:block/clutch/block",
|
||||
"x": 90
|
||||
},
|
||||
"axis=x,powered=true": {
|
||||
"model": "create:block/clutch/block_powered",
|
||||
"x": 90,
|
||||
"y": 90
|
||||
},
|
||||
"axis=y,powered=true": {
|
||||
"model": "create:block/clutch/block_powered"
|
||||
},
|
||||
"axis=z,powered=true": {
|
||||
"model": "create:block/clutch/block_powered",
|
||||
"x": 90
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "create:block/creative_crate"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"variants": {
|
||||
"axis=x": {
|
||||
"model": "create:block/gearbox/block",
|
||||
"x": 90,
|
||||
"y": 90
|
||||
},
|
||||
"axis=y": {
|
||||
"model": "create:block/gearbox/block"
|
||||
},
|
||||
"axis=z": {
|
||||
"model": "create:block/gearbox/block",
|
||||
"x": 90
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
{
|
||||
"variants": {
|
||||
"axis=x,powered=false": {
|
||||
"model": "create:block/gearshift/block",
|
||||
"x": 90,
|
||||
"y": 90
|
||||
},
|
||||
"axis=y,powered=false": {
|
||||
"model": "create:block/gearshift/block"
|
||||
},
|
||||
"axis=z,powered=false": {
|
||||
"model": "create:block/gearshift/block",
|
||||
"x": 90
|
||||
},
|
||||
"axis=x,powered=true": {
|
||||
"model": "create:block/gearshift/block_powered",
|
||||
"x": 90,
|
||||
"y": 90
|
||||
},
|
||||
"axis=y,powered=true": {
|
||||
"model": "create:block/gearshift/block_powered"
|
||||
},
|
||||
"axis=z,powered=true": {
|
||||
"model": "create:block/gearshift/block_powered",
|
||||
"x": 90
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"block.create.clutch": "\u0265\u0254\u0287n\u05DF\u0186",
|
||||
"block.create.cogwheel": "\u05DF\u01DD\u01DD\u0265\u028Dbo\u0186",
|
||||
"block.create.creative_crate": "\u01DD\u0287\u0250\u0279\u0186 \u01DD\u028C\u0131\u0287\u0250\u01DD\u0279\u0186",
|
||||
"block.create.dark_scoria_bricks_slab": "q\u0250\u05DFS s\u029E\u0254\u0131\u0279\u15FA \u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1",
|
||||
"block.create.dark_scoria_bricks_stairs": "s\u0279\u0131\u0250\u0287S s\u029E\u0254\u0131\u0279\u15FA \u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1",
|
||||
"block.create.dark_scoria_bricks_wall": "\u05DF\u05DF\u0250M s\u029E\u0254\u0131\u0279\u15FA \u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1",
|
||||
@ -15,6 +15,8 @@
|
||||
"block.create.gabbro_slab": "q\u0250\u05DFS o\u0279qq\u0250\u2141",
|
||||
"block.create.gabbro_stairs": "s\u0279\u0131\u0250\u0287S o\u0279qq\u0250\u2141",
|
||||
"block.create.gabbro_wall": "\u05DF\u05DF\u0250M o\u0279qq\u0250\u2141",
|
||||
"block.create.gearbox": "xoq\u0279\u0250\u01DD\u2141",
|
||||
"block.create.gearshift": "\u0287\u025F\u0131\u0265s\u0279\u0250\u01DD\u2141",
|
||||
"block.create.indented_gabbro_slab": "q\u0250\u05DFS o\u0279qq\u0250\u2141 p\u01DD\u0287u\u01DDpuI",
|
||||
"block.create.large_cogwheel": "\u05DF\u01DD\u01DD\u0265\u028Dbo\u0186 \u01DDb\u0279\u0250\uA780",
|
||||
"block.create.limestone_bricks_slab": "q\u0250\u05DFS s\u029E\u0254\u0131\u0279\u15FA \u01DDuo\u0287s\u01DD\u026F\u0131\uA780",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"block.create.clutch": "Clutch",
|
||||
"block.create.cogwheel": "Cogwheel",
|
||||
"block.create.creative_crate": "Creative Crate",
|
||||
"block.create.dark_scoria_bricks_slab": "Dark Scoria Bricks Slab",
|
||||
"block.create.dark_scoria_bricks_stairs": "Dark Scoria Bricks Stairs",
|
||||
"block.create.dark_scoria_bricks_wall": "Dark Scoria Bricks Wall",
|
||||
@ -15,6 +15,8 @@
|
||||
"block.create.gabbro_slab": "Gabbro Slab",
|
||||
"block.create.gabbro_stairs": "Gabbro Stairs",
|
||||
"block.create.gabbro_wall": "Gabbro Wall",
|
||||
"block.create.gearbox": "Gearbox",
|
||||
"block.create.gearshift": "Gearshift",
|
||||
"block.create.indented_gabbro_slab": "Indented Gabbro Slab",
|
||||
"block.create.large_cogwheel": "Large Cogwheel",
|
||||
"block.create.limestone_bricks_slab": "Limestone Bricks Slab",
|
||||
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "create:block/clutch/item"
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"parent": "create:block/creative_crate"
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "create:block/gearbox/item"
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "create:block/gearshift/item"
|
||||
}
|
@ -2,7 +2,8 @@
|
||||
"parent": "create:refined_radiance",
|
||||
"display": {
|
||||
"icon": {
|
||||
"item": "create:deforester"
|
||||
"item": "create:deforester",
|
||||
"nbt": "{Damage:0}"
|
||||
},
|
||||
"title": {
|
||||
"translate": "advancement.create.deforester"
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"#forge:ingots/copper",
|
||||
"#forge:ingots/zinc",
|
||||
"#forge:ingots/brass"
|
||||
],
|
||||
"optional": []
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:brass_ingot"
|
||||
],
|
||||
"optional": []
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:copper_ingot"
|
||||
],
|
||||
"optional": []
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:zinc_ingot"
|
||||
],
|
||||
"optional": []
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"#forge:nuggets/copper",
|
||||
"#forge:nuggets/zinc",
|
||||
"#forge:nuggets/brass"
|
||||
],
|
||||
"optional": []
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:brass_nugget"
|
||||
],
|
||||
"optional": []
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:copper_nugget"
|
||||
],
|
||||
"optional": []
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:zinc_nugget"
|
||||
],
|
||||
"optional": []
|
||||
}
|
11
src/generated/resources/data/forge/tags/items/plates.json
Normal file
11
src/generated/resources/data/forge/tags/items/plates.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"#forge:plates/iron",
|
||||
"#forge:plates/gold",
|
||||
"#forge:plates/copper",
|
||||
"#forge:plates/brass",
|
||||
"#forge:plates/lapis"
|
||||
],
|
||||
"optional": []
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:brass_sheet"
|
||||
],
|
||||
"optional": []
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:copper_sheet"
|
||||
],
|
||||
"optional": []
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:gold_sheet"
|
||||
],
|
||||
"optional": []
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:iron_sheet"
|
||||
],
|
||||
"optional": []
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"create:lapis_plate"
|
||||
],
|
||||
"optional": []
|
||||
}
|
@ -51,11 +51,8 @@ import com.simibubi.create.modules.contraptions.relays.advanced.SpeedControllerB
|
||||
import com.simibubi.create.modules.contraptions.relays.advanced.sequencer.SequencedGearshiftBlock;
|
||||
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock;
|
||||
import com.simibubi.create.modules.contraptions.relays.encased.AdjustablePulleyBlock;
|
||||
import com.simibubi.create.modules.contraptions.relays.encased.ClutchBlock;
|
||||
import com.simibubi.create.modules.contraptions.relays.encased.EncasedBeltBlock;
|
||||
import com.simibubi.create.modules.contraptions.relays.encased.GearshiftBlock;
|
||||
import com.simibubi.create.modules.contraptions.relays.gauge.GaugeBlock;
|
||||
import com.simibubi.create.modules.contraptions.relays.gearbox.GearboxBlock;
|
||||
import com.simibubi.create.modules.curiosities.CocoaLogBlock;
|
||||
import com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockBlock;
|
||||
import com.simibubi.create.modules.curiosities.symmetry.block.CrossPlaneSymmetryBlock;
|
||||
@ -124,9 +121,9 @@ public enum AllBlocks implements NonNullSupplier<Block> {
|
||||
// COGWHEEL(() -> new CogWheelBlock(false), (b, p) -> new CogwheelBlockItem(b, p, false)),
|
||||
// LARGE_COGWHEEL(() -> new CogWheelBlock(true), (b, p) -> new CogwheelBlockItem(b, p, true)),
|
||||
// ENCASED_SHAFT(EncasedShaftBlock::new),
|
||||
GEARBOX(GearboxBlock::new),
|
||||
CLUTCH(ClutchBlock::new),
|
||||
GEARSHIFT(GearshiftBlock::new),
|
||||
// GEARBOX(GearboxBlock::new),
|
||||
// CLUTCH(ClutchBlock::new),
|
||||
// GEARSHIFT(GearshiftBlock::new),
|
||||
|
||||
ENCASED_BELT(EncasedBeltBlock::new),
|
||||
ADJUSTABLE_PULLEY(AdjustablePulleyBlock::new),
|
||||
|
@ -2,12 +2,16 @@ package com.simibubi.create;
|
||||
|
||||
import static com.simibubi.create.modules.Sections.SCHEMATICS;
|
||||
|
||||
import com.simibubi.create.foundation.utility.data.AssetLookup;
|
||||
import com.simibubi.create.foundation.utility.data.BlockStateGen;
|
||||
import com.simibubi.create.modules.Sections;
|
||||
import com.simibubi.create.modules.contraptions.relays.elementary.CogWheelBlock;
|
||||
import com.simibubi.create.modules.contraptions.relays.elementary.CogwheelBlockItem;
|
||||
import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
|
||||
import com.simibubi.create.modules.contraptions.relays.encased.ClutchBlock;
|
||||
import com.simibubi.create.modules.contraptions.relays.encased.EncasedShaftBlock;
|
||||
import com.simibubi.create.modules.contraptions.relays.encased.GearshiftBlock;
|
||||
import com.simibubi.create.modules.contraptions.relays.gearbox.GearboxBlock;
|
||||
import com.simibubi.create.modules.schematics.block.SchematicTableBlock;
|
||||
import com.simibubi.create.modules.schematics.block.SchematicannonBlock;
|
||||
import com.tterrag.registrate.util.entry.BlockEntry;
|
||||
@ -26,9 +30,9 @@ public class AllBlocksNew {
|
||||
public static final BlockEntry<SchematicannonBlock> SCHEMATICANNON =
|
||||
REGISTRATE.block("schematicannon", SchematicannonBlock::new)
|
||||
.initialProperties(() -> Blocks.DISPENSER)
|
||||
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), BlockStateGen.partialBaseModel(ctx, prov)))
|
||||
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov)))
|
||||
.item()
|
||||
.model(BlockStateGen::customItemModel)
|
||||
.model(AssetLookup::customItemModel)
|
||||
.build()
|
||||
.register();
|
||||
|
||||
@ -46,14 +50,14 @@ public class AllBlocksNew {
|
||||
|
||||
public static final BlockEntry<ShaftBlock> SHAFT = REGISTRATE.block("shaft", ShaftBlock::new)
|
||||
.initialProperties(SharedProperties::kinetic)
|
||||
.blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.standardModel(c, p)))
|
||||
.blockstate(BlockStateGen.axisBlockProvider(false))
|
||||
.simpleItem()
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<CogWheelBlock> COGWHEEL = REGISTRATE.block("cogwheel", CogWheelBlock::small)
|
||||
.initialProperties(SharedProperties::kinetic)
|
||||
.properties(p -> p.sound(SoundType.WOOD))
|
||||
.blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.standardModel(c, p)))
|
||||
.blockstate(BlockStateGen.axisBlockProvider(false))
|
||||
.item(CogwheelBlockItem::new)
|
||||
.build()
|
||||
.register();
|
||||
@ -62,7 +66,7 @@ public class AllBlocksNew {
|
||||
REGISTRATE.block("large_cogwheel", CogWheelBlock::large)
|
||||
.initialProperties(SharedProperties::kinetic)
|
||||
.properties(p -> p.sound(SoundType.WOOD))
|
||||
.blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.standardModel(c, p)))
|
||||
.blockstate(BlockStateGen.axisBlockProvider(false))
|
||||
.item(CogwheelBlockItem::new)
|
||||
.build()
|
||||
.register();
|
||||
@ -70,9 +74,33 @@ public class AllBlocksNew {
|
||||
public static final BlockEntry<EncasedShaftBlock> ENCASED_SHAFT =
|
||||
REGISTRATE.block("encased_shaft", EncasedShaftBlock::new)
|
||||
.initialProperties(SharedProperties::kinetic)
|
||||
.blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.partialBaseModel(c, p)))
|
||||
.blockstate(BlockStateGen.axisBlockProvider(true))
|
||||
.item()
|
||||
.model(BlockStateGen::customItemModel)
|
||||
.model(AssetLookup::customItemModel)
|
||||
.build()
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<GearboxBlock> GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new)
|
||||
.initialProperties(SharedProperties::kinetic)
|
||||
.blockstate(BlockStateGen.axisBlockProvider(true))
|
||||
.item()
|
||||
.model(AssetLookup::customItemModel)
|
||||
.build()
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<ClutchBlock> CLUTCH = REGISTRATE.block("clutch", ClutchBlock::new)
|
||||
.initialProperties(SharedProperties::kinetic)
|
||||
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
|
||||
.item()
|
||||
.model(AssetLookup::customItemModel)
|
||||
.build()
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<GearshiftBlock> GEARSHIFT = REGISTRATE.block("gearshift", GearshiftBlock::new)
|
||||
.initialProperties(SharedProperties::kinetic)
|
||||
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
|
||||
.item()
|
||||
.model(AssetLookup::customItemModel)
|
||||
.build()
|
||||
.register();
|
||||
|
||||
|
@ -194,7 +194,7 @@ public enum AllItems {
|
||||
}
|
||||
|
||||
public static Properties includeInItemGroup() {
|
||||
return new Properties().group(Create.creativeTab);
|
||||
return new Properties().group(Create.baseCreativeTab);
|
||||
}
|
||||
|
||||
public static void register(RegistryEvent.Register<Item> event) {
|
||||
|
@ -111,14 +111,14 @@ public enum AllTileEntities {
|
||||
// Kinetics
|
||||
SHAFT(ShaftTileEntity::new, AllBlocksNew.SHAFT, AllBlocksNew.COGWHEEL, AllBlocksNew.LARGE_COGWHEEL, AllBlocksNew.ENCASED_SHAFT),
|
||||
MOTOR(MotorTileEntity::new, AllBlocks.CREATIVE_MOTOR),
|
||||
GEARBOX(GearboxTileEntity::new, AllBlocks.GEARBOX),
|
||||
GEARBOX(GearboxTileEntity::new, AllBlocksNew.GEARBOX),
|
||||
TURNTABLE(TurntableTileEntity::new, AllBlocks.TURNTABLE),
|
||||
ENCASED_SHAFT(EncasedShaftTileEntity::new, AllBlocksNew.ENCASED_SHAFT, AllBlocks.ENCASED_BELT),
|
||||
ADJUSTABLE_PULLEY(AdjustablePulleyTileEntity::new, AllBlocks.ADJUSTABLE_PULLEY),
|
||||
ENCASED_FAN(EncasedFanTileEntity::new, AllBlocks.ENCASED_FAN),
|
||||
NOZZLE(NozzleTileEntity::new, AllBlocks.NOZZLE),
|
||||
CLUTCH(ClutchTileEntity::new, AllBlocks.CLUTCH),
|
||||
GEARSHIFT(GearshiftTileEntity::new, AllBlocks.GEARSHIFT),
|
||||
CLUTCH(ClutchTileEntity::new, AllBlocksNew.CLUTCH),
|
||||
GEARSHIFT(GearshiftTileEntity::new, AllBlocksNew.GEARSHIFT),
|
||||
HAND_CRANK(HandCrankTileEntity::new, AllBlocks.HAND_CRANK),
|
||||
CUCKOO_CLOCK(CuckooClockTileEntity::new, AllBlocks.CUCKOO_CLOCK, AllBlocks.MYSTERIOUS_CUCKOO_CLOCK),
|
||||
|
||||
|
@ -10,6 +10,7 @@ import com.simibubi.create.foundation.command.ServerLagger;
|
||||
import com.simibubi.create.foundation.world.AllWorldFeatures;
|
||||
import com.simibubi.create.modules.contraptions.TorquePropagator;
|
||||
import com.simibubi.create.modules.logistics.RedstoneLinkNetworkHandler;
|
||||
import com.simibubi.create.modules.palettes.PalettesItemGroup;
|
||||
import com.simibubi.create.modules.schematics.ServerSchematicLoader;
|
||||
import com.tterrag.registrate.util.NonNullLazyValue;
|
||||
|
||||
@ -36,11 +37,14 @@ public class Create {
|
||||
public static final String VERSION = "0.1.1b";
|
||||
|
||||
public static Logger logger = LogManager.getLogger();
|
||||
public static ItemGroup creativeTab = new CreateItemGroup();
|
||||
public static ItemGroup baseCreativeTab = new CreateItemGroup();
|
||||
public static ItemGroup palettesCreativeTab = new PalettesItemGroup();
|
||||
|
||||
public static ServerSchematicLoader schematicReceiver;
|
||||
public static RedstoneLinkNetworkHandler redstoneLinkNetworkHandler;
|
||||
public static TorquePropagator torquePropagator;
|
||||
public static ServerLagger lagger;
|
||||
|
||||
private static final NonNullLazyValue<CreateRegistrate> registrate = CreateRegistrate.lazy(ID);
|
||||
|
||||
public Create() {
|
||||
|
@ -1,24 +1,27 @@
|
||||
package com.simibubi.create;
|
||||
|
||||
import com.simibubi.create.foundation.item.IAddedByOther;
|
||||
import com.simibubi.create.modules.Sections;
|
||||
import com.tterrag.registrate.util.entry.RegistryEntry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public final class CreateItemGroup extends ItemGroup {
|
||||
public class CreateItemGroup extends CreateItemGroupBase {
|
||||
|
||||
public CreateItemGroup() {
|
||||
super(getGroupCountSafe(), Create.ID);
|
||||
super("base");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldAdd(RegistryEntry<? extends Block> block) {
|
||||
Sections section = Create.registrate()
|
||||
.getSection(block);
|
||||
return section != Sections.PALETTES;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldAdd(AllItems item) {
|
||||
return item.section != Sections.PALETTES;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -26,43 +29,4 @@ public final class CreateItemGroup extends ItemGroup {
|
||||
return AllBlocksNew.COGWHEEL.asStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void fill(NonNullList<ItemStack> items) {
|
||||
addItems(items, true);
|
||||
addBlocks(items);
|
||||
addItems(items, false);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addBlocks(NonNullList<ItemStack> items) {
|
||||
for (RegistryEntry<? extends Block> entry : Create.registrate().getAll(Block.class)) {
|
||||
Block def = entry.get();
|
||||
if (def == null)
|
||||
continue;
|
||||
if (def instanceof IAddedByOther)
|
||||
continue;
|
||||
|
||||
Item item = def.asItem();
|
||||
if (item != Items.AIR)
|
||||
item.fillItemGroup(this, items);
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addItems(NonNullList<ItemStack> items, boolean specialItems) {
|
||||
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
||||
|
||||
for (AllItems item : AllItems.values()) {
|
||||
if (item.get() == null)
|
||||
continue;
|
||||
IBakedModel model = itemRenderer.getItemModelWithOverrides(item.asStack(), Minecraft.getInstance().world, null);
|
||||
if (model.isGui3d() != specialItems)
|
||||
continue;
|
||||
if (item.get() instanceof IAddedByOther)
|
||||
continue;
|
||||
|
||||
item.get().fillItemGroup(this, items);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
69
src/main/java/com/simibubi/create/CreateItemGroupBase.java
Normal file
69
src/main/java/com/simibubi/create/CreateItemGroupBase.java
Normal file
@ -0,0 +1,69 @@
|
||||
package com.simibubi.create;
|
||||
|
||||
import com.tterrag.registrate.util.entry.RegistryEntry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public abstract class CreateItemGroupBase extends ItemGroup {
|
||||
|
||||
public CreateItemGroupBase(String id) {
|
||||
super(getGroupCountSafe(), Create.ID + "." + id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void fill(NonNullList<ItemStack> items) {
|
||||
addItems(items, true);
|
||||
addBlocks(items);
|
||||
addItems(items, false);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addBlocks(NonNullList<ItemStack> items) {
|
||||
for (RegistryEntry<? extends Block> entry : Create.registrate()
|
||||
.getAll(Block.class)) {
|
||||
if (!shouldAdd(entry))
|
||||
continue;
|
||||
Block def = entry.get();
|
||||
if (def == null)
|
||||
continue;
|
||||
Item item = def.asItem();
|
||||
if (item != Items.AIR)
|
||||
def.fillItemGroup(this, items);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract boolean shouldAdd(RegistryEntry<? extends Block> block);
|
||||
|
||||
protected abstract boolean shouldAdd(AllItems item);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addItems(NonNullList<ItemStack> items, boolean specialItems) {
|
||||
ItemRenderer itemRenderer = Minecraft.getInstance()
|
||||
.getItemRenderer();
|
||||
|
||||
for (AllItems item : AllItems.values()) {
|
||||
if (!shouldAdd(item))
|
||||
continue;
|
||||
if (item.get() == null)
|
||||
continue;
|
||||
IBakedModel model =
|
||||
itemRenderer.getItemModelWithOverrides(item.asStack(), Minecraft.getInstance().world, null);
|
||||
if (model.isGui3d() != specialItems)
|
||||
continue;
|
||||
|
||||
item.get()
|
||||
.fillItemGroup(this, items);
|
||||
}
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
|
||||
public static CreateRegistrate create(String modid) {
|
||||
return new CreateRegistrate(modid).registerEventListeners(FMLJavaModLoadingContext.get()
|
||||
.getModEventBus())
|
||||
.itemGroup(() -> Create.creativeTab);
|
||||
.itemGroup(() -> Create.baseCreativeTab);
|
||||
}
|
||||
|
||||
public static NonNullLazyValue<CreateRegistrate> lazy(String modid) {
|
||||
|
@ -1,5 +0,0 @@
|
||||
package com.simibubi.create.foundation.item;
|
||||
|
||||
public interface IAddedByOther {
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.simibubi.create.foundation.utility.data;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.tterrag.registrate.providers.DataGenContext;
|
||||
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
|
||||
import com.tterrag.registrate.providers.RegistrateItemModelProvider;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraftforge.client.model.generators.ItemModelBuilder;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
|
||||
public class AssetLookup {
|
||||
|
||||
/**
|
||||
* Custom block models packaged with other partials. Example:
|
||||
* models/block/schematicannon/block.json <br>
|
||||
* <br>
|
||||
* Adding "powered", "vertical" will look for /block_powered_vertical.json
|
||||
*/
|
||||
public static ModelFile partialBaseModel(DataGenContext<?, ?> ctx, RegistrateBlockstateProvider prov,
|
||||
String... suffix) {
|
||||
String string = "/block";
|
||||
for (String suf : suffix)
|
||||
string += "_" + suf;
|
||||
final String location = "block/" + ctx.getName() + string;
|
||||
return prov.models()
|
||||
.getExistingFile(prov.modLoc(location));
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom block model from models/block/x.json
|
||||
*/
|
||||
public static ModelFile standardModel(DataGenContext<?, ?> ctx, RegistrateBlockstateProvider prov) {
|
||||
return prov.models()
|
||||
.getExistingFile(prov.modLoc("block/" + ctx.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate item model inheriting from a seperate model in
|
||||
* models/block/x/item.json
|
||||
*/
|
||||
public static ItemModelBuilder customItemModel(DataGenContext<Item, ? extends BlockItem> ctx,
|
||||
RegistrateItemModelProvider prov) {
|
||||
return prov.blockItem(() -> ctx.getEntry()
|
||||
.getBlock(), "/item");
|
||||
}
|
||||
|
||||
public static Function<BlockState, ModelFile> forPowered(DataGenContext<?, ?> ctx,
|
||||
RegistrateBlockstateProvider prov) {
|
||||
return state -> state.get(BlockStateProperties.POWERED) ? partialBaseModel(ctx, prov, "powered")
|
||||
: partialBaseModel(ctx, prov);
|
||||
}
|
||||
|
||||
}
|
@ -1,60 +1,38 @@
|
||||
|
||||
package com.simibubi.create.foundation.utility.data;
|
||||
|
||||
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.tterrag.registrate.providers.DataGenContext;
|
||||
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
|
||||
import com.tterrag.registrate.providers.RegistrateItemModelProvider;
|
||||
import com.tterrag.registrate.util.nullness.NonnullType;
|
||||
import com.tterrag.registrate.util.nullness.NonNullBiConsumer;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.RotatedPillarBlock;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraftforge.client.model.generators.ItemModelBuilder;
|
||||
import net.minecraftforge.client.model.generators.ModelFile.ExistingModelFile;
|
||||
import net.minecraftforge.client.model.generators.VariantBlockStateBuilder;
|
||||
import net.minecraftforge.client.model.generators.ConfiguredModel;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
|
||||
public class BlockStateGen {
|
||||
|
||||
/**
|
||||
* Equivalent to BlockStateProvider#axisBlock without the need for a
|
||||
* RotatedPillarBlock instance
|
||||
*/
|
||||
public static <T extends RotatedPillarKineticBlock> VariantBlockStateBuilder axisKineticBlock(
|
||||
DataGenContext<Block, T> ctx, RegistrateBlockstateProvider prov, ExistingModelFile model) {
|
||||
RotatedPillarKineticBlock block = ctx.getEntry();
|
||||
return prov.getVariantBuilder(block).partialState().with(RotatedPillarBlock.AXIS, Axis.Y).modelForState()
|
||||
.modelFile(model).addModel().partialState().with(RotatedPillarBlock.AXIS, Axis.Z).modelForState()
|
||||
.modelFile(model).rotationX(90).addModel().partialState().with(RotatedPillarBlock.AXIS, Axis.X)
|
||||
.modelForState().modelFile(model).rotationX(90).rotationY(90).addModel();
|
||||
public static <T extends Block> NonNullBiConsumer<DataGenContext<Block, T>, RegistrateBlockstateProvider> axisBlockProvider(
|
||||
boolean customItem) {
|
||||
return (c, p) -> BlockStateGen.axisBlock(c, p,
|
||||
$ -> customItem ? AssetLookup.partialBaseModel(c, p) : AssetLookup.standardModel(c, p));
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom block models packaged with other partials. Example:
|
||||
* models/block/schematicannon/block.json
|
||||
*/
|
||||
public static ExistingModelFile partialBaseModel(@NonnullType DataGenContext<?, ?> ctx,
|
||||
@NonnullType RegistrateBlockstateProvider prov) {
|
||||
return prov.models().getExistingFile(prov.modLoc("block/" + ctx.getName() + "/block"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom block model from models/block/x.json
|
||||
*/
|
||||
public static ExistingModelFile standardModel(@NonnullType DataGenContext<?, ?> ctx,
|
||||
@NonnullType RegistrateBlockstateProvider prov) {
|
||||
return prov.models().getExistingFile(prov.modLoc("block/" + ctx.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate item model inheriting from a seperate model in
|
||||
* models/block/x/item.json
|
||||
*/
|
||||
public static ItemModelBuilder customItemModel(@NonnullType DataGenContext<Item, ? extends BlockItem> ctx,
|
||||
@NonnullType RegistrateItemModelProvider prov) {
|
||||
return prov.blockItem(() -> ctx.getEntry().getBlock(), "/item");
|
||||
public static <T extends Block> void axisBlock(DataGenContext<Block, T> ctx, RegistrateBlockstateProvider prov,
|
||||
Function<BlockState, ModelFile> modelFunc) {
|
||||
prov.getVariantBuilder(ctx.getEntry())
|
||||
.forAllStates(state -> {
|
||||
Axis axis = state.get(BlockStateProperties.AXIS);
|
||||
return ConfiguredModel.builder()
|
||||
.modelFile(modelFunc.apply(state))
|
||||
.rotationX(axis == Axis.Y ? 0 : 90)
|
||||
.rotationY(axis == Axis.X ? 90 : 0)
|
||||
.build();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.simibubi.create.modules.contraptions.base;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.simibubi.create.AllBlocksNew;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
@ -15,6 +16,7 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@ -36,12 +38,14 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
|
||||
renderRotatingBuffer(te, getRotatedModel(te), ms, buffer.getBuffer(RenderType.getSolid()));
|
||||
}
|
||||
|
||||
public static void renderRotatingKineticBlock(KineticTileEntity te, BlockState renderedState, MatrixStack ms, IVertexBuilder buffer) {
|
||||
public static void renderRotatingKineticBlock(KineticTileEntity te, BlockState renderedState, MatrixStack ms,
|
||||
IVertexBuilder buffer) {
|
||||
SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockIn(KINETIC_TILE, renderedState);
|
||||
renderRotatingBuffer(te, superByteBuffer, ms, buffer);
|
||||
}
|
||||
|
||||
public static void renderRotatingBuffer(KineticTileEntity te, SuperByteBuffer superBuffer, MatrixStack ms, IVertexBuilder buffer) {
|
||||
public static void renderRotatingBuffer(KineticTileEntity te, SuperByteBuffer superBuffer, MatrixStack ms,
|
||||
IVertexBuilder buffer) {
|
||||
standardKineticRotationTransform(superBuffer, te).renderInto(ms, buffer);
|
||||
}
|
||||
|
||||
@ -54,13 +58,15 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
|
||||
|
||||
public static SuperByteBuffer standardKineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te) {
|
||||
final BlockPos pos = te.getPos();
|
||||
Axis axis = ((IRotate) te.getBlockState().getBlock()).getRotationAxis(te.getBlockState());
|
||||
Axis axis = ((IRotate) te.getBlockState()
|
||||
.getBlock()).getRotationAxis(te.getBlockState());
|
||||
return kineticRotationTransform(buffer, te, axis, getAngleForTe(te, pos, axis));
|
||||
}
|
||||
|
||||
public static SuperByteBuffer kineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te, Axis axis,
|
||||
float angle) {
|
||||
int light = te.getBlockState().getLightValue(te.getWorld(), te.getPos());
|
||||
int light = te.getBlockState()
|
||||
.getLightValue(te.getWorld(), te.getPos());
|
||||
buffer.light((0xF0 << 16) | (light << 4));
|
||||
buffer.rotateCentered(axis, angle);
|
||||
|
||||
@ -92,6 +98,16 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
|
||||
return offset;
|
||||
}
|
||||
|
||||
public static BlockState shaft(Axis axis) {
|
||||
return AllBlocksNew.SHAFT.getDefaultState()
|
||||
.with(BlockStateProperties.AXIS, axis);
|
||||
}
|
||||
|
||||
public static Axis getRotationAxisOf(KineticTileEntity te) {
|
||||
return ((IRotate) te.getBlockState()
|
||||
.getBlock()).getRotationAxis(te.getBlockState());
|
||||
}
|
||||
|
||||
protected BlockState getRenderedBlockState(KineticTileEntity te) {
|
||||
return te.getBlockState();
|
||||
}
|
||||
|
@ -1,13 +1,10 @@
|
||||
package com.simibubi.create.modules.contraptions.components.contraptions.piston;
|
||||
|
||||
import com.simibubi.create.AllBlocksNew;
|
||||
import com.simibubi.create.modules.contraptions.base.IRotate;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
|
||||
public class MechanicalPistonTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
@ -17,8 +14,7 @@ public class MechanicalPistonTileEntityRenderer extends KineticTileEntityRendere
|
||||
|
||||
@Override
|
||||
protected BlockState getRenderedBlockState(KineticTileEntity te) {
|
||||
return AllBlocksNew.SHAFT.getDefaultState().with(BlockStateProperties.AXIS,
|
||||
((IRotate) te.getBlockState().getBlock()).getRotationAxis(te.getBlockState()));
|
||||
return shaft(getRotationAxisOf(te));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.simibubi.create.modules.contraptions.components.deployer;
|
||||
|
||||
import static com.simibubi.create.modules.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE;
|
||||
import static com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock.FACING;
|
||||
import static net.minecraft.state.properties.BlockStateProperties.AXIS;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -10,8 +9,6 @@ import java.util.List;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllBlocksNew;
|
||||
import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer;
|
||||
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
@ -19,7 +16,6 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import com.simibubi.create.modules.contraptions.base.IRotate;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.modules.contraptions.components.contraptions.MovementContext;
|
||||
@ -27,7 +23,6 @@ import com.simibubi.create.modules.contraptions.components.deployer.DeployerTile
|
||||
import com.simibubi.create.modules.contraptions.components.deployer.DeployerTileEntity.State;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
@ -136,10 +131,7 @@ public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerT
|
||||
}
|
||||
|
||||
protected BlockState getRenderedBlockState(KineticTileEntity te) {
|
||||
BlockState state = te.getBlockState();
|
||||
if (!AllBlocks.DEPLOYER.typeOf(state))
|
||||
return Blocks.AIR.getDefaultState();
|
||||
return AllBlocksNew.SHAFT.getDefaultState().with(AXIS, ((IRotate) state.getBlock()).getRotationAxis(state));
|
||||
return KineticTileEntityRenderer.shaft(KineticTileEntityRenderer.getRotationAxisOf(te));
|
||||
}
|
||||
|
||||
private static SuperByteBuffer renderAndTransform(World world, AllBlockPartials renderBlock,
|
||||
|
@ -1,10 +1,7 @@
|
||||
package com.simibubi.create.modules.contraptions.components.press;
|
||||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.AllBlocksNew;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
@ -14,7 +11,6 @@ import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class MechanicalPressTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
@ -39,8 +35,7 @@ public class MechanicalPressTileEntityRenderer extends KineticTileEntityRenderer
|
||||
|
||||
@Override
|
||||
protected BlockState getRenderedBlockState(KineticTileEntity te) {
|
||||
return AllBlocksNew.SHAFT.getDefaultState().with(BlockStateProperties.AXIS,
|
||||
te.getBlockState().get(HORIZONTAL_FACING).getAxis());
|
||||
return shaft(getRotationAxisOf(te));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
package com.simibubi.create.modules.contraptions.components.saw;
|
||||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.AXIS;
|
||||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.AllBlocksNew;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer;
|
||||
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
import com.simibubi.create.modules.contraptions.base.IRotate;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
|
||||
@ -90,8 +87,7 @@ public class SawTileEntityRenderer extends SafeTileEntityRenderer<SawTileEntity>
|
||||
}
|
||||
|
||||
protected BlockState getRenderedBlockState(KineticTileEntity te) {
|
||||
BlockState state = te.getBlockState();
|
||||
return AllBlocksNew.SHAFT.getDefaultState().with(AXIS, ((IRotate) state.getBlock()).getRotationAxis(state));
|
||||
return KineticTileEntityRenderer.shaft(KineticTileEntityRenderer.getRotationAxisOf(te));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,14 +1,11 @@
|
||||
package com.simibubi.create.modules.contraptions.relays.advanced;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlocksNew;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.foundation.behaviour.base.SmartTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
@ -24,13 +21,13 @@ public class SpeedControllerRenderer extends SmartTileEntityRenderer<SpeedContro
|
||||
IRenderTypeBuffer buffer, int light, int overlay) {
|
||||
super.renderSafe(tileEntityIn, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
KineticTileEntityRenderer.renderRotatingBuffer(tileEntityIn, getRotatedModel(tileEntityIn), ms, buffer.getBuffer(RenderType.getSolid()));
|
||||
KineticTileEntityRenderer.renderRotatingBuffer(tileEntityIn, getRotatedModel(tileEntityIn), ms,
|
||||
buffer.getBuffer(RenderType.getSolid()));
|
||||
}
|
||||
|
||||
private SuperByteBuffer getRotatedModel(SpeedControllerTileEntity te) {
|
||||
BlockState state = te.getBlockState();
|
||||
return CreateClient.bufferCache.renderBlockIn(KineticTileEntityRenderer.KINETIC_TILE,
|
||||
AllBlocksNew.SHAFT.getDefaultState().with(ShaftBlock.AXIS, state.get(SpeedControllerBlock.HORIZONTAL_AXIS)));
|
||||
KineticTileEntityRenderer.shaft(KineticTileEntityRenderer.getRotationAxisOf(te)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import net.minecraft.entity.MobEntity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.pathfinding.PathNodeType;
|
||||
@ -49,6 +50,7 @@ import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
@ -79,6 +81,11 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
|
||||
setDefaultState(getDefaultState().with(SLOPE, Slope.HORIZONTAL).with(PART, Part.START).with(CASING, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillItemGroup(ItemGroup p_149666_1_, NonNullList<ItemStack> p_149666_2_) {
|
||||
p_149666_2_.add(AllItems.BELT_CONNECTOR.asStack());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
|
||||
if (face.getAxis() != getRotationAxis(state))
|
||||
|
@ -4,9 +4,9 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.advancement.AllTriggers;
|
||||
import com.simibubi.create.foundation.item.IAddedByOther;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock;
|
||||
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Part;
|
||||
@ -15,6 +15,8 @@ import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
@ -24,10 +26,11 @@ import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BeltConnectorItem extends BlockItem implements IAddedByOther {
|
||||
public class BeltConnectorItem extends BlockItem {
|
||||
|
||||
public BeltConnectorItem(Properties properties) {
|
||||
super(AllBlocks.BELT.get(), properties);
|
||||
@ -38,10 +41,19 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
|
||||
return getDefaultTranslationKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillItemGroup(ItemGroup p_150895_1_, NonNullList<ItemStack> p_150895_2_) {
|
||||
if (p_150895_1_ == Create.baseCreativeTab)
|
||||
return;
|
||||
super.fillItemGroup(p_150895_1_, p_150895_2_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUse(ItemUseContext context) {
|
||||
if (context.getPlayer().isSneaking()) {
|
||||
context.getItem().setTag(null);
|
||||
if (context.getPlayer()
|
||||
.isSneaking()) {
|
||||
context.getItem()
|
||||
.setTag(null);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@ -52,7 +64,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
|
||||
if (world.isRemote)
|
||||
return validAxis ? ActionResultType.SUCCESS : ActionResultType.FAIL;
|
||||
|
||||
CompoundNBT tag = context.getItem().getOrCreateTag();
|
||||
CompoundNBT tag = context.getItem()
|
||||
.getOrCreateTag();
|
||||
BlockPos firstPulley = null;
|
||||
|
||||
// Remove first if no longer existant or valid
|
||||
@ -60,7 +73,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
|
||||
firstPulley = NBTUtil.readBlockPos(tag.getCompound("FirstPulley"));
|
||||
if (!validateAxis(world, firstPulley)) {
|
||||
tag.remove("FirstPulley");
|
||||
context.getItem().setTag(tag);
|
||||
context.getItem()
|
||||
.setTag(tag);
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,20 +89,29 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
|
||||
if (firstPulley != null && !firstPulley.equals(pos) && !world.isRemote) {
|
||||
createBelts(world, firstPulley, pos);
|
||||
AllTriggers.triggerFor(AllTriggers.CONNECT_BELT, context.getPlayer());
|
||||
if (!context.getPlayer().isCreative())
|
||||
context.getItem().shrink(1);
|
||||
if (!context.getPlayer()
|
||||
.isCreative())
|
||||
context.getItem()
|
||||
.shrink(1);
|
||||
}
|
||||
|
||||
if (!context.getItem().isEmpty()) {
|
||||
context.getItem().setTag(null);
|
||||
context.getPlayer().getCooldownTracker().setCooldown(this, 5);
|
||||
if (!context.getItem()
|
||||
.isEmpty()) {
|
||||
context.getItem()
|
||||
.setTag(null);
|
||||
context.getPlayer()
|
||||
.getCooldownTracker()
|
||||
.setCooldown(this, 5);
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
tag.put("FirstPulley", NBTUtil.writeBlockPos(pos));
|
||||
context.getItem().setTag(tag);
|
||||
context.getPlayer().getCooldownTracker().setCooldown(this, 5);
|
||||
context.getItem()
|
||||
.setTag(tag);
|
||||
context.getPlayer()
|
||||
.getCooldownTracker()
|
||||
.setCooldown(this, 5);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@ -99,25 +122,21 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
|
||||
|
||||
BlockPos diff = end.subtract(start);
|
||||
if (diff.getX() == diff.getZ())
|
||||
facing = Direction
|
||||
.getFacingFromAxis(facing.getAxisDirection(),
|
||||
world.getBlockState(start).get(BlockStateProperties.AXIS) == Axis.X ? Axis.Z : Axis.X);
|
||||
facing = Direction.getFacingFromAxis(facing.getAxisDirection(), world.getBlockState(start)
|
||||
.get(BlockStateProperties.AXIS) == Axis.X ? Axis.Z : Axis.X);
|
||||
|
||||
List<BlockPos> beltsToCreate = getBeltChainBetween(start, end, slope, facing);
|
||||
BlockState beltBlock = AllBlocks.BELT.get().getDefaultState();
|
||||
BlockState beltBlock = AllBlocks.BELT.get()
|
||||
.getDefaultState();
|
||||
|
||||
for (BlockPos pos : beltsToCreate) {
|
||||
BeltBlock.Part part = pos.equals(start) ? Part.START : pos.equals(end) ? Part.END : Part.MIDDLE;
|
||||
boolean pulley = ShaftBlock.isShaft(world.getBlockState(pos));
|
||||
if (part == Part.MIDDLE && pulley)
|
||||
part = Part.PULLEY;
|
||||
world
|
||||
.setBlockState(pos,
|
||||
beltBlock
|
||||
.with(BeltBlock.SLOPE, slope)
|
||||
world.setBlockState(pos, beltBlock.with(BeltBlock.SLOPE, slope)
|
||||
.with(BeltBlock.PART, part)
|
||||
.with(BeltBlock.HORIZONTAL_FACING, facing),
|
||||
3);
|
||||
.with(BeltBlock.HORIZONTAL_FACING, facing), 3);
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,7 +197,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
|
||||
return false;
|
||||
|
||||
BlockPos diff = second.subtract(first);
|
||||
Axis axis = world.getBlockState(first).get(BlockStateProperties.AXIS);
|
||||
Axis axis = world.getBlockState(first)
|
||||
.get(BlockStateProperties.AXIS);
|
||||
|
||||
int x = diff.getX();
|
||||
int y = diff.getY();
|
||||
@ -190,7 +210,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
|
||||
return false;
|
||||
if (sames != 1)
|
||||
return false;
|
||||
if (axis != world.getBlockState(second).get(BlockStateProperties.AXIS))
|
||||
if (axis != world.getBlockState(second)
|
||||
.get(BlockStateProperties.AXIS))
|
||||
return false;
|
||||
|
||||
TileEntity tileEntity = world.getTileEntity(first);
|
||||
@ -213,7 +234,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
|
||||
BlockState blockState = world.getBlockState(currentPos);
|
||||
if (ShaftBlock.isShaft(blockState) && blockState.get(ShaftBlock.AXIS) == axis)
|
||||
continue;
|
||||
if (!blockState.getMaterial().isReplaceable())
|
||||
if (!blockState.getMaterial()
|
||||
.isReplaceable())
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -226,7 +248,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther {
|
||||
return false;
|
||||
if (!ShaftBlock.isShaft(world.getBlockState(pos)))
|
||||
return false;
|
||||
if (world.getBlockState(pos).get(BlockStateProperties.AXIS) == Axis.Y)
|
||||
if (world.getBlockState(pos)
|
||||
.get(BlockStateProperties.AXIS) == Axis.Y)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -9,6 +9,10 @@ import net.minecraft.world.World;
|
||||
|
||||
public class ClutchBlock extends GearshiftBlock {
|
||||
|
||||
public ClutchBlock(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
return new ClutchTileEntity();
|
||||
|
@ -1,12 +1,10 @@
|
||||
package com.simibubi.create.modules.contraptions.relays.encased;
|
||||
|
||||
import com.simibubi.create.AllBlocksNew;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
|
||||
public class EncasedShaftTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
@ -16,8 +14,7 @@ public class EncasedShaftTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
@Override
|
||||
protected BlockState getRenderedBlockState(KineticTileEntity te) {
|
||||
return AllBlocksNew.SHAFT.getDefaultState().with(BlockStateProperties.AXIS,
|
||||
te.getBlockState().get(BlockStateProperties.AXIS));
|
||||
return shaft(getRotationAxisOf(te));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import com.simibubi.create.modules.contraptions.relays.gearbox.GearshiftTileEnti
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.StateContainer.Builder;
|
||||
@ -27,8 +26,8 @@ public class GearshiftBlock extends EncasedShaftBlock implements ITE<GearshiftTi
|
||||
|
||||
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
|
||||
|
||||
public GearshiftBlock() {
|
||||
super(Properties.from(Blocks.ANDESITE));
|
||||
public GearshiftBlock(Properties properties) {
|
||||
super(properties);
|
||||
setDefaultState(getDefaultState().with(POWERED, false));
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@ public class SplitShaftTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
@Override
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
Block block = te.getBlockState().getBlock();
|
||||
final Axis boxAxis = ((IRotate) block).getRotationAxis(te.getBlockState());
|
||||
final BlockPos pos = te.getPos();
|
||||
|
@ -3,9 +3,7 @@ package com.simibubi.create.modules.contraptions.relays.gauge;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.AllBlocksNew;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
import com.simibubi.create.modules.contraptions.base.IRotate;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.modules.contraptions.relays.gauge.GaugeBlock.Type;
|
||||
@ -15,7 +13,6 @@ import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
@ -37,8 +34,9 @@ public class GaugeTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
GaugeTileEntity gaugeTE = (GaugeTileEntity) te;
|
||||
int lightCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), gaugeState, te.getPos());
|
||||
|
||||
SuperByteBuffer headBuffer = (type == Type.SPEED ? AllBlockPartials.GAUGE_HEAD_SPEED
|
||||
: AllBlockPartials.GAUGE_HEAD_STRESS).renderOn(gaugeState);
|
||||
SuperByteBuffer headBuffer =
|
||||
(type == Type.SPEED ? AllBlockPartials.GAUGE_HEAD_SPEED : AllBlockPartials.GAUGE_HEAD_STRESS)
|
||||
.renderOn(gaugeState);
|
||||
SuperByteBuffer dialBuffer = AllBlockPartials.GAUGE_DIAL.renderOn(gaugeState);
|
||||
|
||||
for (Direction facing : Direction.values()) {
|
||||
@ -48,20 +46,22 @@ public class GaugeTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
float dialPivot = -5.75f / 16;
|
||||
float progress = MathHelper.lerp(partialTicks, gaugeTE.prevDialState, gaugeTE.dialState);
|
||||
dialBuffer.translate(0, dialPivot, dialPivot).rotate(Axis.X, (float) (Math.PI / 2 * -progress)).translate(0,
|
||||
-dialPivot, -dialPivot);
|
||||
dialBuffer.translate(0, dialPivot, dialPivot)
|
||||
.rotate(Axis.X, (float) (Math.PI / 2 * -progress))
|
||||
.translate(0, -dialPivot, -dialPivot);
|
||||
|
||||
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||
rotateBufferTowards(dialBuffer, facing).light(lightCoords).renderInto(ms, vb);
|
||||
rotateBufferTowards(headBuffer, facing).light(lightCoords).renderInto(ms, vb);
|
||||
rotateBufferTowards(dialBuffer, facing).light(lightCoords)
|
||||
.renderInto(ms, vb);
|
||||
rotateBufferTowards(headBuffer, facing).light(lightCoords)
|
||||
.renderInto(ms, vb);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState getRenderedBlockState(KineticTileEntity te) {
|
||||
return AllBlocksNew.SHAFT.getDefaultState().with(BlockStateProperties.AXIS,
|
||||
((IRotate) te.getBlockState().getBlock()).getRotationAxis(te.getBlockState()));
|
||||
return shaft(getRotationAxisOf(te));
|
||||
}
|
||||
|
||||
protected SuperByteBuffer rotateBufferTowards(SuperByteBuffer buffer, Direction target) {
|
||||
|
@ -7,7 +7,6 @@ import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.material.PushReaction;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
@ -25,8 +24,8 @@ import net.minecraft.world.storage.loot.LootContext.Builder;
|
||||
|
||||
public class GearboxBlock extends RotatedPillarKineticBlock {
|
||||
|
||||
public GearboxBlock() {
|
||||
super(Properties.from(Blocks.ANDESITE));
|
||||
public GearboxBlock(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,7 +41,7 @@ public class GearboxBlock extends RotatedPillarKineticBlock {
|
||||
@Override
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
super.fillItemGroup(group, items);
|
||||
items.add(new ItemStack(AllItems.VERTICAL_GEARBOX.get()));
|
||||
items.add(AllItems.VERTICAL_GEARBOX.asStack());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
@ -1,30 +1,44 @@
|
||||
package com.simibubi.create.modules.contraptions.relays.gearbox;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.item.IAddedByOther;
|
||||
import java.util.Map;
|
||||
|
||||
import com.simibubi.create.AllBlocksNew;
|
||||
import com.simibubi.create.modules.contraptions.base.IRotate;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class VerticalGearboxItem extends BlockItem implements IAddedByOther {
|
||||
public class VerticalGearboxItem extends BlockItem {
|
||||
|
||||
public VerticalGearboxItem(Properties builder) {
|
||||
super(AllBlocks.GEARBOX.get(), builder);
|
||||
super(AllBlocksNew.GEARBOX.get(), builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillItemGroup(ItemGroup p_150895_1_, NonNullList<ItemStack> p_150895_2_) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToBlockToItemMap(Map<Block, Item> p_195946_1_, Item p_195946_2_) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onBlockPlaced(BlockPos pos, World world, PlayerEntity player, ItemStack stack, BlockState state) {
|
||||
Axis prefferedAxis = null;
|
||||
for (Direction side : Direction.values()) {
|
||||
if (side.getAxis().isVertical())
|
||||
if (side.getAxis()
|
||||
.isVertical())
|
||||
continue;
|
||||
BlockState blockState = world.getBlockState(pos.offset(side));
|
||||
if (blockState.getBlock() instanceof IRotate) {
|
||||
@ -39,8 +53,9 @@ public class VerticalGearboxItem extends BlockItem implements IAddedByOther {
|
||||
}
|
||||
}
|
||||
|
||||
Axis axis = prefferedAxis == null ? player.getHorizontalFacing().rotateY().getAxis()
|
||||
: prefferedAxis == Axis.X ? Axis.Z : Axis.X;
|
||||
Axis axis = prefferedAxis == null ? player.getHorizontalFacing()
|
||||
.rotateY()
|
||||
.getAxis() : prefferedAxis == Axis.X ? Axis.Z : Axis.X;
|
||||
world.setBlockState(pos, state.with(BlockStateProperties.AXIS, axis));
|
||||
return super.onBlockPlaced(pos, world, player, stack, state);
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public class BlockzapperItem extends ZapperItem implements IHaveCustomItemModel
|
||||
|
||||
@Override
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
if (group == Create.creativeTab) {
|
||||
if (group == Create.baseCreativeTab) {
|
||||
ItemStack gunWithoutStuff = new ItemStack(this);
|
||||
items.add(gunWithoutStuff);
|
||||
|
||||
|
@ -0,0 +1,37 @@
|
||||
package com.simibubi.create.modules.palettes;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.CreateItemGroupBase;
|
||||
import com.simibubi.create.modules.Sections;
|
||||
import com.tterrag.registrate.util.entry.RegistryEntry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class PalettesItemGroup extends CreateItemGroupBase {
|
||||
|
||||
public PalettesItemGroup() {
|
||||
super("palettes");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldAdd(RegistryEntry<? extends Block> block) {
|
||||
Sections section = Create.registrate()
|
||||
.getSection(block);
|
||||
return section == Sections.PALETTES;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldAdd(AllItems item) {
|
||||
return item.section == Sections.PALETTES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack createIcon() {
|
||||
return new ItemStack(AllBlocks.IRON_GLASS.get());
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"powered=true,axis=x": { "model": "create:block/clutch_on", "y": 90 },
|
||||
"powered=true,axis=y": { "model": "create:block/clutch_on", "x": 90 },
|
||||
"powered=true,axis=z": { "model": "create:block/clutch_on" },
|
||||
"powered=false,axis=x": { "model": "create:block/clutch_off", "y": 90 },
|
||||
"powered=false,axis=y": { "model": "create:block/clutch_off", "x": 90 },
|
||||
"powered=false,axis=z": { "model": "create:block/clutch_off" }
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"axis=y": { "model": "create:block/gearbox" },
|
||||
"axis=z": { "model": "create:block/gearbox", "x": 90 },
|
||||
"axis=x": { "model": "create:block/gearbox", "x": 90, "y": 90 }
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"powered=true,axis=x": { "model": "create:block/gearshift_on", "y": 90 },
|
||||
"powered=true,axis=y": { "model": "create:block/gearshift_on", "x": 90 },
|
||||
"powered=true,axis=z": { "model": "create:block/gearshift_on" },
|
||||
"powered=false,axis=x": { "model": "create:block/gearshift_off", "y": 90 },
|
||||
"powered=false,axis=y": { "model": "create:block/gearshift_off", "x": 90 },
|
||||
"powered=false,axis=z": { "model": "create:block/gearshift_off" }
|
||||
}
|
||||
}
|
@ -1221,5 +1221,6 @@
|
||||
"tool.create.rose_quartz.tooltip": "ROSE QUARTZ TOOLS",
|
||||
"tool.create.rose_quartz.tooltip.summary": "This tool grants you a _greater_ _reach_ for _breaking_ _blocks_ or _placing_ _blocks_ from the off-hand.",
|
||||
|
||||
"itemGroup.create": "Create"
|
||||
"itemGroup.create.base": "Create",
|
||||
"itemGroup.create.palettes": "Create Palettes"
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "create:block/gearshift_off",
|
||||
"parent": "create:block/gearshift/block",
|
||||
"textures": {
|
||||
"0": "create:block/clutch_off",
|
||||
"particle": "create:block/clutch_off"
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "create:block/gearshift_off",
|
||||
"parent": "create:block/clutch/block",
|
||||
"textures": {
|
||||
"0": "create:block/clutch_on",
|
||||
"particle": "create:block/clutch_on"
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user