- Added the Spout
- Added Safety check to the drain cap rendering condition
Highly unstable
This commit is contained in:
simibubi 2020-08-28 22:45:27 +02:00
parent 36d3f7e4a3
commit 230a6cf848
48 changed files with 1075 additions and 106 deletions

View file

@ -329,6 +329,7 @@ b6e50f46a02f833f2f2bafa8585a909b6da5e229 assets/create/blockstates/scoria_cobble
c4c3613ad353e721e7109628aa06ab0664d0862b assets/create/blockstates/shadow_steel_casing.json
79ae6d86a829b9ce82fce68a6377d3810fcfcb10 assets/create/blockstates/shaft.json
e815bfd854c2653f10828bb11950f7fb991d7efc assets/create/blockstates/speedometer.json
1cb7cdbefa0ff199263782809287854b9d85074c assets/create/blockstates/spout.json
d62b7908119fa4f51715a186d0882b388bb25cab assets/create/blockstates/spruce_window.json
8d7dfa60630a8b4bae4e8eca5c66e1cfa34dda1f assets/create/blockstates/spruce_window_pane.json
3d93eabbb327aecc526beae9c62283f1d43eb710 assets/create/blockstates/sticky_mechanical_piston.json
@ -359,17 +360,17 @@ c77b46d8b459e5c7cc495393546f3fcca8a1fa1d assets/create/blockstates/weathered_lim
a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.json
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
15f8e8f779c6ce41a9e42d87796df14d1415ab5a assets/create/lang/en_ud.json
3c6d8906ded9a78050003f8b029407ef2078da87 assets/create/lang/en_us.json
1abcbe5404e82eb9b944c9075eb39ff3b20512e5 assets/create/lang/unfinished/de_de.json
e9f885ab2cee12075ec10a85e95e2f0a7fc49d9b assets/create/lang/unfinished/fr_fr.json
44331773068529facc64870b0762609567fec8b6 assets/create/lang/unfinished/it_it.json
e3c2ef988da795fc84ea8a9bff8b8557ac6c370a assets/create/lang/unfinished/ja_jp.json
a5c17249f0b2575c372c658bfd958fe4244fb5d6 assets/create/lang/unfinished/ko_kr.json
abcfc0ab1bf1b077f0aeaf54e00c2aceef78d253 assets/create/lang/unfinished/nl_nl.json
899ebaa95bf6d3140bf6bbcf6f8a5fab2ab5111e assets/create/lang/unfinished/pt_br.json
bba218b9d488faf4406d975eba81996f621b2200 assets/create/lang/unfinished/ru_ru.json
b87385232b0be35079736a3a32ff88f252721cf3 assets/create/lang/unfinished/zh_cn.json
6951f31ae429d71ea970db45e981f4f0a9f4e0ef assets/create/lang/en_ud.json
5f12d17a67dbadd1a892ccc6a7c1663cfee691ae assets/create/lang/en_us.json
b361a5e10f044efb61212a6d49c0e0081f7ed641 assets/create/lang/unfinished/de_de.json
fdb4f997098841013b5b7d0c2b2bbb0bd1c39961 assets/create/lang/unfinished/fr_fr.json
6cd3717f6e5bc3bf895ce1d0c74e9b86ebde1884 assets/create/lang/unfinished/it_it.json
6ab1ccc23eec682f9d38c8231aacb6be8bba71f1 assets/create/lang/unfinished/ja_jp.json
9313981d23bc87b0591cb7b019ebc4be48a574b3 assets/create/lang/unfinished/ko_kr.json
090fbc394a4dead321437002ca2c66e42b1cb9a1 assets/create/lang/unfinished/nl_nl.json
de59c0d0e2ff8731ecf2b6547b16e4b85f30d226 assets/create/lang/unfinished/pt_br.json
302c4a980c77791ea816b190c37b43805b3bfce2 assets/create/lang/unfinished/ru_ru.json
f254cf4f96c9a1338e94418298a7900089b6dfa9 assets/create/lang/unfinished/zh_cn.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
@ -1376,6 +1377,7 @@ da72ccdc893fbdd3efa9c22143b88eb756c20e44 assets/create/models/item/shadow_steel.
081326d6666cfcfe34c45c1b74bfceba0b01ae6e assets/create/models/item/shadow_steel_casing.json
106ae694f7e03a218c37003dca8291b1d39b3c55 assets/create/models/item/shaft.json
d6fb0d38b1b5bcc199b52ac8889eaecd167f6725 assets/create/models/item/speedometer.json
b9abe1331d49871838231f3a8e5d2973634e9325 assets/create/models/item/spout.json
b305e81f1dc5272634745b6e822af40955a2ef28 assets/create/models/item/spruce_window.json
5f622bca8386b8dd077310647e39ac3abb80c6a1 assets/create/models/item/spruce_window_pane.json
891abc24593d53d282773eca5534065056d89b4c assets/create/models/item/sticky_mechanical_piston.json
@ -1444,6 +1446,8 @@ a135eec618e448f440d9f42cc7a3e6c63fc45a71 data/create/advancements/overstressed.j
1e3cd82e36fd4bcd053d652a0eead4458ed7f315 data/create/advancements/press.json
b2782692d27ffb105e3167174cebe1ebdd4a9867 data/create/advancements/recipes/create.base/brass_block.json
df6f220e693f5256bb3df8d6c7769bc931820ae5 data/create/advancements/recipes/create.base/copper_block.json
ad7cc8272c59a1b7c4c8ff4202af0d3f73d83d69 data/create/advancements/recipes/create.base/crafting_shaped/kinetics/basin.json
13ce9f0affe707921c574a7e27d14a487ec97edd data/create/advancements/recipes/create.base/crafting_shaped/kinetics/schematic_table.json
dbe67196168805a5903aa29de7631d33329060d1 data/create/advancements/recipes/create.base/crafting_shaped/schematics/schematic_table.json
0c5badff77b751b086b0da5943bea186256668cb data/create/advancements/recipes/create.base/crafting_shaped/schematics/schematicannon.json
c2ff86e360002e714877060540378940b8d72c4b data/create/advancements/recipes/create.base/crafting_shapeless/appliances/dough.json
@ -2171,6 +2175,7 @@ e4f6dccb8bce21b5214c1d8cfb440fc0ba4159d7 data/create/loot_tables/blocks/sequence
49f6b51c0618aa0c0133dc1f034ff6c031318cac data/create/loot_tables/blocks/shadow_steel_casing.json
b127cb6920e6d7d9c8b2402cb186402a9a8dd3fc data/create/loot_tables/blocks/shaft.json
70b6e82e9198d3910877e62c2eab86d46ca27089 data/create/loot_tables/blocks/speedometer.json
f6c497d625de67ea9377e840208b1be539d13b73 data/create/loot_tables/blocks/spout.json
a23a1e332c9ba84474e3c0588e8a0857afe346e0 data/create/loot_tables/blocks/spruce_window.json
3ee2350936ea82fef716bc58e4cd088a384616f0 data/create/loot_tables/blocks/spruce_window_pane.json
8d2970acd61b96844a4308d87e858b1612d5862e data/create/loot_tables/blocks/sticky_mechanical_piston.json
@ -2230,6 +2235,8 @@ da9a919b476954c1de34826aa7706bf6056a8f12 data/create/recipes/chiseled_scoria_fro
09faa4ddcf9f3907dcdb3ab3e8b68c1deb2486e5 data/create/recipes/chiseled_weathered_limestone_from_weathered_limestone_stonecutting.json
386c52f0aad6e2239f31dc85f7e745b47230846b data/create/recipes/copper_block.json
d19b3fa4bedacedf0c57aecba5a7e025e5a6b032 data/create/recipes/crafting_shaped/appliances/cake.json
498261742538cab184ce0f0fd3c28f16671e48d7 data/create/recipes/crafting_shaped/kinetics/basin.json
78c81581ccb61438ee51d2f91967b7eea28cb237 data/create/recipes/crafting_shaped/kinetics/schematic_table.json
5a7ee5951c15db03a4e38f5cbc1833f3d889e2b1 data/create/recipes/crafting_shaped/schematics/schematic_table.json
50cffa44fb016b856629538cb0be52c162139ec5 data/create/recipes/crafting_shaped/schematics/schematicannon.json
19526da3a59fc136654ff1bc93c0251581f397a9 data/create/recipes/crafting_shapeless/appliances/dough.json
@ -2592,6 +2599,7 @@ d3fdb8ece6cb072a93ddb64a0baad5ac952117a4 data/create/recipes/weathered_limestone
798ef82869dbe22682121504a372e95607a785dc data/create/tags/blocks/fan_transparent.json
081f5aa35602fc27af2ca01ea9f2fd5e7eb284dc data/create/tags/items/create_ingots.json
d2dc4ff179ef7b2aa9276455c196e15d44aa95a8 data/create/tags/items/crushed_ores.json
abbe5d7cc9d1705509257888154ed7ca23292586 data/create/tags/items/upright_on_belt.json
16bcb8fcbe9170c2c11f1ca8d99d8b36cd812bbd data/forge/tags/blocks/glass/colorless.json
81ced867d24ec814942909965dd4576eff1db685 data/forge/tags/blocks/glass_panes.json
4a0b13a9835106de9a1dd0a71a02372abb48e7b6 data/forge/tags/blocks/ores/copper.json

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "create:block/spout/block"
}
}
}

