Generating water wheels and fans

- Kinetic TER now renders animated partials in the correct layer
- Ported Water wheel and Encased Fan to registrate
This commit is contained in:
simibubi 2020-05-19 16:41:54 +02:00
parent aebbec5ffc
commit b773ba697f
30 changed files with 300 additions and 202 deletions

View file

@ -58,6 +58,7 @@ e7c1db7226df5858f1884f0cf328a733fec22c3d assets\create\blockstates\dolomite_cobb
f63a5816d4bfe643aa098d03c3b54462dd06fe19 assets\create\blockstates\dolomite_cobblestone_wall.json
6d7f0c92ee978366d2b019e35cf2fc6a2e4de37d assets\create\blockstates\dolomite_pillar.json
7b1c40891b07c8f3238537625d9e25c8627e7333 assets\create\blockstates\encased_belt.json
7b2b836649e729feafa60972bf95e3afb2143131 assets\create\blockstates\encased_fan.json
373ac3c29b553322291599e93eac12000c4a87f8 assets\create\blockstates\encased_shaft.json
a774e815376a67e2a2de44e39af0a1a0b4406932 assets\create\blockstates\fancy_andesite_bricks.json
180be26a75834cf9cdb881f969f77906e91cc36a assets\create\blockstates\fancy_andesite_bricks_slab.json
@ -245,6 +246,7 @@ d62b7908119fa4f51715a186d0882b388bb25cab assets\create\blockstates\spruce_window
a2454400b1cf9889f70aebdc89c52a1be25f543c assets\create\blockstates\tiled_glass_pane.json
69dfe8afaa8eb6105dae9f76ab8b7847bf90b8c6 assets\create\blockstates\vertical_framed_glass.json
c4db76b9d36cfb098df0d158cb6f8b82768ebe14 assets\create\blockstates\vertical_framed_glass_pane.json
d995547bcd71603ba7378d8998098e462030bfd0 assets\create\blockstates\water_wheel.json
f182669f7547964f9f2ef67916568556870def7b assets\create\blockstates\weathered_limestone.json
27e6740834c0f673acc3531371512daa6dcab025 assets\create\blockstates\weathered_limestone_bricks.json
abb74e4f4c2b9851670cb6ad794281b0f7be0f5a assets\create\blockstates\weathered_limestone_bricks_slab.json
@ -257,8 +259,8 @@ c60c3115fd6eeaa3a696428a87a74d184ab7d62d assets\create\blockstates\weathered_lim
7e2476ffff93d0eedee5314e5692fcbf5692bffc assets\create\blockstates\weathered_limestone_pillar.json
7f39521b211441f5c3e06d60c5978cebe16cacfb assets\create\blockstates\zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets\create\blockstates\zinc_ore.json
d013d73098481a23a125ddddae232fe74a2c951d assets\create\lang\en_ud.json
ebefb80bc3f6e70ee7ba6ed20c614b10c9187a3b assets\create\lang\en_us.json
350ccf4bf90982344b692676638a64756bd7643d assets\create\lang\en_ud.json
4534b8c0efe107d7afc925ed0616246b7c7ea7ff assets\create\lang\en_us.json
846200eb548d3bfa2e77b41039de159b4b6cfb45 assets\create\models\block\acacia_window.json
1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets\create\models\block\acacia_window_pane_noside.json
1763ea2c9b981d187f5031ba608f3d5d3be3986a assets\create\models\block\acacia_window_pane_noside_alt.json
@ -822,6 +824,7 @@ be7de1e1529fb2a2e842204136520a760676d4e9 assets\create\models\item\dolomite_cobb
6b03f2be8fa1e62a89d59859e7d40f9e45ab8b65 assets\create\models\item\dolomite_cobblestone_wall.json
e974cd23a5456baef8b634f2d21fd8c3822931ab assets\create\models\item\dolomite_pillar.json
f2d6b88c3174de01e16da555236727efc33b490c assets\create\models\item\encased_belt.json
250bd0716cc1f04b03892ab74eb0b3a0f32a6158 assets\create\models\item\encased_fan.json
e0f9ad7e7d790e9e21a38fa57395fd3ff892359b assets\create\models\item\encased_shaft.json
efcbd30ad7a7658c02a3dc3de5fa0f21d7f49b54 assets\create\models\item\fancy_andesite_bricks.json
7ccd312084128c356307c7ca6e52c65d0a18907b assets\create\models\item\fancy_andesite_bricks_slab.json
@ -1009,6 +1012,7 @@ b1d3d00ff05908feacad06a86800da96cc9bc65d assets\create\models\item\tiled_glass.j
8a2a81a8cbc52b6021e57107d79a32f73b82d8fe assets\create\models\item\tiled_glass_pane.json
32f49b724af10c8d7e2ed5a3c82280e83b75f789 assets\create\models\item\vertical_framed_glass.json
5e331da9d4086412f5722923e3008246ed286a00 assets\create\models\item\vertical_framed_glass_pane.json
ae20383b0b0806431d0fdd8ffdd16fe2b0cc61ad assets\create\models\item\water_wheel.json
1d097a315c2817d16c241c86f66bd48e5e52f4b4 assets\create\models\item\weathered_limestone.json
fcc8ab312989ec485e2d86b856d81dbafaf0e930 assets\create\models\item\weathered_limestone_bricks.json
7e7abcb63aa5fc0dee50e116c93f8544768d4d95 assets\create\models\item\weathered_limestone_bricks_slab.json