View file

@ -330,6 +330,7 @@
"block.create.shadow_steel_casing": "bu\u0131s\u0250\u0186 \u05DF\u01DD\u01DD\u0287S \u028Dop\u0250\u0265S",
"block.create.shaft": "\u0287\u025F\u0250\u0265S",
"block.create.speedometer": "\u0279\u01DD\u0287\u01DD\u026Fop\u01DD\u01DDdS",
"block.create.spout": "\u0287nodS",
"block.create.spruce_window": "\u028Dopu\u0131M \u01DD\u0254n\u0279dS",
"block.create.spruce_window_pane": "\u01DDu\u0250\u0500 \u028Dopu\u0131M \u01DD\u0254n\u0279dS",
"block.create.sticky_mechanical_piston": "uo\u0287s\u0131\u0500 \u05DF\u0250\u0254\u0131u\u0250\u0265\u0254\u01DDW \u028E\u029E\u0254\u0131\u0287S",

View file

@ -333,6 +333,7 @@
"block.create.shadow_steel_casing": "Shadow Steel Casing",
"block.create.shaft": "Shaft",
"block.create.speedometer": "Speedometer",
"block.create.spout": "Spout",
"block.create.spruce_window": "Spruce Window",
"block.create.spruce_window_pane": "Spruce Window Pane",
"block.create.sticky_mechanical_piston": "Sticky Mechanical Piston",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 816",
"_": "Missing Localizations: 817",
"_": "->------------------------] Game Elements [------------------------<-",
@ -334,6 +334,7 @@
"block.create.shadow_steel_casing": "UNLOCALIZED: Shadow Steel Casing",
"block.create.shaft": "Welle",
"block.create.speedometer": "UNLOCALIZED: Speedometer",
"block.create.spout": "UNLOCALIZED: Spout",
"block.create.spruce_window": "UNLOCALIZED: Spruce Window",
"block.create.spruce_window_pane": "UNLOCALIZED: Spruce Window Pane",
"block.create.sticky_mechanical_piston": "Klebriger Mechanischer Kolben",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 419",
"_": "Missing Localizations: 420",
"_": "->------------------------] Game Elements [------------------------<-",
@ -334,6 +334,7 @@
"block.create.shadow_steel_casing": "UNLOCALIZED: Shadow Steel Casing",
"block.create.shaft": "Arbre mécanique",
"block.create.speedometer": "Compteur de vitesse",
"block.create.spout": "UNLOCALIZED: Spout",
"block.create.spruce_window": "UNLOCALIZED: Spruce Window",
"block.create.spruce_window_pane": "UNLOCALIZED: Spruce Window Pane",
"block.create.sticky_mechanical_piston": "Piston mécanique collant",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 403",
"_": "Missing Localizations: 404",
"_": "->------------------------] Game Elements [------------------------<-",
@ -334,6 +334,7 @@
"block.create.shadow_steel_casing": "UNLOCALIZED: Shadow Steel Casing",
"block.create.shaft": "Albero",
"block.create.speedometer": "Tachimetro",
"block.create.spout": "UNLOCALIZED: Spout",
"block.create.spruce_window": "UNLOCALIZED: Spruce Window",
"block.create.spruce_window_pane": "UNLOCALIZED: Spruce Window Pane",
"block.create.sticky_mechanical_piston": "Pistome Meccanico Appiccicoso",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 398",
"_": "Missing Localizations: 399",
"_": "->------------------------] Game Elements [------------------------<-",
@ -334,6 +334,7 @@
"block.create.shadow_steel_casing": "UNLOCALIZED: Shadow Steel Casing",
"block.create.shaft": "軸",
"block.create.speedometer": "スピードメーター",
"block.create.spout": "UNLOCALIZED: Spout",
"block.create.spruce_window": "UNLOCALIZED: Spruce Window",
"block.create.spruce_window_pane": "UNLOCALIZED: Spruce Window Pane",
"block.create.sticky_mechanical_piston": "粘着メカニカルピストン",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 403",
"_": "Missing Localizations: 404",
"_": "->------------------------] Game Elements [------------------------<-",
@ -334,6 +334,7 @@
"block.create.shadow_steel_casing": "UNLOCALIZED: Shadow Steel Casing",
"block.create.shaft": "축",
"block.create.speedometer": "속도 계측기",
"block.create.spout": "UNLOCALIZED: Spout",
"block.create.spruce_window": "UNLOCALIZED: Spruce Window",
"block.create.spruce_window_pane": "UNLOCALIZED: Spruce Window Pane",
"block.create.sticky_mechanical_piston": "끈끈이 기계식 피스톤",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 753",
"_": "Missing Localizations: 754",
"_": "->------------------------] Game Elements [------------------------<-",
@ -334,6 +334,7 @@
"block.create.shadow_steel_casing": "UNLOCALIZED: Shadow Steel Casing",
"block.create.shaft": "Drijfas",
"block.create.speedometer": "Snelheidsmeter",
"block.create.spout": "UNLOCALIZED: Spout",
"block.create.spruce_window": "UNLOCALIZED: Spruce Window",
"block.create.spruce_window_pane": "UNLOCALIZED: Spruce Window Pane",
"block.create.sticky_mechanical_piston": "Mechanische Zuiger",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 823",
"_": "Missing Localizations: 824",
"_": "->------------------------] Game Elements [------------------------<-",
@ -334,6 +334,7 @@
"block.create.shadow_steel_casing": "UNLOCALIZED: Shadow Steel Casing",
"block.create.shaft": "Eixo",
"block.create.speedometer": "UNLOCALIZED: Speedometer",
"block.create.spout": "UNLOCALIZED: Spout",
"block.create.spruce_window": "UNLOCALIZED: Spruce Window",
"block.create.spruce_window_pane": "UNLOCALIZED: Spruce Window Pane",
"block.create.sticky_mechanical_piston": "Pistão Mecânico Grudento",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 817",
"_": "Missing Localizations: 818",
"_": "->------------------------] Game Elements [------------------------<-",
@ -334,6 +334,7 @@
"block.create.shadow_steel_casing": "UNLOCALIZED: Shadow Steel Casing",
"block.create.shaft": "Вал",
"block.create.speedometer": "UNLOCALIZED: Speedometer",
"block.create.spout": "UNLOCALIZED: Spout",
"block.create.spruce_window": "UNLOCALIZED: Spruce Window",
"block.create.spruce_window_pane": "UNLOCALIZED: Spruce Window Pane",
"block.create.sticky_mechanical_piston": "Липкий механический поршень",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 79",
"_": "Missing Localizations: 80",
"_": "->------------------------] Game Elements [------------------------<-",
@ -334,6 +334,7 @@
"block.create.shadow_steel_casing": "UNLOCALIZED: Shadow Steel Casing",
"block.create.shaft": "传动杆",
"block.create.speedometer": "速度表",
"block.create.spout": "UNLOCALIZED: Spout",
"block.create.spruce_window": "云杉窗户",
"block.create.spruce_window_pane": "云杉窗户板",
"block.create.sticky_mechanical_piston": "粘性动力活塞",

View file

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

View file

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"create:crafting_shaped/kinetics/basin"
]
},
"criteria": {
"has_item": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "create:andesite_alloy"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "create:crafting_shaped/kinetics/basin"
}
}
},
"requirements": [
[
"has_item",
"has_the_recipe"
]
]
}

View file

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"create:crafting_shaped/kinetics/schematic_table"
]
},
"criteria": {
"has_item": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "create:empty_schematic"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "create:crafting_shaped/kinetics/schematic_table"
}
}
},
"requirements": [
[
"has_item",
"has_the_recipe"
]
]
}

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "create:spout"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,15 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"# #",
"###"
],
"key": {
"#": {
"item": "create:andesite_alloy"
}
},
"result": {
"item": "create:basin"
}
}

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
" # ",
"+++",
" + "
],
"key": {
"#": {
"item": "create:andesite_alloy"
},
"+": {
"tag": "forge:plates/brass"
}
},
"result": {
"item": "create:schematic_table"
}
}

View file

@ -0,0 +1,9 @@
{
"replace": false,
"values": [
"minecraft:glass_bottle",
"minecraft:potion",
"minecraft:splash_potion",
"minecraft:lingering_potion"
]
}

View file

@ -79,6 +79,10 @@ public class AllBlockPartials {
MECHANICAL_PUMP_ARROW = get("mechanical_pump/arrow"), MECHANICAL_PUMP_COG = get("mechanical_pump/cog"),
FLUID_PIPE_CASING = get("fluid_pipe/casing"),
SPOUT_TOP = get("spout/top"),
SPOUT_MIDDLE = get("spout/middle"),
SPOUT_BOTTOM = get("spout/bottom"),
COUPLING_ATTACHMENT = getEntity("minecart_coupling/attachment"),
COUPLING_RING = getEntity("minecart_coupling/ring"),

View file

@ -61,6 +61,7 @@ import com.simibubi.create.content.contraptions.components.turntable.TurntableBl
import com.simibubi.create.content.contraptions.components.waterwheel.WaterWheelBlock;
import com.simibubi.create.content.contraptions.fluids.PipeAttachmentModel;
import com.simibubi.create.content.contraptions.fluids.PumpBlock;
import com.simibubi.create.content.contraptions.fluids.actors.SpoutBlock;
import com.simibubi.create.content.contraptions.fluids.pipes.EncasedPipeBlock;
import com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeBlock;
import com.simibubi.create.content.contraptions.fluids.pipes.GlassFluidPipeBlock;
@ -509,6 +510,14 @@ public class AllBlocks {
.build()
.register();
public static final BlockEntry<SpoutBlock> SPOUT = REGISTRATE.block("spout", SpoutBlock::new)
.initialProperties(SharedProperties::softMetal)
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov)))
.addLayer(() -> RenderType::getCutoutMipped)
.item()
.transform(customItemModel())
.register();
// Contraptions
public static final BlockEntry<MechanicalPistonBlock> MECHANICAL_PISTON =

View file

@ -136,6 +136,8 @@ public class AllShapes {
.build(),
PULLEY_MAGNET = shape(3, 0, 3, 13, 2, 13).add(FOUR_VOXEL_POLE.get(UP))
.build(),
SPOUT = shape(2, 2, 2, 14, 14, 14).add(4, 0, 4, 12, 2, 12)
.build(),
MILLSTONE = shape(0, 0, 0, 16, 6, 16).add(2, 6, 2, 14, 13, 14)
.add(3, 13, 3, 13, 16, 13)
.build(),

View file

@ -16,13 +16,13 @@ import net.minecraft.block.Blocks;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
import net.minecraft.tags.TagCollection;
import net.minecraft.util.ResourceLocation;
public class AllTags {
private static final CreateRegistrate REGISTRATE = Create.registrate()
.itemGroup(() -> Create.baseCreativeTab);
@ -63,7 +63,14 @@ public class AllTags {
}
public static enum AllItemTags {
CRUSHED_ORES(MOD), CREATE_INGOTS(MOD), BEACON_PAYMENT(FORGE), INGOTS(FORGE), NUGGETS(FORGE), PLATES(FORGE), COBBLESTONE(FORGE)
CRUSHED_ORES(MOD),
UPRIGHT_ON_BELT(MOD),
CREATE_INGOTS(MOD),
BEACON_PAYMENT(FORGE),
INGOTS(FORGE),
NUGGETS(FORGE),
PLATES(FORGE),
COBBLESTONE(FORGE)
;
@ -82,6 +89,11 @@ public class AllTags {
return tag.contains(stack.getItem());
}
public void add(Item... values) {
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.getBuilder(tag)
.add(values));
}
public void includeIn(AllItemTags parent) {
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.getBuilder(parent.tag)
.add(tag));
@ -98,11 +110,11 @@ public class AllTags {
private AllBlockTags() {
this(MOD, "");
}
private AllBlockTags(NameSpace namespace) {
this(namespace, "");
}
private AllBlockTags(NameSpace namespace, String path) {
tag = new BlockTags.Wrapper(
new ResourceLocation(namespace.id, (path.isEmpty() ? "" : path + "/") + Lang.asId(name())));
@ -111,31 +123,35 @@ public class AllTags {
public boolean matches(BlockState block) {
return tag.contains(block.getBlock());
}
public void includeIn(AllBlockTags parent) {
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getBuilder(parent.tag)
.add(tag));
}
public void includeAll(Tag<Block> child) {
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getBuilder(tag).add(child));
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getBuilder(tag)
.add(child));
}
public void add(Block ...values) {
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getBuilder(tag).add(values));
public void add(Block... values) {
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getBuilder(tag)
.add(values));
}
}
public static void register() {
AllItemTags.CREATE_INGOTS.includeIn(AllItemTags.BEACON_PAYMENT);
AllItemTags.CREATE_INGOTS.includeIn(AllItemTags.INGOTS);
AllItemTags.UPRIGHT_ON_BELT.add(Items.GLASS_BOTTLE, Items.POTION, Items.SPLASH_POTION, Items.LINGERING_POTION);
AllBlockTags.BRITTLE.includeAll(BlockTags.DOORS);
AllBlockTags.BRITTLE.add(Blocks.FLOWER_POT, Blocks.BELL);
AllBlockTags.FAN_TRANSPARENT.includeAll(BlockTags.FENCES);
AllBlockTags.FAN_TRANSPARENT.add(Blocks.IRON_BARS);
AllBlockTags.FAN_HEATERS.add(Blocks.MAGMA_BLOCK, Blocks.CAMPFIRE, Blocks.LAVA, Blocks.FIRE);
}
}