View file

@ -0,0 +1,30 @@
{
"variants": {
"facing=down": {
"model": "create:block/encased_fan/block",
"x": 180
},
"facing=up": {
"model": "create:block/encased_fan/block"
},
"facing=north": {
"model": "create:block/encased_fan/block",
"x": 90
},
"facing=south": {
"model": "create:block/encased_fan/block",
"x": 90,
"y": 180
},
"facing=west": {
"model": "create:block/encased_fan/block",
"x": 90,
"y": 270
},
"facing=east": {
"model": "create:block/encased_fan/block",
"x": 90,
"y": 90
}
}
}

View file

@ -0,0 +1,23 @@
{
"variants": {
"facing=north": {
"model": "create:block/water_wheel",
"x": 90
},
"facing=south": {
"model": "create:block/water_wheel",
"x": 90,
"y": 180
},
"facing=west": {
"model": "create:block/water_wheel",
"x": 90,
"y": 270
},
"facing=east": {
"model": "create:block/water_wheel",
"x": 90,
"y": 90
}
}
}

View file

@ -59,6 +59,7 @@
"block.create.dolomite_cobblestone_wall": "\u05DF\u05DF\u0250M \u01DDuo\u0287s\u01DD\u05DFqqo\u0186 \u01DD\u0287\u0131\u026Fo\u05DFo\u15E1",
"block.create.dolomite_pillar": "\u0279\u0250\u05DF\u05DF\u0131\u0500 \u01DD\u0287\u0131\u026Fo\u05DFo\u15E1",
"block.create.encased_belt": "\u0287\u05DF\u01DD\u15FA p\u01DDs\u0250\u0254u\u018E",
"block.create.encased_fan": "u\u0250\u2132 p\u01DDs\u0250\u0254u\u018E",
"block.create.encased_shaft": "\u0287\u025F\u0250\u0265S p\u01DDs\u0250\u0254u\u018E",
"block.create.fancy_andesite_bricks": "s\u029E\u0254\u0131\u0279\u15FA \u01DD\u0287\u0131s\u01DDpu\u2C6F \u028E\u0254u\u0250\u2132",
"block.create.fancy_andesite_bricks_slab": "q\u0250\u05DFS s\u029E\u0254\u0131\u0279\u15FA \u01DD\u0287\u0131s\u01DDpu\u2C6F \u028E\u0254u\u0250\u2132",
@ -246,6 +247,7 @@
"block.create.tiled_glass_pane": "\u01DDu\u0250\u0500 ss\u0250\u05DF\u2141 p\u01DD\u05DF\u0131\u27D8",
"block.create.vertical_framed_glass": "ss\u0250\u05DF\u2141 p\u01DD\u026F\u0250\u0279\u2132 \u05DF\u0250\u0254\u0131\u0287\u0279\u01DD\u039B",
"block.create.vertical_framed_glass_pane": "\u01DDu\u0250\u0500 ss\u0250\u05DF\u2141 p\u01DD\u026F\u0250\u0279\u2132 \u05DF\u0250\u0254\u0131\u0287\u0279\u01DD\u039B",
"block.create.water_wheel": "\u05DF\u01DD\u01DD\u0265M \u0279\u01DD\u0287\u0250M",
"block.create.weathered_limestone": "\u01DDuo\u0287s\u01DD\u026F\u0131\uA780 p\u01DD\u0279\u01DD\u0265\u0287\u0250\u01DDM",
"block.create.weathered_limestone_bricks": "s\u029E\u0254\u0131\u0279\u15FA \u01DDuo\u0287s\u01DD\u026F\u0131\uA780 p\u01DD\u0279\u01DD\u0265\u0287\u0250\u01DDM",
"block.create.weathered_limestone_bricks_slab": "q\u0250\u05DFS s\u029E\u0254\u0131\u0279\u15FA \u01DDuo\u0287s\u01DD\u026F\u0131\uA780 p\u01DD\u0279\u01DD\u0265\u0287\u0250\u01DDM",

View file