View file

@ -45,6 +45,8 @@ import com.simibubi.create.content.contraptions.components.turntable.TurntableTi
import com.simibubi.create.content.contraptions.components.waterwheel.WaterWheelTileEntity;
import com.simibubi.create.content.contraptions.fluids.PumpRenderer;
import com.simibubi.create.content.contraptions.fluids.PumpTileEntity;
import com.simibubi.create.content.contraptions.fluids.actors.SpoutRenderer;
import com.simibubi.create.content.contraptions.fluids.actors.SpoutTileEntity;
import com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeTileEntity;
import com.simibubi.create.content.contraptions.fluids.pipes.StraightPipeTileEntity;
import com.simibubi.create.content.contraptions.fluids.pipes.TransparentStraightPipeRenderer;
@ -225,6 +227,12 @@ public class AllTileEntities {
.validBlocks(AllBlocks.FLUID_TANK)
.renderer(() -> FluidTankRenderer::new)
.register();
public static final TileEntityEntry<SpoutTileEntity> SPOUT = Create.registrate()
.tileEntity("spout", SpoutTileEntity::new)
.validBlocks(AllBlocks.SPOUT)
.renderer(() -> SpoutRenderer::new)
.register();
public static final TileEntityEntry<BeltTileEntity> BELT = Create.registrate()
.tileEntity("belt", (NonNullFunction<TileEntityType<BeltTileEntity>, ? extends BeltTileEntity>) BeltTileEntity::new)

View file

@ -156,9 +156,12 @@ public class FluidPropagator {
static AxisAlignedBB smallCenter = new AxisAlignedBB(BlockPos.ZERO).shrink(.25);
public static boolean hasFluidCapability(BlockState state, IBlockReader world, BlockPos pos, Direction blockFace) {
return state.hasTileEntity() && world.getTileEntity(pos)
.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, blockFace.getOpposite())
.isPresent();
if (!state.hasTileEntity())
return false;
TileEntity tileEntity = world.getTileEntity(pos);
return tileEntity != null
&& tileEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, blockFace.getOpposite())
.isPresent();
}
public static boolean isStraightPipe(BlockState state) {

View file

@ -0,0 +1,76 @@
package com.simibubi.create.content.contraptions.fluids.actors;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.potion.PotionUtils;
import net.minecraft.potion.Potions;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
import net.minecraftforge.fluids.capability.wrappers.FluidBucketWrapper;
public class FillingBySpout {
public static boolean canItemBeFilled(ItemStack stack) {
// FIXME: Spout recipe type
if (stack.getItem() == Items.GLASS_BOTTLE)
return true;
LazyOptional<IFluidHandlerItem> capability =
stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY);
IFluidHandlerItem tank = capability.orElse(null);
if (tank == null)
return false;
for (int i = 0; i < tank.getTanks(); i++) {
if (tank.getFluidInTank(i)
.getAmount() < tank.getTankCapacity(i))
return true;
}
return false;
}
public static int getRequiredAmountForItem(ItemStack stack, FluidStack availableFluid) {
// FIXME: Spout recipe type
if (stack.getItem() == Items.GLASS_BOTTLE && availableFluid.getFluid() == Fluids.WATER)
return 250;
LazyOptional<IFluidHandlerItem> capability =
stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY);
IFluidHandlerItem tank = capability.orElse(null);
if (tank == null)
return -1;
if (tank instanceof FluidBucketWrapper)
return 1000;
int filled = tank.fill(availableFluid, FluidAction.SIMULATE);
return filled == 0 ? -1 : filled;
}
public static ItemStack fillItem(int requiredAmount, ItemStack stack, FluidStack availableFluid) {
FluidStack toFill = availableFluid.copy();
toFill.setAmount(requiredAmount);
availableFluid.shrink(requiredAmount);
// FIXME: Spout recipe type
if (stack.getItem() == Items.GLASS_BOTTLE && availableFluid.getFluid() == Fluids.WATER) {
stack.shrink(1);
return PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.WATER);
}
ItemStack split = stack.copy();
split.setCount(1);
LazyOptional<IFluidHandlerItem> capability =
split.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY);
IFluidHandlerItem tank = capability.orElse(null);
if (tank == null)
return ItemStack.EMPTY;
tank.fill(toFill, FluidAction.EXECUTE);
ItemStack container = tank.getContainer().copy();
stack.shrink(1);
return container;
}
}

View file

@ -0,0 +1,36 @@
package com.simibubi.create.content.contraptions.fluids.actors;
import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
public class SpoutBlock extends Block {
public SpoutBlock(Properties p_i48440_1_) {
super(p_i48440_1_);
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
}
@Override
public VoxelShape getShape(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_,
ISelectionContext p_220053_4_) {
return AllShapes.SPOUT;
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return AllTileEntities.SPOUT.create();
}
}

View file

@ -0,0 +1,68 @@
package com.simibubi.create.content.contraptions.fluids.actors;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.fluid.FluidRenderer;
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
import com.simibubi.create.foundation.utility.LerpedFloat;
import com.simibubi.create.foundation.utility.Pair;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.fluids.FluidStack;
public class SpoutRenderer extends SafeTileEntityRenderer<SpoutTileEntity> {
public SpoutRenderer(TileEntityRendererDispatcher dispatcher) {
super(dispatcher);
}
static final AllBlockPartials[] BITS =
{ AllBlockPartials.SPOUT_TOP, AllBlockPartials.SPOUT_MIDDLE, AllBlockPartials.SPOUT_BOTTOM };
@Override
protected void renderSafe(SpoutTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) {
Pair<FluidStack, LerpedFloat> fluid = te.getFluid();
FluidStack fluidStack = fluid.getFirst();
float level = fluid.getSecond()
.getValue(partialTicks);
if (!fluidStack.isEmpty() && level != 0) {
float min = 2.5f / 16f;
float max = min + (11 / 16f);
float yOffset = (11 / 16f) * level;
ms.push();
ms.translate(0, yOffset, 0);
FluidRenderer.renderTiledFluidBB(fluidStack, min, min - yOffset, min, max, min, max, buffer, ms, light,
false);
ms.pop();
}
float radius = 0;
if (te.processingTicks != -1) {
float processingProgress = 1 - ((float) te.processingTicks - 5) / 10;
processingProgress = MathHelper.clamp(processingProgress, 0, 1);
radius = (float) (Math.pow(((2 * processingProgress) - 1), 2) - 1) / 32f;
AxisAlignedBB bb = new AxisAlignedBB(0.5, .5, 0.5, 0.5, -1.2, 0.5).grow(radius);
FluidRenderer.renderTiledFluidBB(fluidStack, (float) bb.minX, (float) bb.minY, (float) bb.minZ,
(float) bb.maxX, (float) bb.maxY, (float) bb.maxZ, buffer, ms, light, true);
}
ms.push();
for (AllBlockPartials bit : BITS) {
bit.renderOn(te.getBlockState())
.light(light)
.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
ms.translate(0, -2 * radius, 0);
}
ms.pop();
}
}

View file

@ -0,0 +1,254 @@
package com.simibubi.create.content.contraptions.fluids.actors;
import static com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult.HOLD;
import static com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult.PASS;
import java.util.ArrayList;
import java.util.List;
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
import com.simibubi.create.foundation.fluid.SmartFluidTank;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult;
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour;
import com.simibubi.create.foundation.utility.LerpedFloat;
import com.simibubi.create.foundation.utility.LerpedFloat.Chaser;
import com.simibubi.create.foundation.utility.Pair;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.particles.BlockParticleData;
import net.minecraft.particles.IParticleData;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.templates.FluidTank;
// FIXME: Quite similar to FluidTankTileEntity, create a behaviour
public class SpoutTileEntity extends SmartTileEntity {
protected FluidTank tank;
protected LazyOptional<IFluidHandler> capability;
protected LerpedFloat fluidLevel;
protected FluidStack renderedFluid;
public static final int FILLING_TIME = 20;
protected int processingTicks;
private static final int SYNC_RATE = 8;
protected int syncCooldown;
protected boolean queuedSync;
protected boolean sendSplash;
protected BeltProcessingBehaviour beltProcessing;
public SpoutTileEntity(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
tank = new SmartFluidTank(1000, this::onFluidStackChanged);
capability = LazyOptional.of(() -> tank);
fluidLevel = LerpedFloat.linear()
.startWithValue(0)
.chase(0, .25, Chaser.EXP);
renderedFluid = FluidStack.EMPTY;
processingTicks = -1;
}
protected void onFluidStackChanged(FluidStack newFluidStack) {
if (!hasWorld())
return;
fluidLevel.chase(tank.getFluidAmount() / (float) tank.getCapacity(), .25, Chaser.EXP);
if (!world.isRemote) {
markDirty();
sendData();
}
}
@Override
public void initialize() {
super.initialize();
if (!world.isRemote) {
fluidLevel.forceNextSync();
onFluidStackChanged(tank.getFluid());
}
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return super.getRenderBoundingBox().expand(0, -2, 0);
}
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
beltProcessing = new BeltProcessingBehaviour(this).whenItemEnters(this::onItemReceived)
.whileItemHeld(this::whenItemHeld);
behaviours.add(beltProcessing);
}
protected ProcessingResult onItemReceived(TransportedItemStack transported,
TransportedItemStackHandlerBehaviour handler) {
if (!FillingBySpout.canItemBeFilled(transported.stack))
return PASS;
if (tank.isEmpty())
return HOLD;
if (FillingBySpout.getRequiredAmountForItem(transported.stack, tank.getFluid()) == -1)
return PASS;
return HOLD;
}
protected ProcessingResult whenItemHeld(TransportedItemStack transported,
TransportedItemStackHandlerBehaviour handler) {
if (processingTicks > 0)
return HOLD;
if (!FillingBySpout.canItemBeFilled(transported.stack))
return PASS;
if (tank.isEmpty())
return HOLD;
FluidStack fluid = tank.getFluid();
int requiredAmountForItem = FillingBySpout.getRequiredAmountForItem(transported.stack, fluid.copy());
if (requiredAmountForItem == -1)
return PASS;
if (requiredAmountForItem > fluid.getAmount())
return HOLD;
if (processingTicks == -1) {
processingTicks = FILLING_TIME;
markDirty();
sendData();
return HOLD;
}
// Process finished
processingTicks = -1;
ItemStack out = FillingBySpout.fillItem(requiredAmountForItem, transported.stack, fluid);
if (!out.isEmpty()) {
List<TransportedItemStack> outList = new ArrayList<>();
TransportedItemStack similar = transported.copy();
similar.stack = out;
// FIXME: original stack keeps waiting
if (!transported.stack.isEmpty())
outList.add(transported.copy());
outList.add(similar);
handler.handleProcessingOnItem(transported, outList);
}
tank.setFluid(fluid);
sendSplash = true;
markDirty();
sendData();
return PASS;
}
@Override
public void remove() {
capability.invalidate();
super.remove();
}
@Override
protected void write(CompoundNBT compound, boolean clientPacket) {
super.write(compound, clientPacket);
compound.put("TankContent", tank.writeToNBT(new CompoundNBT()));
compound.put("Level", fluidLevel.writeNBT());
compound.putInt("ProcessingTicks", processingTicks);
if (sendSplash && clientPacket) {
compound.putBoolean("Splash", true);
sendSplash = false;
}
}
@Override
protected void read(CompoundNBT compound, boolean clientPacket) {
super.read(compound, clientPacket);
tank.readFromNBT(compound.getCompound("TankContent"));
fluidLevel.readNBT(compound.getCompound("Level"), clientPacket);
processingTicks = compound.getInt("ProcessingTicks");
if (!clientPacket)
return;
if (compound.contains("Splash"))
spawnSplash(renderedFluid);
if (!tank.getFluid()
.isEmpty())
renderedFluid = tank.getFluid();
}
@Override
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY && side != Direction.DOWN)
return capability.cast();
return super.getCapability(cap, side);
}
public Pair<FluidStack, LerpedFloat> getFluid() {
return Pair.of(renderedFluid, fluidLevel);
}
public void sendDataImmediately() {
syncCooldown = 0;
queuedSync = false;
sendData();
}
@Override
public void tick() {
super.tick();
if (processingTicks > 0)
processingTicks--;
if (processingTicks >= 0 && world.isRemote)
spawnProcessingParticles(renderedFluid);
if (syncCooldown > 0) {
syncCooldown--;
if (syncCooldown == 0 && queuedSync)
sendData();
}
if (fluidLevel != null)
fluidLevel.tickChaser();
}
@Override
public void sendData() {
if (syncCooldown > 0) {
queuedSync = true;
return;
}
super.sendData();
queuedSync = false;
syncCooldown = SYNC_RATE;
}
protected void spawnProcessingParticles(FluidStack fluid) {
Vec3d vec = VecHelper.getCenterOf(pos);
vec = vec.subtract(0, 8 / 16f, 0);
IParticleData particle = new BlockParticleData(ParticleTypes.BLOCK, fluid.getFluid()
.getDefaultState()
.getBlockState());
world.addOptionalParticle(particle, vec.x, vec.y, vec.z, 0, -.5f, 0);
}
protected static int SPLASH_PARTICLE_COUNT = 20;
protected void spawnSplash(FluidStack fluid) {
Vec3d vec = VecHelper.getCenterOf(pos);
vec = vec.subtract(0, 2 - 5 / 16f, 0);
IParticleData particle = new BlockParticleData(ParticleTypes.BLOCK, fluid.getFluid()
.getDefaultState()
.getBlockState());
for (int i = 0; i < SPLASH_PARTICLE_COUNT; i++) {
Vec3d m = VecHelper.offsetRandomly(Vec3d.ZERO, world.rand, 0.25f);
m = new Vec3d(m.x, Math.abs(m.y), m.z);
world.addOptionalParticle(particle, vec.x, vec.y, vec.z, m.x, m.y, m.z);
}
}
}

View file

@ -37,7 +37,7 @@ public class FluidTankRenderer extends SafeTileEntityRenderer<FluidTankTileEntit
float level = fluidLevel.get(partialTicks);
if (level < 1 / (512f * totalHeight))
return;
float clamp = MathHelper.clamp(level * totalHeight, 0, totalHeight);
float clampedLevel = MathHelper.clamp(level * totalHeight, 0, totalHeight);
FluidTank tank = te.tankInventory;
FluidStack fluidStack = tank.getFluid();
@ -48,19 +48,19 @@ public class FluidTankRenderer extends SafeTileEntityRenderer<FluidTankTileEntit
float xMin = tankHullWidth;
float xMax = xMin + te.width - 2 * tankHullWidth;
float yMin = totalHeight + capHeight + minPuddleHeight - clamp;
float yMax = yMin + clamp;
float yMin = totalHeight + capHeight + minPuddleHeight - clampedLevel;
float yMax = yMin + clampedLevel;
if (top) {
yMin += totalHeight - clamp;
yMax += totalHeight - clamp;
yMin += totalHeight - clampedLevel;
yMax += totalHeight - clampedLevel;
}
float zMin = tankHullWidth;
float zMax = zMin + te.width - 2 * tankHullWidth;
ms.push();
ms.translate(0, clamp - totalHeight, 0);
ms.translate(0, clampedLevel - totalHeight, 0);
FluidRenderer.renderTiledFluidBB(fluidStack, xMin, yMin, zMin, xMax, yMax, zMax, buffer, ms, light, false);
ms.pop();
}