@ -59,6 +59,7 @@
"block.create.dolomite_cobblestone_wall": "Dolomite Cobblestone Wall",
"block.create.dolomite_pillar": "Dolomite Pillar",
"block.create.encased_belt": "Encased Belt",
"block.create.encased_fan": "Encased Fan",
"block.create.encased_shaft": "Encased Shaft",
"block.create.fancy_andesite_bricks": "Fancy Andesite Bricks",
"block.create.fancy_andesite_bricks_slab": "Fancy Andesite Bricks Slab",
@ -246,6 +247,7 @@
"block.create.tiled_glass_pane": "Tiled Glass Pane",
"block.create.vertical_framed_glass": "Vertical Framed Glass",
"block.create.vertical_framed_glass_pane": "Vertical Framed Glass Pane",
"block.create.water_wheel": "Water Wheel",
"block.create.weathered_limestone": "Weathered Limestone",
"block.create.weathered_limestone_bricks": "Weathered Limestone Bricks",
"block.create.weathered_limestone_bricks_slab": "Weathered Limestone Bricks Slab",

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/encased_fan/item"
}

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/water_wheel"
}

View file

@ -31,7 +31,6 @@ import com.simibubi.create.modules.contraptions.components.crank.HandCrankBlock;
import com.simibubi.create.modules.contraptions.components.crusher.CrushingWheelBlock;
import com.simibubi.create.modules.contraptions.components.crusher.CrushingWheelControllerBlock;
import com.simibubi.create.modules.contraptions.components.deployer.DeployerBlock;
import com.simibubi.create.modules.contraptions.components.fan.EncasedFanBlock;
import com.simibubi.create.modules.contraptions.components.fan.NozzleBlock;
import com.simibubi.create.modules.contraptions.components.flywheel.FlywheelBlock;
import com.simibubi.create.modules.contraptions.components.flywheel.engine.FurnaceEngineBlock;
@ -41,7 +40,6 @@ import com.simibubi.create.modules.contraptions.components.mixer.MechanicalMixer
import com.simibubi.create.modules.contraptions.components.press.MechanicalPressBlock;
import com.simibubi.create.modules.contraptions.components.saw.SawBlock;
import com.simibubi.create.modules.contraptions.components.turntable.TurntableBlock;
import com.simibubi.create.modules.contraptions.components.waterwheel.WaterWheelBlock;
import com.simibubi.create.modules.contraptions.processing.BasinBlock;
import com.simibubi.create.modules.contraptions.redstone.AnalogLeverBlock;
import com.simibubi.create.modules.contraptions.redstone.ContactBlock;
@ -107,8 +105,8 @@ public enum AllBlocks implements NonNullSupplier<Block> {
// ADJUSTABLE_PULLEY(AdjustablePulleyBlock::new),
// BELT(BeltBlock::new, ComesWith.NO_BLOCKITEM),
// CREATIVE_MOTOR(MotorBlock::new),
WATER_WHEEL(WaterWheelBlock::new),
ENCASED_FAN(EncasedFanBlock::new),
// WATER_WHEEL(WaterWheelBlock::new),
// ENCASED_FAN(EncasedFanBlock::new),
NOZZLE(NozzleBlock::new),
TURNTABLE(TurntableBlock::new),
HAND_CRANK(HandCrankBlock::new),

View file

@ -1,6 +1,7 @@
package com.simibubi.create;
import static com.simibubi.create.foundation.utility.data.BlockStateGen.oxidizedBlockstate;
import static com.simibubi.create.foundation.utility.data.ModelGen.customItemModel;
import static com.simibubi.create.foundation.utility.data.ModelGen.oxidizedItemModel;
import static com.simibubi.create.modules.Sections.SCHEMATICS;
@ -10,8 +11,10 @@ import com.simibubi.create.foundation.utility.data.AssetLookup;
import com.simibubi.create.foundation.utility.data.BlockStateGen;
import com.simibubi.create.foundation.world.OxidizingBlock;
import com.simibubi.create.modules.Sections;
import com.simibubi.create.modules.contraptions.components.fan.EncasedFanBlock;
import com.simibubi.create.modules.contraptions.components.motor.MotorBlock;
import com.simibubi.create.modules.contraptions.components.motor.MotorGenerator;
import com.simibubi.create.modules.contraptions.components.waterwheel.WaterWheelBlock;
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.modules.contraptions.relays.belt.BeltGenerator;
import com.simibubi.create.modules.contraptions.relays.elementary.CogWheelBlock;
@ -36,6 +39,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.tags.BlockTags;
@ -60,9 +64,7 @@ public class AllBlocksNew {
REGISTRATE.block("schematicannon", SchematicannonBlock::new)
.initialProperties(() -> Blocks.DISPENSER)
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov)))
.item()
.model(AssetLookup::customItemModel)
.build()
.transform(customItemModel())
.register();
public static final BlockEntry<SchematicTableBlock> SCHEMATIC_TABLE =
@ -106,33 +108,25 @@ public class AllBlocksNew {
REGISTRATE.block("encased_shaft", EncasedShaftBlock::new)
.initialProperties(SharedProperties::kinetic)
.blockstate(BlockStateGen.axisBlockProvider(true))
.item()
.model(AssetLookup::customItemModel)
.build()
.transform(customItemModel())
.register();
public static final BlockEntry<GearboxBlock> GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new)
.initialProperties(SharedProperties::kinetic)
.blockstate(BlockStateGen.axisBlockProvider(true))
.item()
.model(AssetLookup::customItemModel)
.build()
.transform(customItemModel())
.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()
.transform(customItemModel())
.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()
.transform(customItemModel())
.register();
public static final BlockEntry<EncasedBeltBlock> ENCASED_BELT =
@ -140,9 +134,7 @@ public class AllBlocksNew {
.initialProperties(SharedProperties::kinetic)
.blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> p.models()
.getExistingFile(p.modLoc("block/" + c.getName() + "/" + suffix))).generate(c, p))
.item()
.model(AssetLookup::customItemModel)
.build()
.transform(customItemModel())
.register();
public static final BlockEntry<AdjustablePulleyBlock> ADJUSTABLE_PULLEY =
@ -170,9 +162,24 @@ public class AllBlocksNew {
.initialProperties(SharedProperties::kinetic)
.blockstate(new MotorGenerator()::generate)
.transform(StressConfigDefaults.setCapacity(16384.0))
.item()
.model(AssetLookup::customItemModel)
.build()
.transform(customItemModel())
.register();
public static final BlockEntry<WaterWheelBlock> WATER_WHEEL = REGISTRATE.block("water_wheel", WaterWheelBlock::new)
.initialProperties(SharedProperties::woodenKinetic)
.blockstate(BlockStateGen.horizontalWheelProvider(false))
.addLayer(() -> RenderType::getCutoutMipped)
.transform(StressConfigDefaults.setCapacity(16.0))
.simpleItem()
.register();
public static final BlockEntry<EncasedFanBlock> ENCASED_FAN = REGISTRATE.block("encased_fan", EncasedFanBlock::new)
.initialProperties(SharedProperties::kinetic)
.blockstate(BlockStateGen.directionalBlockProvider(true))
.addLayer(() -> RenderType::getCutoutMipped)
.transform(StressConfigDefaults.setCapacity(16.0))
.transform(StressConfigDefaults.setImpact(2.0))
.transform(customItemModel())
.register();
// Materials

View file

@ -114,7 +114,7 @@ public enum AllTileEntities {
TURNTABLE(TurntableTileEntity::new, AllBlocks.TURNTABLE),
ENCASED_SHAFT(EncasedShaftTileEntity::new, AllBlocksNew.ENCASED_SHAFT, AllBlocksNew.ENCASED_BELT),
ADJUSTABLE_PULLEY(AdjustablePulleyTileEntity::new, AllBlocksNew.ADJUSTABLE_PULLEY),
ENCASED_FAN(EncasedFanTileEntity::new, AllBlocks.ENCASED_FAN),
ENCASED_FAN(EncasedFanTileEntity::new, AllBlocksNew.ENCASED_FAN),
NOZZLE(NozzleTileEntity::new, AllBlocks.NOZZLE),
CLUTCH(ClutchTileEntity::new, AllBlocksNew.CLUTCH),
GEARSHIFT(GearshiftTileEntity::new, AllBlocksNew.GEARSHIFT),
@ -138,7 +138,7 @@ public enum AllTileEntities {
MILLSTONE(MillstoneTileEntity::new, AllBlocks.MILLSTONE),
CRUSHING_WHEEL(CrushingWheelTileEntity::new, AllBlocks.CRUSHING_WHEEL),
CRUSHING_WHEEL_CONTROLLER(CrushingWheelControllerTileEntity::new, AllBlocks.CRUSHING_WHEEL_CONTROLLER),
WATER_WHEEL(WaterWheelTileEntity::new, AllBlocks.WATER_WHEEL),
WATER_WHEEL(WaterWheelTileEntity::new, AllBlocksNew.WATER_WHEEL),
MECHANICAL_PRESS(MechanicalPressTileEntity::new, AllBlocks.MECHANICAL_PRESS),
MECHANICAL_MIXER(MechanicalMixerTileEntity::new, AllBlocks.MECHANICAL_MIXER),
DEPLOYER(DeployerTileEntity::new, AllBlocks.DEPLOYER),

View file

@ -15,4 +15,8 @@ public class SharedProperties {
return Blocks.ANDESITE;
}
static Block woodenKinetic() {
return Blocks.STRIPPED_SPRUCE_WOOD;
}
}

View file

@ -5,6 +5,7 @@ import java.util.stream.Collectors;
import com.google.common.base.Predicate;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllRecipes;
import com.simibubi.create.Create;
@ -139,7 +140,7 @@ public class CreateJEI implements IModPlugin {
@Override
public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) {
ItemStack fan = new ItemStack(AllBlocks.ENCASED_FAN.get());
ItemStack fan = new ItemStack(AllBlocksNew.ENCASED_FAN.get());
ItemStack splashingFan = fan
.copy()

View file

@ -4,7 +4,7 @@ import java.util.Arrays;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.ScreenResources;
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
import com.simibubi.create.foundation.gui.GuiGameElement;
@ -62,7 +62,7 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
.scale(scale)
.render();
GuiGameElement.of(AllBlocks.ENCASED_FAN.getDefault())
GuiGameElement.of(AllBlocksNew.ENCASED_FAN.getDefaultState())
.rotateBlock(0, 180, 0)
.atLocal(0, 0, 0)
.scale(scale)

View file

@ -47,11 +47,11 @@ public class StressConfigDefaults {
return 1024;
case MECHANICAL_BEARING:
return 512;
case ENCASED_FAN:
// case ENCASED_FAN:
case HAND_CRANK:
return 32;
case WATER_WHEEL:
return 8;
// case WATER_WHEEL:
// return 8;
default:
return -1;
}
@ -82,7 +82,7 @@ public class StressConfigDefaults {
return 2;
// case BELT:
case ENCASED_FAN:
// case ENCASED_FAN:
case CUCKOO_CLOCK:
return 1;

View file

@ -61,9 +61,9 @@ public class CreateAdvancements implements IDataProvider {
kineticsBranch(t, andesite_alloy);
Advancement water_wheel = advancement("water_wheel", AllBlocks.WATER_WHEEL.get(), TaskType.NORMAL)
Advancement water_wheel = advancement("water_wheel", AllBlocksNew.WATER_WHEEL.get(), TaskType.NORMAL)
.withParent(andesite_alloy)
.withCriterion("0", placeBlock(AllBlocks.WATER_WHEEL.get()))
.withCriterion("0", placeBlock(AllBlocksNew.WATER_WHEEL.get()))
.withCriterion("1", AllTriggers.WATER_WHEEL.instance())
.register(t, id + ":water_wheel");

View file

@ -20,12 +20,43 @@ import net.minecraftforge.client.model.generators.ModelFile;
public class BlockStateGen {
// Functions
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));
return (c, p) -> BlockStateGen.axisBlock(c, p, getBlockModel(customItem, c, p));
}
public static <T extends Block> NonNullBiConsumer<DataGenContext<Block, T>, RegistrateBlockstateProvider> directionalBlockProvider(
boolean customItem) {
return (c, p) -> p.directionalBlock(c.get(), getBlockModel(customItem, c, p));
}
public static <T extends Block> NonNullBiConsumer<DataGenContext<Block, T>, RegistrateBlockstateProvider> horizontalWheelProvider(
boolean customItem) {
return (c, p) -> BlockStateGen.horizontalWheel(c, p, getBlockModel(customItem, c, p));
}
public static <P> NonNullUnaryOperator<BlockBuilder<OxidizingBlock, P>> oxidizedBlockstate() {
return b -> b.blockstate((ctx, prov) -> prov.getVariantBuilder(ctx.getEntry())
.forAllStates(state -> {
String name = ModelGen.getOxidizedModel(ctx.getName(), state.get(OxidizingBlock.OXIDIZATION));
return ConfiguredModel.builder()
.modelFile(prov.models()
.cubeAll(name, prov.modLoc(name)))
.build();
}));
}
// Utility
private static <T extends Block> Function<BlockState, ModelFile> getBlockModel(boolean customItem,
DataGenContext<Block, T> c, RegistrateBlockstateProvider p) {
return $ -> customItem ? AssetLookup.partialBaseModel(c, p) : AssetLookup.standardModel(c, p);
}
// Generators
public static <T extends Block> void axisBlock(DataGenContext<Block, T> ctx, RegistrateBlockstateProvider prov,
Function<BlockState, ModelFile> modelFunc) {
prov.getVariantBuilder(ctx.getEntry())
@ -39,6 +70,17 @@ public class BlockStateGen {
});
}
public static <T extends Block> void horizontalWheel(DataGenContext<Block, T> ctx,
RegistrateBlockstateProvider prov, Function<BlockState, ModelFile> modelFunc) {
prov.getVariantBuilder(ctx.get())
.forAllStates(state -> ConfiguredModel.builder()
.modelFile(modelFunc.apply(state))
.rotationX(90)
.rotationY(((int) state.get(BlockStateProperties.HORIZONTAL_FACING)
.getHorizontalAngle() + 180) % 360)
.build());
}
public static <T extends Block> void cubeAll(DataGenContext<Block, T> ctx, RegistrateBlockstateProvider prov,
String textureSubDir) {
cubeAll(ctx, prov, textureSubDir, ctx.getName());
@ -59,14 +101,4 @@ public class BlockStateGen {
.build());
}
public static <P> NonNullUnaryOperator<BlockBuilder<OxidizingBlock, P>> oxidizedBlockstate() {
return b -> b.blockstate((ctx, prov) -> prov.getVariantBuilder(ctx.getEntry())
.forAllStates(state -> {
String name = ModelGen.getOxidizedModel(ctx.getName(), state.get(OxidizingBlock.OXIDIZATION));
return ConfiguredModel.builder()
.modelFile(prov.models().cubeAll(name, prov.modLoc(name)))
.build();
}));
}
}

View file

@ -1,9 +1,11 @@
package com.simibubi.create.foundation.utility.data;
import com.simibubi.create.Create;
import com.tterrag.registrate.builders.BlockBuilder;
import com.tterrag.registrate.builders.ItemBuilder;
import com.tterrag.registrate.providers.DataGenContext;
import com.tterrag.registrate.util.nullness.NonNullFunction;
import com.tterrag.registrate.util.nullness.NonNullUnaryOperator;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
@ -30,7 +32,16 @@ public class ModelGen {
}
public static <P> NonNullFunction<ItemBuilder<BlockItem, P>, P> oxidizedItemModel() {
return b -> b.model((ctx, prov) -> prov.withExistingParent(ctx.getName(), prov.modLoc(ModelGen.getOxidizedModel(ctx.getName(), 0)))).build();
return b -> b
.model((ctx, prov) -> prov.withExistingParent(ctx.getName(),
prov.modLoc(ModelGen.getOxidizedModel(ctx.getName(), 0))))
.build();
}
public static <B extends Block, P> NonNullUnaryOperator<BlockBuilder<B, P>> customItemModel() {
return b -> b.item()
.model(AssetLookup::customItemModel)
.build();
}
public static String getOxidizedModel(String name, int level) {

View file

@ -15,6 +15,7 @@ import com.simibubi.create.modules.contraptions.relays.elementary.CogWheelBlock;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction.Axis;
@ -35,7 +36,9 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
@Override
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) {
renderRotatingBuffer(te, getRotatedModel(te), ms, buffer.getBuffer(RenderType.getSolid()));
for (RenderType type : RenderType.getBlockLayers())
if (RenderTypeLookup.canRenderInLayer(te.getBlockState(), type))
renderRotatingBuffer(te, getRotatedModel(te), ms, buffer.getBuffer(type));
}
public static void renderRotatingKineticBlock(KineticTileEntity te, BlockState renderedState, MatrixStack ms,

View file

@ -7,6 +7,7 @@ import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.utility.AllShapes;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity;
@ -36,6 +37,11 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock implements ITE
return state.get(AXIS);
}
@Override
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.ENTITYBLOCK_ANIMATED;
}
@Override
public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos,
ISelectionContext context) {

View file

@ -6,7 +6,6 @@ import com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemUseContext;
import net.minecraft.tileentity.TileEntity;
@ -20,8 +19,8 @@ import net.minecraft.world.World;
public class EncasedFanBlock extends DirectionalKineticBlock implements ITE<EncasedFanTileEntity> {
public EncasedFanBlock() {
super(Properties.from(Blocks.ANDESITE));
public EncasedFanBlock(Properties properties) {
super(properties);
}
@Override

View file

@ -28,7 +28,7 @@ public class EncasedFanTileEntityRenderer extends KineticTileEntityRenderer {
Direction direction = te.getBlockState().get(FACING);
SuperByteBuffer superBuffer = AllBlockPartials.SHAFT_HALF.renderOnDirectional(te.getBlockState(),
direction.getOpposite());
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
IVertexBuilder vb = buffer.getBuffer(RenderType.getCutoutMipped());
standardKineticRotationTransform(superBuffer, te).renderInto(ms, vb);
float time = AnimationTickHolder.getRenderTick();

View file

@ -1,6 +1,6 @@
package com.simibubi.create.modules.contraptions.components.fan;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.utility.AllShapes;
import com.simibubi.create.modules.contraptions.IWrenchable;
@ -22,7 +22,7 @@ import net.minecraft.world.World;
public class NozzleBlock extends ProperDirectionalBlock implements IWrenchable {
public NozzleBlock() {
super(Properties.from(AllBlocks.ENCASED_FAN.get()));
super(Properties.from(AllBlocksNew.ENCASED_FAN.get()));
}
@Override
@ -72,7 +72,7 @@ public class NozzleBlock extends ProperDirectionalBlock implements IWrenchable {
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
Direction towardsFan = state.get(FACING).getOpposite();
BlockState fanState = worldIn.getBlockState(pos.offset(towardsFan));
return AllBlocks.ENCASED_FAN.typeOf(fanState)
return AllBlocksNew.ENCASED_FAN.has(fanState)
&& fanState.get(EncasedFanBlock.FACING) == towardsFan.getOpposite();
}

View file

@ -1,14 +1,14 @@
package com.simibubi.create.modules.contraptions.components.waterwheel;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.config.AllConfigs;
import com.simibubi.create.foundation.advancement.AllTriggers;
import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.utility.WrappedWorld;
import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.IFluidState;
import net.minecraft.item.BlockItemUseContext;
@ -25,8 +25,8 @@ import net.minecraft.world.World;
public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<WaterWheelTileEntity> {
public WaterWheelBlock() {
super(Properties.from(Blocks.STRIPPED_SPRUCE_WOOD));
public WaterWheelBlock(Properties properties) {
super(properties);
}
@Override
@ -34,22 +34,22 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
return new WaterWheelTileEntity();
}
// @Override // TODO 1.15 register layer
// public BlockRenderLayer getRenderLayer() {
// return BlockRenderLayer.CUTOUT;
// }
@Override
protected boolean hasStaticPart() {
return false;
}
@Override
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.ENTITYBLOCK_ANIMATED;
}
@Override
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
for (Direction direction : Direction.values()) {
BlockPos neighbourPos = pos.offset(direction);
BlockState neighbourState = worldIn.getBlockState(neighbourPos);
if (!AllBlocks.WATER_WHEEL.typeOf(neighbourState))
if (!AllBlocksNew.WATER_WHEEL.has(neighbourState))
continue;
if (neighbourState.get(HORIZONTAL_FACING).getAxis() != state.get(HORIZONTAL_FACING).getAxis()
|| state.get(HORIZONTAL_FACING).getAxis() != direction.getAxis())
@ -130,7 +130,7 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
public BlockState getStateForPlacement(BlockItemUseContext context) {
Direction facing = context.getFace();
BlockState placedOn = context.getWorld().getBlockState(context.getPos().offset(facing.getOpposite()));
if (AllBlocks.WATER_WHEEL.typeOf(placedOn))
if (AllBlocksNew.WATER_WHEEL.has(placedOn))
return getDefaultState().with(HORIZONTAL_FACING, placedOn.get(HORIZONTAL_FACING));
if (facing.getAxis().isHorizontal())
return getDefaultState().with(HORIZONTAL_FACING,

View file

@ -3,7 +3,7 @@ package com.simibubi.create.modules.contraptions.components.waterwheel;
import java.util.HashMap;
import java.util.Map;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBlocksNew;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.modules.contraptions.base.GeneratingKineticTileEntity;
@ -28,7 +28,8 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity {
super.read(compound);
if (compound.contains("Flows")) {
for (Direction d : Direction.values())
setFlow(d, compound.getCompound("Flows").getFloat(d.getName()));
setFlow(d, compound.getCompound("Flows")
.getFloat(d.getName()));
}
}
@ -63,8 +64,8 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity {
@Override
public void lazyTick() {
super.lazyTick();
WaterWheelBlock block = (WaterWheelBlock) AllBlocks.WATER_WHEEL.get();
block.updateAllSides(getBlockState(), world, pos);
AllBlocksNew.WATER_WHEEL.get()
.updateAllSides(getBlockState(), world, pos);
}
}

View file

@ -1,10 +0,0 @@
{
"variants": {
"facing=north": { "model": "create:block/encased_fan/casing", "y": 0 },
"facing=south": { "model": "create:block/encased_fan/casing", "y": 180 },
"facing=west": { "model": "create:block/encased_fan/casing", "y": 270 },
"facing=up": { "model": "create:block/encased_fan/casing", "x": 270 },
"facing=down": { "model": "create:block/encased_fan/casing", "x": 90 },
"facing=east": { "model": "create:block/encased_fan/casing", "y": 90 }
}
}

View file

@ -1,8 +0,0 @@
{
"variants": {
"facing=north": { "model": "create:block/water_wheel", "x": 90 },
"facing=east": { "model": "create:block/water_wheel", "x": 90, "y": 90 },
"facing=south": { "model": "create:block/water_wheel", "x": 90, "y": 180 },
"facing=west": { "model": "create:block/water_wheel", "x": 90, "y": 270 }
}
}

View file

@ -0,0 +1,78 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"back": "create:block/gearbox",
"fan_casing": "create:block/fan_casing",
"particle": "create:block/fan_side",
"fan_side": "create:block/fan_side"
},
"elements": [
{
"name": "Bottom",
"from": [0, 0, 0],
"to": [16, 16, 2],
"faces": {
"north": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#fan_side"},
"east": {"uv": [14, 0, 16, 16], "texture": "#fan_side"},
"south": {"uv": [0, 0, 16, 16], "texture": "#fan_side"},
"west": {"uv": [14, 0, 16, 16], "rotation": 180, "texture": "#fan_side"},
"up": {"uv": [0, 14, 16, 16], "rotation": 180, "texture": "#fan_casing"},
"down": {"uv": [0, 14, 16, 16], "texture": "#fan_casing"}
}
},
{
"name": "Top",
"from": [0, 0, 14],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#fan_side"},
"east": {"uv": [0, 0, 2, 16], "texture": "#fan_side"},
"south": {"uv": [0, 0, 16, 16], "texture": "#fan_side"},
"west": {"uv": [14, 0, 16, 16], "texture": "#fan_side"},
"up": {"uv": [0, 0, 16, 2], "rotation": 180, "texture": "#fan_casing"},
"down": {"uv": [0, 0, 16, 2], "texture": "#fan_casing"}
}
},
{
"name": "Side",
"from": [0, 0, 2],
"to": [2, 16, 14],
"faces": {
"east": {"uv": [2, 0, 14, 16], "texture": "#fan_side"},
"west": {"uv": [14, 0, 2, 16], "texture": "#fan_side"},
"up": {"uv": [14, 2, 16, 14], "rotation": 180, "texture": "#fan_casing"},
"down": {"uv": [0, 2, 2, 14], "texture": "#fan_casing"}
}
},
{
"name": "Side",
"from": [14, 0, 2],
"to": [16, 16, 14],
"faces": {
"east": {"uv": [2, 0, 14, 16], "rotation": 180, "texture": "#fan_side"},
"west": {"uv": [14, 0, 2, 16], "texture": "#fan_side"},
"up": {"uv": [0, 2, 2, 14], "rotation": 180, "texture": "#fan_casing"},
"down": {"uv": [14, 2, 16, 14], "texture": "#fan_casing"}
}
},
{
"name": "Lattice",
"from": [2, 15, 2],
"to": [14, 15, 14],
"faces": {
"up": {"uv": [2, 2, 14, 14], "rotation": 180, "texture": "#fan_casing"},
"down": {"uv": [2, 2, 14, 14], "texture": "#fan_casing"}
}
},
{
"name": "Back",
"from": [2, 1, 2],
"to": [14, 7, 14],
"faces": {
"up": {"uv": [2, 2, 14, 14], "rotation": 180, "texture": "#back"},
"down": {"uv": [2, 2, 14, 14], "texture": "#back"}
}
}
]
}

View file

@ -1,78 +0,0 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"back": "create:block/gearbox",
"fan_casing": "create:block/fan_casing",
"fan_side": "create:block/fan_side",
"particle": "create:block/fan_side"
},
"elements": [
{
"name": "Bottom",
"from": [0, 0, 0],
"to": [16, 2, 16],
"faces": {
"north": {"uv": [0, 14, 16, 16], "texture": "#fan_casing"},
"east": {"uv": [14, 0, 16, 16], "rotation": 90, "texture": "#fan_side"},
"south": {"uv": [0, 14, 16, 16], "texture": "#fan_casing"},
"west": {"uv": [14, 0, 16, 16], "rotation": 90, "texture": "#fan_side"},
"up": {"uv": [0, 0, 16, 16], "texture": "#fan_side"},
"down": {"uv": [0, 0, 16, 16], "texture": "#fan_side"}
}
},
{
"name": "Top",
"from": [0, 14, 0],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 16, 2], "texture": "#fan_casing"},
"east": {"uv": [0, 0, 2, 16], "rotation": 90, "texture": "#fan_side"},
"south": {"uv": [0, 0, 16, 2], "texture": "#fan_casing"},
"west": {"uv": [14, 0, 16, 16], "rotation": 270, "texture": "#fan_side"},
"up": {"uv": [0, 0, 16, 16], "texture": "#fan_side"},
"down": {"uv": [0, 0, 16, 16], "texture": "#fan_side"}
}
},
{
"name": "Side",
"from": [0, 2, 0],
"to": [2, 14, 16],
"faces": {
"north": {"uv": [14, 2, 16, 14], "texture": "#fan_casing"},
"east": {"uv": [2, 0, 14, 16], "rotation": 90, "texture": "#fan_side"},
"south": {"uv": [0, 2, 2, 14], "texture": "#fan_casing"},
"west": {"uv": [14, 0, 2, 16], "rotation": 270, "texture": "#fan_side"}
}
},
{
"name": "Side",
"from": [14, 2, 0],
"to": [16, 14, 16],
"faces": {
"north": {"uv": [0, 2, 2, 14], "texture": "#fan_casing"},
"east": {"uv": [2, 0, 14, 16], "rotation": 270, "texture": "#fan_side"},
"south": {"uv": [14, 2, 16, 14], "texture": "#fan_casing"},
"west": {"uv": [14, 0, 2, 16], "rotation": 270, "texture": "#fan_side"}
}
},
{
"name": "Lattice",
"from": [2, 2, 1],
"to": [14, 14, 1],
"faces": {
"north": {"uv": [2, 2, 14, 14], "texture": "#fan_casing"},
"south": {"uv": [2, 2, 14, 14], "texture": "#fan_casing"}
}
},
{
"name": "Back",
"from": [2, 2, 9],
"to": [14, 14, 15],
"faces": {
"north": {"uv": [2, 2, 14, 14], "texture": "#back"},
"south": {"uv": [2, 2, 14, 14], "texture": "#back"}
}
}
]
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/encased_fan/item"
}

View file

@ -1,10 +0,0 @@
{
"parent": "create:block/water_wheel",
"display": {
"fixed": {
"rotation": [ 90, 0, 0 ],
"translation": [ 0, 0, 0],
"scale":[ 0.5, 0.5, 0.5 ]
}
}
}