View file

@ -1,16 +1,26 @@
package com.simibubi.create.content.contraptions.relays.belt;
import com.simibubi.create.AllTags.AllItemTags;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.IWorld;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
public class BeltHelper {
public static boolean isItemUpright(ItemStack stack) {
return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)
.isPresent()
|| stack.getItem()
.isIn(AllItemTags.UPRIGHT_ON_BELT.tag);
}
public static BeltTileEntity getSegmentTE(IWorld world, BlockPos pos) {
if (!world.isAreaLoaded(pos, 0))
return null;
@ -32,7 +42,8 @@ public class BeltHelper {
public static BeltTileEntity getBeltAtSegment(BeltTileEntity controller, int segment) {
BlockPos pos = getPositionForOffset(controller, segment);
TileEntity te = controller.getWorld().getTileEntity(pos);
TileEntity te = controller.getWorld()
.getTileEntity(pos);
if (te == null || !(te instanceof BeltTileEntity))
return null;
return (BeltTileEntity) te;
@ -40,29 +51,34 @@ public class BeltHelper {
public static BlockPos getPositionForOffset(BeltTileEntity controller, int offset) {
BlockPos pos = controller.getPos();
Vec3i vec = controller.getBeltFacing().getDirectionVec();
BeltSlope slope = controller.getBlockState().get(BeltBlock.SLOPE);
Vec3i vec = controller.getBeltFacing()
.getDirectionVec();
BeltSlope slope = controller.getBlockState()
.get(BeltBlock.SLOPE);
int verticality = slope == BeltSlope.DOWNWARD ? -1 : slope == BeltSlope.UPWARD ? 1 : 0;
return pos.add(offset * vec.getX(), MathHelper.clamp(offset, 0, controller.beltLength - 1) * verticality,
offset * vec.getZ());
offset * vec.getZ());
}
public static Vec3d getVectorForOffset(BeltTileEntity controller, float offset) {
BeltSlope slope = controller.getBlockState().get(BeltBlock.SLOPE);
BeltSlope slope = controller.getBlockState()
.get(BeltBlock.SLOPE);
int verticality = slope == BeltSlope.DOWNWARD ? -1 : slope == BeltSlope.UPWARD ? 1 : 0;
float verticalMovement = verticality;
if (offset < .5)
verticalMovement = 0;
verticalMovement = verticalMovement * (Math.min(offset, controller.beltLength - .5f) - .5f);
Vec3d vec = VecHelper.getCenterOf(controller.getPos());
Vec3d horizontalMovement = new Vec3d(controller.getBeltFacing().getDirectionVec()).scale(offset - .5f);
Vec3d horizontalMovement = new Vec3d(controller.getBeltFacing()
.getDirectionVec()).scale(offset - .5f);
if (slope == BeltSlope.VERTICAL)
horizontalMovement = Vec3d.ZERO;
vec = vec.add(horizontalMovement).add(0, verticalMovement, 0);
vec = vec.add(horizontalMovement)
.add(0, verticalMovement, 0);
return vec;
}

View file

@ -27,6 +27,7 @@ import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.entity.Entity;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Direction.AxisDirection;
@ -52,7 +53,7 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
BeltPart part = blockState.get(BeltBlock.PART);
Direction facing = blockState.get(BeltBlock.HORIZONTAL_FACING);
AxisDirection axisDirection = facing.getAxisDirection();
boolean downward = beltSlope == BeltSlope.DOWNWARD;
boolean upward = beltSlope == BeltSlope.UPWARD;
boolean diagonal = downward || upward;
@ -202,26 +203,41 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
ItemRenderer itemRenderer = Minecraft.getInstance()
.getItemRenderer();
boolean renderUpright = BeltHelper.isItemUpright(transported.stack);
boolean blockItem = itemRenderer.getItemModelWithOverrides(transported.stack, te.getWorld(), null)
.isGui3d();
int count = (int) (MathHelper.log2((int) (transported.stack.getCount()))) / 2;
Random r = new Random(transported.angle);
if (Minecraft.getInstance().gameSettings.fancyGraphics) {
Vec3d shadowPos = new Vec3d(te.getPos()).add(beltStartOffset.scale(1)
.add(offsetVec)
.add(alongX ? sideOffset : 0, .39, alongX ? 0 : sideOffset));
ShadowRenderHelper.renderShadow(ms, buffer, shadowPos, .75f, blockItem ? .2f : .2f);
}
int count = (int) (MathHelper.log2((int) (transported.stack.getCount()))) / 2;
ms.multiply(new Vector3f(slopeAlongX ? 0 : 1, 0, slopeAlongX ? 1 : 0).getDegreesQuaternion(slopeAngle));
if (renderUpright) {
Entity renderViewEntity = Minecraft.getInstance().renderViewEntity;
if (renderViewEntity != null) {
Vec3d positionVec = renderViewEntity.getPositionVec();
Vec3d vectorForOffset = BeltHelper.getVectorForOffset(te, offset);
Vec3d diff = vectorForOffset.subtract(positionVec);
float yRot = (float) MathHelper.atan2(diff.z, -diff.x);
ms.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion((float) (yRot + Math.PI / 2)));
}
ms.translate(0, 3/32d, 1/16f);
}
if (!renderUpright)
ms.multiply(new Vector3f(slopeAlongX ? 0 : 1, 0, slopeAlongX ? 1 : 0).getDegreesQuaternion(slopeAngle));
if (onSlope)
ms.translate(0, 1 / 8f, 0);
Random r = new Random(transported.angle);
for (int i = 0; i <= count; i++) {
ms.push();
ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(transported.angle));
if (!blockItem) {
if (!blockItem && !renderUpright) {
ms.translate(0, -.09375, 0);
ms.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(90));
}

View file

@ -417,7 +417,7 @@ public class BeltInventory {
iterator.remove();
}
}
toBeAdded.forEach(this::insert);
toBeAdded.forEach(toInsert::add);
if (dirty) {
belt.markDirty();
belt.sendData();

View file

@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.relays.belt.transport;
import java.util.Random;
import com.simibubi.create.content.contraptions.relays.belt.BeltHelper;
import com.simibubi.create.content.logistics.InWorldProcessing;
import net.minecraft.item.ItemStack;
@ -9,9 +10,9 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
public class TransportedItemStack implements Comparable<TransportedItemStack> {
private static Random R = new Random();
public ItemStack stack;
public float beltPosition;
public float sideOffset;
@ -28,7 +29,8 @@ public class TransportedItemStack implements Comparable<TransportedItemStack> {
public TransportedItemStack(ItemStack stack) {
this.stack = stack;
angle = R.nextInt(360);
boolean centered = BeltHelper.isItemUpright(stack);
angle = centered ? 180 : R.nextInt(360);
sideOffset = prevSideOffset = getTargetSideOffset();
insertedFrom = Direction.UP;
}
@ -41,7 +43,7 @@ public class TransportedItemStack implements Comparable<TransportedItemStack> {
public int compareTo(TransportedItemStack o) {
return beltPosition < o.beltPosition ? 1 : beltPosition > o.beltPosition ? -1 : 0;
}
public TransportedItemStack getSimilar() {
TransportedItemStack copy = new TransportedItemStack(stack.copy());
copy.beltPosition = beltPosition;
@ -53,7 +55,7 @@ public class TransportedItemStack implements Comparable<TransportedItemStack> {
copy.processingTime = processingTime;
return copy;
}
public TransportedItemStack copy() {
TransportedItemStack copy = getSimilar();
copy.angle = angle;

View file

@ -3,15 +3,19 @@ package com.simibubi.create.content.logistics.block.depot;
import java.util.Random;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.content.contraptions.relays.belt.BeltHelper;
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
import com.simibubi.create.foundation.utility.MatrixStacker;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.MathHelper;
@ -29,6 +33,7 @@ public class DepotRenderer extends SafeTileEntityRenderer<DepotTileEntity> {
TransportedItemStack transported = te.heldItem;
MatrixStacker msr = MatrixStacker.of(ms);
Vec3d itemPosition = VecHelper.getCenterOf(te.getPos());
ms.push();
ms.translate(.5f, 15 / 16f, .5f);
@ -55,7 +60,7 @@ public class DepotRenderer extends SafeTileEntityRenderer<DepotTileEntity> {
ItemStack itemStack = transported.stack;
int angle = transported.angle;
Random r = new Random(0);
renderItem(ms, buffer, light, overlay, itemStack, angle, r);
renderItem(ms, buffer, light, overlay, itemStack, angle, r, itemPosition);
ms.pop();
}
@ -66,11 +71,15 @@ public class DepotRenderer extends SafeTileEntityRenderer<DepotTileEntity> {
continue;
ms.push();
msr.nudge(i);
boolean renderUpright = BeltHelper.isItemUpright(stack);
msr.rotateY(360 / 8f * i);
ms.translate(.35f, 0, 0);
if (renderUpright)
msr.rotateY(-(360 / 8f * i));
Random r = new Random(i + 1);
int angle = (int) (360 * r.nextFloat());
renderItem(ms, buffer, light, overlay, stack, angle, r);
renderItem(ms, buffer, light, overlay, stack, renderUpright ? angle + 90 : angle, r, itemPosition);
ms.pop();
}
@ -78,20 +87,32 @@ public class DepotRenderer extends SafeTileEntityRenderer<DepotTileEntity> {
}
protected void renderItem(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay, ItemStack itemStack,
int angle, Random r) {
int angle, Random r, Vec3d itemPosition) {
ItemRenderer itemRenderer = Minecraft.getInstance()
.getItemRenderer();
MatrixStacker msr = MatrixStacker.of(ms);
int count = (int) (MathHelper.log2((int) (itemStack.getCount()))) / 2;
boolean renderUpright = BeltHelper.isItemUpright(itemStack);
boolean blockItem = itemRenderer.getItemModelWithOverrides(itemStack, null, null)
.isGui3d();
for (int i = 0; i <= count; i++) {
ms.push();
msr.rotateY(angle);
if (!blockItem) {
if (!blockItem && !renderUpright) {
ms.translate(0, -.09375, 0);
msr.rotateX(90);
}
if (renderUpright) {
Entity renderViewEntity = Minecraft.getInstance().renderViewEntity;
if (renderViewEntity != null) {
Vec3d positionVec = renderViewEntity.getPositionVec();
Vec3d vectorForOffset = itemPosition;
Vec3d diff = vectorForOffset.subtract(positionVec);
float yRot = (float) MathHelper.atan2(diff.z, -diff.x);
ms.multiply(Vector3f.POSITIVE_Y.getRadialQuaternion((float) (yRot + Math.PI / 2)));
}
ms.translate(0, 3 / 32d, 0);
}
if (blockItem)
ms.translate(r.nextFloat() * .0625f * i, 0, r.nextFloat() * .0625f * i);
ms.scale(.5f, .5f, .5f);

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import com.simibubi.create.content.contraptions.relays.belt.BeltHelper;
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
@ -52,7 +53,7 @@ public class DepotTileEntity extends SmartTileEntity {
heldItem.prevSideOffset = heldItem.sideOffset;
float diff = .5f - heldItem.beltPosition;
if (diff > 1 / 512f) {
if (diff > 1 / 32f)
if (diff > 1 / 32f && !BeltHelper.isItemUpright(heldItem.stack))
heldItem.angle += 1;
heldItem.beltPosition += diff / 4f;
}

View file

@ -8,6 +8,7 @@ import java.util.function.UnaryOperator;
import com.google.common.base.Supplier;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllTags;
import com.simibubi.create.Create;
import com.simibubi.create.content.AllSections;
import com.simibubi.create.foundation.utility.Lang;
@ -64,7 +65,20 @@ public class StandardRecipes extends RecipeProvider {
// TODO
private Marker KINETICS = enterSection(AllSections.KINETICS);
GeneratedRecipe BASIN = create(AllBlocks.BASIN).unlockedBy(AllItems.ANDESITE_ALLOY::get)
.viaShaped(b -> b.key('#', AllItems.ANDESITE_ALLOY.get())
.patternLine("# #")
.patternLine("###")),
BRASS_HAND = create(AllBlocks.SCHEMATIC_TABLE).unlockedBy(AllItems.EMPTY_SCHEMATIC::get)
.viaShaped(b -> b.key('#', AllItems.ANDESITE_ALLOY.get())
.key('+', AllTags.forgeItemTag("plates/brass"))
.patternLine(" # ")
.patternLine("+++")
.patternLine(" + "))
// TODO
;
private Marker LOGISTICS = enterSection(AllSections.LOGISTICS);
// TODO

View file

@ -31,6 +31,14 @@ public class TransportedItemStackHandlerBehaviour extends TileEntityBehaviour {
public void handleProcessingOnAllItems(Function<TransportedItemStack, List<TransportedItemStack>> processFunction) {
handleCenteredProcessingOnAllItems(.51f, processFunction);
}
public void handleProcessingOnItem(TransportedItemStack item, List<TransportedItemStack> processOutput) {
handleCenteredProcessingOnAllItems(.51f, t -> {
if (t == item)
return processOutput;
return null;
});
}
public void handleCenteredProcessingOnAllItems(float maxDistanceFromCenter,
Function<TransportedItemStack, List<TransportedItemStack>> processFunction) {

View file

@ -0,0 +1,77 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/spout",
"particle": "create:block/spout"
},
"elements": [
{
"name": "north",
"from": [2, 2, 2],
"to": [14, 14, 2],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 10, 10]},
"faces": {
"north": {"uv": [0, 0, 6, 6], "texture": "#0"},
"south": {"uv": [0, 0, 6, 6], "texture": "#0"}
}
},
{
"name": "east",
"from": [14, 2, 2],
"to": [14, 14, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [22, 10, 10]},
"faces": {
"east": {"uv": [0, 0, 6, 6], "texture": "#0"},
"west": {"uv": [0, 0, 6, 6], "texture": "#0"}
}
},
{
"name": "south",
"from": [2, 2, 14],
"to": [14, 14, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 10, 10]},
"faces": {
"north": {"uv": [0, 0, 6, 6], "texture": "#0"},
"south": {"uv": [0, 0, 6, 6], "texture": "#0"}
}
},
{
"name": "west",
"from": [2, 2, 2],
"to": [2, 14, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 10, 10]},
"faces": {
"east": {"uv": [0, 0, 6, 6], "texture": "#0"},
"west": {"uv": [0, 0, 6, 6], "texture": "#0"}
}
},
{
"name": "up",
"from": [2, 14, 2],
"to": [14, 14, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 10, 10]},
"faces": {
"up": {"uv": [6, 0, 12, 6], "texture": "#0"},
"down": {"uv": [6, 0, 12, 6], "texture": "#0"}
}
},
{
"name": "down",
"from": [2, 2, 2],
"to": [14, 2, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 10, 10]},
"faces": {
"down": {"uv": [6, 0, 12, 6], "texture": "#0"}
}
},
{
"name": "drain",
"from": [2, 4, 2],
"to": [14, 4, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 12, 10]},
"faces": {
"up": {"uv": [6, 6, 12, 12], "texture": "#0"}
}
}
]
}

View file

@ -0,0 +1,22 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/spout",
"particle": "create:block/spout"
},
"elements": [
{
"name": "nozzledown",
"from": [6, -5, 6],
"to": [10, -2, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [16, 1, 14]},
"faces": {
"north": {"uv": [0, 7.5, 2, 9], "texture": "#0"},
"east": {"uv": [0, 7.5, 2, 9], "texture": "#0"},
"south": {"uv": [0, 7.5, 2, 9], "texture": "#0"},
"west": {"uv": [0, 7.5, 2, 9], "texture": "#0"},
"down": {"uv": [2, 7, 4, 9], "texture": "#0"}
}
}
]
}

View file

@ -0,0 +1,150 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/spout",
"particle": "create:block/spout"
},
"elements": [
{
"name": "north",
"from": [2, 2, 2],
"to": [14, 14, 2],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 10, 10]},
"faces": {
"north": {"uv": [0, 0, 6, 6], "texture": "#0"},
"south": {"uv": [0, 0, 6, 6], "texture": "#0"}
}
},
{
"name": "east",
"from": [14, 2, 2],
"to": [14, 14, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [22, 10, 10]},
"faces": {
"east": {"uv": [0, 0, 6, 6], "texture": "#0"},
"west": {"uv": [0, 0, 6, 6], "texture": "#0"}
}
},
{
"name": "south",
"from": [2, 2, 14],
"to": [14, 14, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 10, 10]},
"faces": {
"north": {"uv": [0, 0, 6, 6], "texture": "#0"},
"south": {"uv": [0, 0, 6, 6], "texture": "#0"}
}
},
{
"name": "west",
"from": [2, 2, 2],
"to": [2, 14, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 10, 10]},
"faces": {
"east": {"uv": [0, 0, 6, 6], "texture": "#0"},
"west": {"uv": [0, 0, 6, 6], "texture": "#0"}
}
},
{
"name": "up",
"from": [2, 14, 2],
"to": [14, 14, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 10, 10]},
"faces": {
"up": {"uv": [6, 0, 12, 6], "texture": "#0"},
"down": {"uv": [6, 0, 12, 6], "texture": "#0"}
}
},
{
"name": "down",
"from": [2, 2, 2],
"to": [14, 2, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 10, 10]},
"faces": {
"down": {"uv": [6, 0, 12, 6], "texture": "#0"}
}
},
{
"name": "drain",
"from": [2, 4, 2],
"to": [14, 4, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 12, 10]},
"faces": {
"up": {"uv": [6, 6, 12, 12], "texture": "#0"}
}
},
{
"name": "Top",
"from": [4, 0, 4],
"to": [12, 2, 12],
"rotation": {"angle": 0, "axis": "y", "origin": [12, 9, 12]},
"faces": {
"north": {"uv": [0, 15, 4, 16], "texture": "#0"},
"east": {"uv": [0, 15, 4, 16], "texture": "#0"},
"south": {"uv": [0, 15, 4, 16], "texture": "#0"},
"west": {"uv": [0, 15, 4, 16], "texture": "#0"},
"up": {"uv": [0, 15, 4, 16], "texture": "#0"},
"down": {"uv": [4, 12, 8, 16], "texture": "#0"}
}
},
{
"name": "nozzleup",
"from": [5, -2, 5],
"to": [11, 0, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [16, 7, 14]},
"faces": {
"north": {"uv": [0, 9.5, 3, 10.5], "texture": "#0"},
"east": {"uv": [0, 9.5, 3, 10.5], "texture": "#0"},
"south": {"uv": [0, 9.5, 3, 10.5], "texture": "#0"},
"west": {"uv": [0, 9.5, 3, 10.5], "texture": "#0"},
"up": {"uv": [0, 10.5, 3, 13.5], "texture": "#0"},
"down": {"uv": [0, 10.5, 3, 13.5], "texture": "#0"}
}
},
{
"name": "nozzledown",
"from": [6, -5, 6],
"to": [10, -2, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [16, 1, 14]},
"faces": {
"north": {"uv": [0, 7.5, 2, 9], "texture": "#0"},
"east": {"uv": [0, 7.5, 2, 9], "texture": "#0"},
"south": {"uv": [0, 7.5, 2, 9], "texture": "#0"},
"west": {"uv": [0, 7.5, 2, 9], "texture": "#0"},
"down": {"uv": [2, 7, 4, 9], "texture": "#0"}
}
}
],
"display": {
"thirdperson_righthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"thirdperson_lefthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"firstperson_righthand": {
"rotation": [0, 45, 0],
"scale": [0.4, 0.4, 0.4]
},
"firstperson_lefthand": {
"rotation": [0, 225, 0],
"scale": [0.4, 0.4, 0.4]
},
"ground": {
"translation": [0, 3, 0],
"scale": [0.25, 0.25, 0.25]
},
"gui": {
"rotation": [30, 225, 0],
"translation": [0, 1, 0],
"scale": [0.625, 0.625, 0.625]
},
"fixed": {
"scale": [0.5, 0.5, 0.5]
}
}
}

View file

@ -0,0 +1,23 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/spout",
"particle": "create:block/spout"
},
"elements": [
{
"name": "nozzleup",
"from": [5, -2, 5],
"to": [11, 0, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [16, 7, 14]},
"faces": {
"north": {"uv": [0, 9.5, 3, 10.5], "texture": "#0"},
"east": {"uv": [0, 9.5, 3, 10.5], "texture": "#0"},
"south": {"uv": [0, 9.5, 3, 10.5], "texture": "#0"},
"west": {"uv": [0, 9.5, 3, 10.5], "texture": "#0"},
"up": {"uv": [0, 10.5, 3, 13.5], "texture": "#0"},
"down": {"uv": [0, 10.5, 3, 13.5], "texture": "#0"}
}
}
]
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,23 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/spout",
"particle": "create:block/spout"
},
"elements": [
{
"name": "Top",
"from": [4, 0, 4],
"to": [12, 2, 12],
"rotation": {"angle": 0, "axis": "y", "origin": [12, 9, 12]},
"faces": {
"north": {"uv": [0, 15, 4, 16], "texture": "#0"},
"east": {"uv": [0, 15, 4, 16], "texture": "#0"},
"south": {"uv": [0, 15, 4, 16], "texture": "#0"},
"west": {"uv": [0, 15, 4, 16], "texture": "#0"},
"up": {"uv": [4, 12, 8, 16], "texture": "#0"},
"down": {"uv": [4, 12, 8, 16], "texture": "#0"}
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1,16 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
"A A",
"AAA"
],
"key": {
"A": {
"item": "create:andesite_alloy"
}
},
"result": {
"item": "create:basin",
"count": 1
}
}

View file

@ -1,20 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
" A ",
"III",
" I "
],
"key": {
"A": {
"item": "create:andesite_alloy"
},
"I": {
"tag": "forge:plates/brass"
}
},
"result": {
"item": "create:brass_hand",
"count": 1
}
}