mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 20:11:35 +01:00
Merge remote-tracking branch 'origin/mc1.16/dev' into mc1.16/dev
# Conflicts: # src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java
This commit is contained in:
commit
56b1170224
26 changed files with 630 additions and 362 deletions
|
@ -407,16 +407,16 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j
|
||||||
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
|
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
|
||||||
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
|
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
|
||||||
768a724d6c921cb92790364cf7a692fe8742a885 assets/create/lang/en_ud.json
|
768a724d6c921cb92790364cf7a692fe8742a885 assets/create/lang/en_ud.json
|
||||||
74c0dd6af2ffc332fe1459f9c3fbfc9371eb2507 assets/create/lang/en_us.json
|
363aca3d1194218b7d48fcec33d36c1b9c555e4e assets/create/lang/en_us.json
|
||||||
97f7b6e61707a003e907ee166911ca106f0439d6 assets/create/lang/unfinished/de_de.json
|
616063d3a66a6e56ccee1584ce38986d363908df assets/create/lang/unfinished/de_de.json
|
||||||
aa49b660299817b148b362f9f5c357906de8df90 assets/create/lang/unfinished/es_es.json
|
aa49b660299817b148b362f9f5c357906de8df90 assets/create/lang/unfinished/es_es.json
|
||||||
072cb64aac3feba48a2ca7e481cda325d7648b0f assets/create/lang/unfinished/es_mx.json
|
c85b6b95decefd03769debc9d6a2ac1bff481dd4 assets/create/lang/unfinished/es_mx.json
|
||||||
5463fcf22674ed540ce860358508fbac609c49d1 assets/create/lang/unfinished/fr_fr.json
|
5463fcf22674ed540ce860358508fbac609c49d1 assets/create/lang/unfinished/fr_fr.json
|
||||||
7fbd50f2325711f3a2fd086d8307ff1afb577220 assets/create/lang/unfinished/it_it.json
|
7fbd50f2325711f3a2fd086d8307ff1afb577220 assets/create/lang/unfinished/it_it.json
|
||||||
ff653860335529694629c7cabb7953afebc6fea3 assets/create/lang/unfinished/ja_jp.json
|
ff653860335529694629c7cabb7953afebc6fea3 assets/create/lang/unfinished/ja_jp.json
|
||||||
332556b3f5364601e872431fab0fe3cdf40ac373 assets/create/lang/unfinished/ko_kr.json
|
332556b3f5364601e872431fab0fe3cdf40ac373 assets/create/lang/unfinished/ko_kr.json
|
||||||
cc8e5eb4c2ea1390a215d12462d54f761e076c64 assets/create/lang/unfinished/nl_nl.json
|
8043c3d6d26835c784d1163282a9d4a391a6c8dd assets/create/lang/unfinished/nl_nl.json
|
||||||
88fd1b02799e8d1392be7df529803321e334033d assets/create/lang/unfinished/pt_br.json
|
c562a4d350d9abb40e83ab4a78851eda3886dfe9 assets/create/lang/unfinished/pt_br.json
|
||||||
f58b4e50ef5042aad6b254db7ff8c219f06b9ea3 assets/create/lang/unfinished/ru_ru.json
|
f58b4e50ef5042aad6b254db7ff8c219f06b9ea3 assets/create/lang/unfinished/ru_ru.json
|
||||||
e9e4cfbc8ef54b6c04ae77c776dfa7e546d05e02 assets/create/lang/unfinished/zh_cn.json
|
e9e4cfbc8ef54b6c04ae77c776dfa7e546d05e02 assets/create/lang/unfinished/zh_cn.json
|
||||||
eb17617bb14d0ffac000f86d6f9aa23429e8f4c3 assets/create/lang/unfinished/zh_tw.json
|
eb17617bb14d0ffac000f86d6f9aa23429e8f4c3 assets/create/lang/unfinished/zh_tw.json
|
||||||
|
@ -3696,6 +3696,7 @@ ff1900963bc4cd8ceffa78d58ef1952ceacb2fb7 data/forge/tags/items/storage_blocks/br
|
||||||
f6c8f34ceb475546dba5cc6ff288863ea795d20b data/forge/tags/items/storage_blocks/copper.json
|
f6c8f34ceb475546dba5cc6ff288863ea795d20b data/forge/tags/items/storage_blocks/copper.json
|
||||||
7f71a774800111e50b42de0e6159ed2d2a807d32 data/forge/tags/items/storage_blocks/zinc.json
|
7f71a774800111e50b42de0e6159ed2d2a807d32 data/forge/tags/items/storage_blocks/zinc.json
|
||||||
1376cd1f92903a1c4e1422719b1aa102438a216e data/minecraft/advancements/createchromatic_age.json
|
1376cd1f92903a1c4e1422719b1aa102438a216e data/minecraft/advancements/createchromatic_age.json
|
||||||
|
2072c51afc5bbc6c9d64fd086803193d8a3c40de data/minecraft/tags/blocks/base_stone_overworld.json
|
||||||
508730d3822c54d355329bf6a33d58071653afad data/minecraft/tags/blocks/beacon_base_blocks.json
|
508730d3822c54d355329bf6a33d58071653afad data/minecraft/tags/blocks/beacon_base_blocks.json
|
||||||
69f596fcb065e26b02ce246760432b5174191b76 data/minecraft/tags/blocks/impermeable.json
|
69f596fcb065e26b02ce246760432b5174191b76 data/minecraft/tags/blocks/impermeable.json
|
||||||
378b01e288301e0835d3d25167889077a2070780 data/minecraft/tags/blocks/rails.json
|
378b01e288301e0835d3d25167889077a2070780 data/minecraft/tags/blocks/rails.json
|
||||||
|
|
|
@ -882,7 +882,7 @@
|
||||||
"create.schematicAndQuill.noTarget": "Hold [Ctrl] to select Air blocks.",
|
"create.schematicAndQuill.noTarget": "Hold [Ctrl] to select Air blocks.",
|
||||||
"create.schematicAndQuill.abort": "Removed selection.",
|
"create.schematicAndQuill.abort": "Removed selection.",
|
||||||
"create.schematicAndQuill.title": "Schematic Name:",
|
"create.schematicAndQuill.title": "Schematic Name:",
|
||||||
"create.schematicAndQuill.convert": "Save and Deploy Immediately",
|
"create.schematicAndQuill.convert": "Save and Upload Immediately",
|
||||||
"create.schematicAndQuill.fallbackName": "My Schematic",
|
"create.schematicAndQuill.fallbackName": "My Schematic",
|
||||||
"create.schematicAndQuill.saved": "Saved as %1$s",
|
"create.schematicAndQuill.saved": "Saved as %1$s",
|
||||||
|
|
||||||
|
@ -897,12 +897,12 @@
|
||||||
"create.schematic.mirror.none": "None",
|
"create.schematic.mirror.none": "None",
|
||||||
"create.schematic.mirror.frontBack": "Front-Back",
|
"create.schematic.mirror.frontBack": "Front-Back",
|
||||||
"create.schematic.mirror.leftRight": "Left-Right",
|
"create.schematic.mirror.leftRight": "Left-Right",
|
||||||
"create.schematic.tool.deploy": "Deploy",
|
"create.schematic.tool.deploy": "Position",
|
||||||
"create.schematic.tool.move": "Move XZ",
|
"create.schematic.tool.move": "Move XZ",
|
||||||
"create.schematic.tool.movey": "Move Y",
|
"create.schematic.tool.movey": "Move Y",
|
||||||
"create.schematic.tool.rotate": "Rotate",
|
"create.schematic.tool.rotate": "Rotate",
|
||||||
"create.schematic.tool.print": "Print",
|
"create.schematic.tool.print": "Print",
|
||||||
"create.schematic.tool.flip": "Flip",
|
"create.schematic.tool.flip": "Mirror",
|
||||||
"create.schematic.tool.deploy.description.0": "Moves the structure to a location.",
|
"create.schematic.tool.deploy.description.0": "Moves the structure to a location.",
|
||||||
"create.schematic.tool.deploy.description.1": "Right-Click on the ground to place.",
|
"create.schematic.tool.deploy.description.1": "Right-Click on the ground to place.",
|
||||||
"create.schematic.tool.deploy.description.2": "Hold [Ctrl] to select at a fixed distance.",
|
"create.schematic.tool.deploy.description.2": "Hold [Ctrl] to select at a fixed distance.",
|
||||||
|
@ -978,7 +978,7 @@
|
||||||
"create.schematicannon.status.placing": "Placing",
|
"create.schematicannon.status.placing": "Placing",
|
||||||
"create.schematicannon.status.clearing": "Clearing Blocks",
|
"create.schematicannon.status.clearing": "Clearing Blocks",
|
||||||
"create.schematicannon.status.schematicInvalid": "Schematic Invalid",
|
"create.schematicannon.status.schematicInvalid": "Schematic Invalid",
|
||||||
"create.schematicannon.status.schematicNotPlaced": "Schematic Not Deployed",
|
"create.schematicannon.status.schematicNotPlaced": "Schematic not Positioned",
|
||||||
"create.schematicannon.status.schematicExpired": "Schematic File Expired",
|
"create.schematicannon.status.schematicExpired": "Schematic File Expired",
|
||||||
|
|
||||||
"create.materialChecklist": "Material Checklist",
|
"create.materialChecklist": "Material Checklist",
|
||||||
|
|
|
@ -883,7 +883,7 @@
|
||||||
"create.schematicAndQuill.noTarget": "Halte [Strg] zur Auswahl von Luft.",
|
"create.schematicAndQuill.noTarget": "Halte [Strg] zur Auswahl von Luft.",
|
||||||
"create.schematicAndQuill.abort": "Auswahl zurückgesetzt.",
|
"create.schematicAndQuill.abort": "Auswahl zurückgesetzt.",
|
||||||
"create.schematicAndQuill.title": "Bauplanname:",
|
"create.schematicAndQuill.title": "Bauplanname:",
|
||||||
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Deploy Immediately",
|
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Upload Immediately",
|
||||||
"create.schematicAndQuill.fallbackName": "Mein Bauplan",
|
"create.schematicAndQuill.fallbackName": "Mein Bauplan",
|
||||||
"create.schematicAndQuill.saved": "Gespeichert als %1$s",
|
"create.schematicAndQuill.saved": "Gespeichert als %1$s",
|
||||||
|
|
||||||
|
|
|
@ -883,7 +883,7 @@
|
||||||
"create.schematicAndQuill.noTarget": "UNLOCALIZED: Hold [Ctrl] to select Air blocks.",
|
"create.schematicAndQuill.noTarget": "UNLOCALIZED: Hold [Ctrl] to select Air blocks.",
|
||||||
"create.schematicAndQuill.abort": "UNLOCALIZED: Removed selection.",
|
"create.schematicAndQuill.abort": "UNLOCALIZED: Removed selection.",
|
||||||
"create.schematicAndQuill.title": "UNLOCALIZED: Schematic Name:",
|
"create.schematicAndQuill.title": "UNLOCALIZED: Schematic Name:",
|
||||||
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Deploy Immediately",
|
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Upload Immediately",
|
||||||
"create.schematicAndQuill.fallbackName": "UNLOCALIZED: My Schematic",
|
"create.schematicAndQuill.fallbackName": "UNLOCALIZED: My Schematic",
|
||||||
"create.schematicAndQuill.saved": "UNLOCALIZED: Saved as %1$s",
|
"create.schematicAndQuill.saved": "UNLOCALIZED: Saved as %1$s",
|
||||||
|
|
||||||
|
@ -898,12 +898,12 @@
|
||||||
"create.schematic.mirror.none": "UNLOCALIZED: None",
|
"create.schematic.mirror.none": "UNLOCALIZED: None",
|
||||||
"create.schematic.mirror.frontBack": "UNLOCALIZED: Front-Back",
|
"create.schematic.mirror.frontBack": "UNLOCALIZED: Front-Back",
|
||||||
"create.schematic.mirror.leftRight": "UNLOCALIZED: Left-Right",
|
"create.schematic.mirror.leftRight": "UNLOCALIZED: Left-Right",
|
||||||
"create.schematic.tool.deploy": "UNLOCALIZED: Deploy",
|
"create.schematic.tool.deploy": "UNLOCALIZED: Position",
|
||||||
"create.schematic.tool.move": "UNLOCALIZED: Move XZ",
|
"create.schematic.tool.move": "UNLOCALIZED: Move XZ",
|
||||||
"create.schematic.tool.movey": "UNLOCALIZED: Move Y",
|
"create.schematic.tool.movey": "UNLOCALIZED: Move Y",
|
||||||
"create.schematic.tool.rotate": "UNLOCALIZED: Rotate",
|
"create.schematic.tool.rotate": "UNLOCALIZED: Rotate",
|
||||||
"create.schematic.tool.print": "UNLOCALIZED: Print",
|
"create.schematic.tool.print": "UNLOCALIZED: Print",
|
||||||
"create.schematic.tool.flip": "UNLOCALIZED: Flip",
|
"create.schematic.tool.flip": "UNLOCALIZED: Mirror",
|
||||||
"create.schematic.tool.deploy.description.0": "UNLOCALIZED: Moves the structure to a location.",
|
"create.schematic.tool.deploy.description.0": "UNLOCALIZED: Moves the structure to a location.",
|
||||||
"create.schematic.tool.deploy.description.1": "UNLOCALIZED: Right-Click on the ground to place.",
|
"create.schematic.tool.deploy.description.1": "UNLOCALIZED: Right-Click on the ground to place.",
|
||||||
"create.schematic.tool.deploy.description.2": "UNLOCALIZED: Hold [Ctrl] to select at a fixed distance.",
|
"create.schematic.tool.deploy.description.2": "UNLOCALIZED: Hold [Ctrl] to select at a fixed distance.",
|
||||||
|
@ -979,7 +979,7 @@
|
||||||
"create.schematicannon.status.placing": "UNLOCALIZED: Placing",
|
"create.schematicannon.status.placing": "UNLOCALIZED: Placing",
|
||||||
"create.schematicannon.status.clearing": "UNLOCALIZED: Clearing Blocks",
|
"create.schematicannon.status.clearing": "UNLOCALIZED: Clearing Blocks",
|
||||||
"create.schematicannon.status.schematicInvalid": "UNLOCALIZED: Schematic Invalid",
|
"create.schematicannon.status.schematicInvalid": "UNLOCALIZED: Schematic Invalid",
|
||||||
"create.schematicannon.status.schematicNotPlaced": "UNLOCALIZED: Schematic Not Deployed",
|
"create.schematicannon.status.schematicNotPlaced": "UNLOCALIZED: Schematic not Positioned",
|
||||||
"create.schematicannon.status.schematicExpired": "UNLOCALIZED: Schematic File Expired",
|
"create.schematicannon.status.schematicExpired": "UNLOCALIZED: Schematic File Expired",
|
||||||
|
|
||||||
"create.materialChecklist": "UNLOCALIZED: Material Checklist",
|
"create.materialChecklist": "UNLOCALIZED: Material Checklist",
|
||||||
|
|
|
@ -883,7 +883,7 @@
|
||||||
"create.schematicAndQuill.noTarget": "Houd [Ctrl] ingedrukt om een Lucht block te kiezen.",
|
"create.schematicAndQuill.noTarget": "Houd [Ctrl] ingedrukt om een Lucht block te kiezen.",
|
||||||
"create.schematicAndQuill.abort": "Keuze verwijderd.",
|
"create.schematicAndQuill.abort": "Keuze verwijderd.",
|
||||||
"create.schematicAndQuill.title": "UNLOCALIZED: Schematic Name:",
|
"create.schematicAndQuill.title": "UNLOCALIZED: Schematic Name:",
|
||||||
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Deploy Immediately",
|
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Upload Immediately",
|
||||||
"create.schematicAndQuill.fallbackName": "Mijn Bouwtekening",
|
"create.schematicAndQuill.fallbackName": "Mijn Bouwtekening",
|
||||||
"create.schematicAndQuill.saved": "Opgeslagen als %1$s",
|
"create.schematicAndQuill.saved": "Opgeslagen als %1$s",
|
||||||
|
|
||||||
|
|
|
@ -883,7 +883,7 @@
|
||||||
"create.schematicAndQuill.noTarget": "Seguro [Ctrl] para selecionar Blocos de Ar.",
|
"create.schematicAndQuill.noTarget": "Seguro [Ctrl] para selecionar Blocos de Ar.",
|
||||||
"create.schematicAndQuill.abort": "Seleção removida.",
|
"create.schematicAndQuill.abort": "Seleção removida.",
|
||||||
"create.schematicAndQuill.title": "UNLOCALIZED: Schematic Name:",
|
"create.schematicAndQuill.title": "UNLOCALIZED: Schematic Name:",
|
||||||
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Deploy Immediately",
|
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Upload Immediately",
|
||||||
"create.schematicAndQuill.fallbackName": "Meu Esquema",
|
"create.schematicAndQuill.fallbackName": "Meu Esquema",
|
||||||
"create.schematicAndQuill.saved": "Salvo como %1$s",
|
"create.schematicAndQuill.saved": "Salvo como %1$s",
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"create:limestone",
|
||||||
|
"create:weathered_limestone",
|
||||||
|
"create:dolomite",
|
||||||
|
"create:gabbro",
|
||||||
|
"create:natural_scoria"
|
||||||
|
]
|
||||||
|
}
|
|
@ -1294,7 +1294,7 @@ public class AllBlocks {
|
||||||
REGISTRATE.block("copper_block", p -> new OxidizingBlock(p, 1 / 32f))
|
REGISTRATE.block("copper_block", p -> new OxidizingBlock(p, 1 / 32f))
|
||||||
.initialProperties(() -> Blocks.IRON_BLOCK)
|
.initialProperties(() -> Blocks.IRON_BLOCK)
|
||||||
.tag(Tags.Blocks.STORAGE_BLOCKS)
|
.tag(Tags.Blocks.STORAGE_BLOCKS)
|
||||||
.tag(AllBlockTags.BEACON_BASE_BLOCKS.tag)
|
.tag(BlockTags.BEACON_BASE_BLOCKS)
|
||||||
.transform(tagBlockAndItem("storage_blocks/copper"))
|
.transform(tagBlockAndItem("storage_blocks/copper"))
|
||||||
.tag(Tags.Items.STORAGE_BLOCKS)
|
.tag(Tags.Items.STORAGE_BLOCKS)
|
||||||
.transform(oxidizedItemModel())
|
.transform(oxidizedItemModel())
|
||||||
|
@ -1320,7 +1320,7 @@ public class AllBlocks {
|
||||||
public static final BlockEntry<Block> ZINC_BLOCK = REGISTRATE.block("zinc_block", p -> new Block(p))
|
public static final BlockEntry<Block> ZINC_BLOCK = REGISTRATE.block("zinc_block", p -> new Block(p))
|
||||||
.initialProperties(() -> Blocks.IRON_BLOCK)
|
.initialProperties(() -> Blocks.IRON_BLOCK)
|
||||||
.tag(Tags.Blocks.STORAGE_BLOCKS)
|
.tag(Tags.Blocks.STORAGE_BLOCKS)
|
||||||
.tag(AllBlockTags.BEACON_BASE_BLOCKS.tag)
|
.tag(BlockTags.BEACON_BASE_BLOCKS)
|
||||||
.transform(tagBlockAndItem("storage_blocks/zinc"))
|
.transform(tagBlockAndItem("storage_blocks/zinc"))
|
||||||
.tag(Tags.Items.STORAGE_BLOCKS)
|
.tag(Tags.Items.STORAGE_BLOCKS)
|
||||||
.build()
|
.build()
|
||||||
|
@ -1331,7 +1331,7 @@ public class AllBlocks {
|
||||||
.blockstate((c, p) -> p.simpleBlock(c.get(), p.models()
|
.blockstate((c, p) -> p.simpleBlock(c.get(), p.models()
|
||||||
.cubeAll(c.getName(), p.modLoc("block/brass_storage_block"))))
|
.cubeAll(c.getName(), p.modLoc("block/brass_storage_block"))))
|
||||||
.tag(Tags.Blocks.STORAGE_BLOCKS)
|
.tag(Tags.Blocks.STORAGE_BLOCKS)
|
||||||
.tag(AllBlockTags.BEACON_BASE_BLOCKS.tag)
|
.tag(BlockTags.BEACON_BASE_BLOCKS)
|
||||||
.transform(tagBlockAndItem("storage_blocks/brass"))
|
.transform(tagBlockAndItem("storage_blocks/brass"))
|
||||||
.tag(Tags.Items.STORAGE_BLOCKS)
|
.tag(Tags.Items.STORAGE_BLOCKS)
|
||||||
.build()
|
.build()
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.simibubi.create;
|
package com.simibubi.create;
|
||||||
|
|
||||||
import static com.simibubi.create.AllTags.NameSpace.FORGE;
|
import static com.simibubi.create.AllTags.NameSpace.FORGE;
|
||||||
import static com.simibubi.create.AllTags.NameSpace.MC;
|
|
||||||
import static com.simibubi.create.AllTags.NameSpace.MOD;
|
import static com.simibubi.create.AllTags.NameSpace.MOD;
|
||||||
import static com.simibubi.create.AllTags.NameSpace.TIC;
|
import static com.simibubi.create.AllTags.NameSpace.TIC;
|
||||||
|
|
||||||
|
@ -142,7 +141,7 @@ public class AllTags {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum AllBlockTags {
|
public static enum AllBlockTags {
|
||||||
WINDMILL_SAILS, FAN_HEATERS, WINDOWABLE, NON_MOVABLE, BRITTLE, SEATS, SAILS, VALVE_HANDLES, FAN_TRANSPARENT, SAFE_NBT, SLIMY_LOGS(TIC), BEACON_BASE_BLOCKS(MC)
|
WINDMILL_SAILS, FAN_HEATERS, WINDOWABLE, NON_MOVABLE, BRITTLE, SEATS, SAILS, VALVE_HANDLES, FAN_TRANSPARENT, SAFE_NBT, SLIMY_LOGS(TIC)
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
package com.simibubi.create.content.contraptions.components.deployer;
|
package com.simibubi.create.content.contraptions.components.deployer;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.simibubi.create.AllBlocks;
|
||||||
|
import com.simibubi.create.AllItems;
|
||||||
|
import com.simibubi.create.AllTags.AllBlockTags;
|
||||||
import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.Mode;
|
import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.Mode;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity;
|
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
|
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
|
||||||
|
@ -8,23 +18,33 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer;
|
||||||
import com.simibubi.create.content.logistics.item.filter.FilterItem;
|
import com.simibubi.create.content.logistics.item.filter.FilterItem;
|
||||||
|
import com.simibubi.create.content.schematics.ItemRequirement;
|
||||||
|
import com.simibubi.create.content.schematics.SchematicWorld;
|
||||||
|
import com.simibubi.create.content.schematics.filtering.SchematicInstances;
|
||||||
import com.simibubi.create.foundation.item.ItemHelper;
|
import com.simibubi.create.foundation.item.ItemHelper;
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||||
|
import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode;
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
|
import com.simibubi.create.foundation.utility.NBTProcessors;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.nbt.ListNBT;
|
import net.minecraft.nbt.ListNBT;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.vector.Vector3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
|
import net.minecraftforge.common.util.BlockSnapshot;
|
||||||
import net.minecraftforge.common.util.Constants.NBT;
|
import net.minecraftforge.common.util.Constants.NBT;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import net.minecraftforge.event.ForgeEventFactory;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class DeployerMovementBehaviour extends MovementBehaviour {
|
public class DeployerMovementBehaviour extends MovementBehaviour {
|
||||||
|
|
||||||
|
@ -52,6 +72,12 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void activate(MovementContext context, BlockPos pos, DeployerFakePlayer player, Mode mode) {
|
public void activate(MovementContext context, BlockPos pos, DeployerFakePlayer player, Mode mode) {
|
||||||
|
World world = context.world;
|
||||||
|
|
||||||
|
ItemStack filter = getFilter(context);
|
||||||
|
if (AllItems.SCHEMATIC.isIn(filter))
|
||||||
|
activateAsSchematicPrinter(context, pos, player, world, filter);
|
||||||
|
|
||||||
Vector3d facingVec = Vector3d.of(context.state.get(DeployerBlock.FACING)
|
Vector3d facingVec = Vector3d.of(context.state.get(DeployerBlock.FACING)
|
||||||
.getDirectionVec());
|
.getDirectionVec());
|
||||||
facingVec = context.rotation.apply(facingVec);
|
facingVec = context.rotation.apply(facingVec);
|
||||||
|
@ -62,6 +88,61 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
||||||
DeployerHandler.activate(player, vec, pos, facingVec, mode);
|
DeployerHandler.activate(player, vec, pos, facingVec, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void activateAsSchematicPrinter(MovementContext context, BlockPos pos, DeployerFakePlayer player, World world,
|
||||||
|
ItemStack filter) {
|
||||||
|
if (!filter.hasTag())
|
||||||
|
return;
|
||||||
|
if (!world.getBlockState(pos)
|
||||||
|
.getMaterial()
|
||||||
|
.isReplaceable())
|
||||||
|
return;
|
||||||
|
|
||||||
|
CompoundNBT tag = filter.getTag();
|
||||||
|
if (!tag.getBoolean("Deployed"))
|
||||||
|
return;
|
||||||
|
SchematicWorld schematicWorld = SchematicInstances.get(world, filter);
|
||||||
|
if (!schematicWorld.getBounds()
|
||||||
|
.isVecInside(pos.subtract(schematicWorld.anchor)))
|
||||||
|
return;
|
||||||
|
BlockState blockState = schematicWorld.getBlockState(pos);
|
||||||
|
ItemRequirement requirement = ItemRequirement.of(blockState);
|
||||||
|
if (requirement.isInvalid() || requirement.isEmpty())
|
||||||
|
return;
|
||||||
|
if (AllBlocks.BELT.has(blockState))
|
||||||
|
return;
|
||||||
|
|
||||||
|
List<ItemStack> requiredItems = requirement.getRequiredItems();
|
||||||
|
ItemStack firstRequired = requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0);
|
||||||
|
IItemHandler iItemHandler = context.contraption.inventory;
|
||||||
|
|
||||||
|
for (ItemStack required : requiredItems) {
|
||||||
|
int amountFound = ItemHelper
|
||||||
|
.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
|
||||||
|
required.getCount(), true)
|
||||||
|
.getCount();
|
||||||
|
if (amountFound < required.getCount())
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ItemStack required : requiredItems)
|
||||||
|
ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
|
||||||
|
required.getCount(), false);
|
||||||
|
|
||||||
|
CompoundNBT data = null;
|
||||||
|
if (AllBlockTags.SAFE_NBT.matches(blockState)) {
|
||||||
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
if (tile != null) {
|
||||||
|
data = tile.write(new CompoundNBT());
|
||||||
|
data = NBTProcessors.process(tile, data, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockSnapshot blocksnapshot = BlockSnapshot.create(world.getRegistryKey(), world, pos);
|
||||||
|
BlockHelper.placeSchematicBlock(world, blockState, pos, firstRequired, data);
|
||||||
|
if (ForgeEventFactory.onBlockPlace(player, blocksnapshot, Direction.UP))
|
||||||
|
blocksnapshot.restore(true, false);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick(MovementContext context) {
|
public void tick(MovementContext context) {
|
||||||
if (context.world.isRemote)
|
if (context.world.isRemote)
|
||||||
|
@ -109,6 +190,8 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
||||||
if (player.getHeldItemMainhand()
|
if (player.getHeldItemMainhand()
|
||||||
.isEmpty()) {
|
.isEmpty()) {
|
||||||
ItemStack filter = getFilter(context);
|
ItemStack filter = getFilter(context);
|
||||||
|
if (AllItems.SCHEMATIC.isIn(filter))
|
||||||
|
return;
|
||||||
ItemStack held = ItemHelper.extract(context.contraption.inventory,
|
ItemStack held = ItemHelper.extract(context.contraption.inventory,
|
||||||
stack -> FilterItem.test(context.world, stack, filter), 1, false);
|
stack -> FilterItem.test(context.world, stack, filter), 1, false);
|
||||||
player.setHeldItem(Hand.MAIN_HAND, held);
|
player.setHeldItem(Hand.MAIN_HAND, held);
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class ChromaticCompoundItem extends Item {
|
||||||
if (y < 0 && y - yMotion < -10 && config.enableShadowSteelRecipe.get()) {
|
if (y < 0 && y - yMotion < -10 && config.enableShadowSteelRecipe.get()) {
|
||||||
ItemStack newStack = AllItems.SHADOW_STEEL.asStack();
|
ItemStack newStack = AllItems.SHADOW_STEEL.asStack();
|
||||||
newStack.setCount(stack.getCount());
|
newStack.setCount(stack.getCount());
|
||||||
data.putBoolean("FromVoid", true);
|
data.putBoolean("JustCreated", true);
|
||||||
entity.setItem(newStack);
|
entity.setItem(newStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public class ChromaticCompoundItem extends Item {
|
||||||
ItemEntity newEntity = new ItemEntity(world, entity.getX(), entity.getY(), entity.getZ(), newStack);
|
ItemEntity newEntity = new ItemEntity(world, entity.getX(), entity.getY(), entity.getZ(), newStack);
|
||||||
newEntity.setMotion(entity.getMotion());
|
newEntity.setMotion(entity.getMotion());
|
||||||
newEntity.getPersistentData()
|
newEntity.getPersistentData()
|
||||||
.putBoolean("FromLight", true);
|
.putBoolean("JustCreated", true);
|
||||||
itemData.remove("CollectingLight");
|
itemData.remove("CollectingLight");
|
||||||
world.addEntity(newEntity);
|
world.addEntity(newEntity);
|
||||||
|
|
||||||
|
@ -119,10 +119,8 @@ public class ChromaticCompoundItem extends Item {
|
||||||
int entityZ = MathHelper.floor(entity.getZ());
|
int entityZ = MathHelper.floor(entity.getZ());
|
||||||
int localWorldHeight = world.getHeight(Heightmap.Type.WORLD_SURFACE, entityX, entityZ);
|
int localWorldHeight = world.getHeight(Heightmap.Type.WORLD_SURFACE, entityX, entityZ);
|
||||||
|
|
||||||
BlockPos.Mutable testPos = new BlockPos.Mutable(
|
BlockPos.Mutable testPos =
|
||||||
entityX,
|
new BlockPos.Mutable(entityX, Math.min(MathHelper.floor(entity.getY()), localWorldHeight), entityZ);
|
||||||
Math.min(MathHelper.floor(entity.getY()), localWorldHeight),
|
|
||||||
entityZ);
|
|
||||||
|
|
||||||
while (testPos.getY() > 0) {
|
while (testPos.getY() > 0) {
|
||||||
testPos.move(Direction.DOWN);
|
testPos.move(Direction.DOWN);
|
||||||
|
@ -132,11 +130,13 @@ public class ChromaticCompoundItem extends Item {
|
||||||
if (state.getBlock() == Blocks.BEACON) {
|
if (state.getBlock() == Blocks.BEACON) {
|
||||||
TileEntity te = world.getTileEntity(testPos);
|
TileEntity te = world.getTileEntity(testPos);
|
||||||
|
|
||||||
if (!(te instanceof BeaconTileEntity)) break;
|
if (!(te instanceof BeaconTileEntity))
|
||||||
|
break;
|
||||||
|
|
||||||
BeaconTileEntity bte = (BeaconTileEntity) te;
|
BeaconTileEntity bte = (BeaconTileEntity) te;
|
||||||
|
|
||||||
if (bte.getLevels() != 0 && !bte.beamSegments.isEmpty()) isOverBeacon = true;
|
if (bte.getLevels() != 0 && !bte.beamSegments.isEmpty())
|
||||||
|
isOverBeacon = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ public class ChromaticCompoundItem extends Item {
|
||||||
if (isOverBeacon) {
|
if (isOverBeacon) {
|
||||||
ItemStack newStack = AllItems.REFINED_RADIANCE.asStack();
|
ItemStack newStack = AllItems.REFINED_RADIANCE.asStack();
|
||||||
newStack.setCount(stack.getCount());
|
newStack.setCount(stack.getCount());
|
||||||
data.putBoolean("FromLight", true);
|
data.putBoolean("JustCreated", true);
|
||||||
entity.setItem(newStack);
|
entity.setItem(newStack);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.simibubi.create.content.curiosities;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
|
import net.minecraft.entity.item.ItemEntity;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.particles.ParticleTypes;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class NoGravMagicalDohickyItem extends Item {
|
||||||
|
|
||||||
|
public NoGravMagicalDohickyItem(Properties p_i48487_1_) {
|
||||||
|
super(p_i48487_1_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onEntityItemUpdate(ItemStack stack, ItemEntity entity) {
|
||||||
|
World world = entity.world;
|
||||||
|
Vector3d pos = entity.getPositionVec();
|
||||||
|
CompoundNBT persistentData = entity.getPersistentData();
|
||||||
|
|
||||||
|
if (world.isRemote) {
|
||||||
|
if (world.rand.nextFloat() < getIdleParticleChance(entity)) {
|
||||||
|
Vector3d ppos = VecHelper.offsetRandomly(pos, world.rand, .5f);
|
||||||
|
world.addParticle(ParticleTypes.END_ROD, ppos.x, pos.y, ppos.z, 0, -.1f, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.isSilent() && !persistentData.getBoolean("PlayEffects")) {
|
||||||
|
Vector3d basemotion = new Vector3d(0, 1, 0);
|
||||||
|
world.addParticle(ParticleTypes.FLASH, pos.x, pos.y, pos.z, 0, 0, 0);
|
||||||
|
for (int i = 0; i < 20; i++) {
|
||||||
|
Vector3d motion = VecHelper.offsetRandomly(basemotion, world.rand, 1);
|
||||||
|
world.addParticle(ParticleTypes.WITCH, pos.x, pos.y, pos.z, motion.x, motion.y, motion.z);
|
||||||
|
world.addParticle(ParticleTypes.END_ROD, pos.x, pos.y, pos.z, motion.x, motion.y, motion.z);
|
||||||
|
}
|
||||||
|
persistentData.putBoolean("PlayEffects", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
entity.setNoGravity(true);
|
||||||
|
|
||||||
|
if (!persistentData.contains("JustCreated"))
|
||||||
|
return false;
|
||||||
|
onCreated(entity, persistentData);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected float getIdleParticleChance(ItemEntity entity) {
|
||||||
|
return MathHelper.clamp(entity.getItem()
|
||||||
|
.getCount() - 10, 5, 100) / 64f;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onCreated(ItemEntity entity, CompoundNBT persistentData) {
|
||||||
|
entity.lifespan = 6000;
|
||||||
|
persistentData.remove("JustCreated");
|
||||||
|
|
||||||
|
// just a flag to tell the client to play an effect
|
||||||
|
entity.setSilent(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,16 +1,10 @@
|
||||||
package com.simibubi.create.content.curiosities;
|
package com.simibubi.create.content.curiosities;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
|
||||||
|
|
||||||
import net.minecraft.entity.item.ItemEntity;
|
import net.minecraft.entity.item.ItemEntity;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.particles.ParticleTypes;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
import net.minecraft.util.math.vector.Vector3d;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class RefinedRadianceItem extends Item {
|
public class RefinedRadianceItem extends NoGravMagicalDohickyItem {
|
||||||
|
|
||||||
public RefinedRadianceItem(Properties properties) {
|
public RefinedRadianceItem(Properties properties) {
|
||||||
super(properties);
|
super(properties);
|
||||||
|
@ -22,38 +16,10 @@ public class RefinedRadianceItem extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onEntityItemUpdate(ItemStack stack, ItemEntity entity) {
|
protected void onCreated(ItemEntity entity, CompoundNBT persistentData) {
|
||||||
World world = entity.world;
|
super.onCreated(entity, persistentData);
|
||||||
Vector3d pos = entity.getPositionVec();
|
entity.setMotion(entity.getMotion()
|
||||||
|
.add(0, .15f, 0));
|
||||||
if (world.isRemote && entity.hasNoGravity()) {
|
|
||||||
if (world.rand.nextFloat() < MathHelper.clamp(entity.getItem().getCount() - 10, 1, 100) / 64f) {
|
|
||||||
Vector3d ppos = VecHelper.offsetRandomly(pos, world.rand, .5f);
|
|
||||||
world.addParticle(ParticleTypes.END_ROD, ppos.x, pos.y, ppos.z, 0, -.1f, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!entity.getPersistentData().contains("ClientAnimationPlayed")) {
|
|
||||||
Vector3d basemotion = new Vector3d(0, 1, 0);
|
|
||||||
world.addParticle(ParticleTypes.FLASH, pos.x, pos.y, pos.z, 0, 0, 0);
|
|
||||||
for (int i = 0; i < 20; i++) {
|
|
||||||
Vector3d motion = VecHelper.offsetRandomly(basemotion, world.rand, 1);
|
|
||||||
world.addParticle(ParticleTypes.WITCH, pos.x, pos.y, pos.z, motion.x, motion.y, motion.z);
|
|
||||||
world.addParticle(ParticleTypes.END_ROD, pos.x, pos.y, pos.z, motion.x, motion.y, motion.z);
|
|
||||||
}
|
|
||||||
entity.getPersistentData().putBoolean("ClientAnimationPlayed", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!entity.getPersistentData().contains("FromLight"))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
entity.lifespan = 6000;
|
|
||||||
entity.setNoGravity(true);
|
|
||||||
entity.setMotion(entity.getMotion().add(0, .15f, 0));
|
|
||||||
entity.getPersistentData().remove("FromLight");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,56 +1,26 @@
|
||||||
package com.simibubi.create.content.curiosities;
|
package com.simibubi.create.content.curiosities;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
|
||||||
|
|
||||||
import net.minecraft.entity.item.ItemEntity;
|
import net.minecraft.entity.item.ItemEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.particles.ParticleTypes;
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.vector.Vector3d;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class ShadowSteelItem extends Item {
|
public class ShadowSteelItem extends NoGravMagicalDohickyItem {
|
||||||
|
|
||||||
public ShadowSteelItem(Properties properties) {
|
public ShadowSteelItem(Properties properties) {
|
||||||
super(properties);
|
super(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onEntityItemUpdate(ItemStack stack, ItemEntity entity) {
|
protected void onCreated(ItemEntity entity, CompoundNBT persistentData) {
|
||||||
World world = entity.world;
|
super.onCreated(entity, persistentData);
|
||||||
Vector3d pos = entity.getPositionVec();
|
|
||||||
|
|
||||||
if (world.isRemote && entity.hasNoGravity()) {
|
|
||||||
if (world.rand.nextFloat() < MathHelper.clamp(entity.getItem().getCount() - 10,
|
|
||||||
Math.min(entity.getMotion().y * 20, 20), 100) / 64f) {
|
|
||||||
Vector3d ppos = VecHelper.offsetRandomly(pos, world.rand, .5f);
|
|
||||||
world.addParticle(ParticleTypes.END_ROD, ppos.x, pos.y, ppos.z, 0, -.1f, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!entity.getPersistentData().contains("ClientAnimationPlayed")) {
|
|
||||||
Vector3d basemotion = new Vector3d(0, 1, 0);
|
|
||||||
world.addParticle(ParticleTypes.FLASH, pos.x, pos.y, pos.z, 0, 0, 0);
|
|
||||||
for (int i = 0; i < 20; i++) {
|
|
||||||
Vector3d motion = VecHelper.offsetRandomly(basemotion, world.rand, 1);
|
|
||||||
world.addParticle(ParticleTypes.WITCH, pos.x, pos.y, pos.z, motion.x, motion.y, motion.z);
|
|
||||||
world.addParticle(ParticleTypes.END_ROD, pos.x, pos.y, pos.z, motion.x, motion.y, motion.z);
|
|
||||||
}
|
|
||||||
entity.getPersistentData().putBoolean("ClientAnimationPlayed", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!entity.getPersistentData().contains("FromVoid"))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
entity.setNoGravity(true);
|
|
||||||
float yMotion = (entity.fallDistance + 3) / 50f;
|
float yMotion = (entity.fallDistance + 3) / 50f;
|
||||||
entity.setMotion(0, yMotion, 0);
|
entity.setMotion(0, yMotion, 0);
|
||||||
entity.lifespan = 6000;
|
}
|
||||||
entity.getPersistentData().remove("FromVoid");
|
|
||||||
return false;
|
@Override
|
||||||
|
protected float getIdleParticleChance(ItemEntity entity) {
|
||||||
|
return (float) (MathHelper.clamp(entity.getItem()
|
||||||
|
.getCount() - 10, MathHelper.clamp(entity.getMotion().y * 20, 5, 20), 100) / 64f);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,10 @@ package com.simibubi.create.content.logistics.block.belts.tunnel;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.IdentityHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -188,12 +191,17 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Random rand = new Random();
|
private static Random rand = new Random();
|
||||||
|
private static Map<Pair<BrassTunnelTileEntity, Direction>, ItemStack> distributed = new IdentityHashMap<>();
|
||||||
|
private static Set<Pair<BrassTunnelTileEntity, Direction>> full = new HashSet<>();
|
||||||
|
|
||||||
private void distribute(List<Pair<BrassTunnelTileEntity, Direction>> validTargets) {
|
private void distribute(List<Pair<BrassTunnelTileEntity, Direction>> validTargets) {
|
||||||
int amountTargets = validTargets.size();
|
int amountTargets = validTargets.size();
|
||||||
if (amountTargets == 0)
|
if (amountTargets == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
distributed.clear();
|
||||||
|
full.clear();
|
||||||
|
|
||||||
int indexStart = previousOutputIndex % amountTargets;
|
int indexStart = previousOutputIndex % amountTargets;
|
||||||
SelectionMode mode = selectionMode.get();
|
SelectionMode mode = selectionMode.get();
|
||||||
boolean force = mode == SelectionMode.FORCED_ROUND_ROBIN || mode == SelectionMode.FORCED_SPLIT;
|
boolean force = mode == SelectionMode.FORCED_ROUND_ROBIN || mode == SelectionMode.FORCED_SPLIT;
|
||||||
|
@ -204,22 +212,24 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity {
|
||||||
if (mode == SelectionMode.PREFER_NEAREST || mode == SelectionMode.SYNCHRONIZE)
|
if (mode == SelectionMode.PREFER_NEAREST || mode == SelectionMode.SYNCHRONIZE)
|
||||||
indexStart = 0;
|
indexStart = 0;
|
||||||
|
|
||||||
ItemStack toDistribute = null;
|
ItemStack toDistribute = stackToDistribute.copy();
|
||||||
int leftovers = 0;
|
for (boolean distributeAgain : Iterate.trueAndFalse) {
|
||||||
|
ItemStack toDistributeThisCycle = null;
|
||||||
int remainingOutputs = amountTargets;
|
int remainingOutputs = amountTargets;
|
||||||
|
int leftovers = 0;
|
||||||
|
|
||||||
for (boolean simulate : Iterate.trueAndFalse) {
|
for (boolean simulate : Iterate.trueAndFalse) {
|
||||||
if (remainingOutputs == 0)
|
if (remainingOutputs == 0)
|
||||||
return;
|
break;
|
||||||
|
|
||||||
leftovers = 0;
|
leftovers = 0;
|
||||||
int index = indexStart;
|
int index = indexStart;
|
||||||
int stackSize = stackToDistribute.getCount();
|
int stackSize = toDistribute.getCount();
|
||||||
int splitStackSize = stackSize / remainingOutputs;
|
int splitStackSize = stackSize / remainingOutputs;
|
||||||
int splitRemainder = stackSize % remainingOutputs;
|
int splitRemainder = stackSize % remainingOutputs;
|
||||||
int visited = 0;
|
int visited = 0;
|
||||||
|
|
||||||
toDistribute = stackToDistribute.copy();
|
toDistributeThisCycle = toDistribute.copy();
|
||||||
if (!(force || split) && simulate)
|
if (!(force || split) && simulate)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -230,21 +240,44 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity {
|
||||||
index = (index + 1) % amountTargets;
|
index = (index + 1) % amountTargets;
|
||||||
visited++;
|
visited++;
|
||||||
|
|
||||||
int count = split ? splitStackSize + (splitRemainder > 0 ? 1 : 0) : stackSize;
|
if (full.contains(pair)) {
|
||||||
ItemStack toOutput = ItemHandlerHelper.copyStackWithSize(toDistribute, count);
|
|
||||||
ItemStack remainder = insertIntoTunnel(tunnel, side, toOutput, simulate);
|
|
||||||
|
|
||||||
if (remainder == null || remainder.getCount() == count) {
|
|
||||||
if (force)
|
|
||||||
return;
|
|
||||||
if (split && simulate)
|
if (split && simulate)
|
||||||
remainingOutputs--;
|
remainingOutputs--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int count = split ? splitStackSize + (splitRemainder > 0 ? 1 : 0) : stackSize;
|
||||||
|
ItemStack toOutput = ItemHandlerHelper.copyStackWithSize(toDistributeThisCycle, count);
|
||||||
|
|
||||||
|
// Grow by 1 to determine if target is full even after a successful transfer
|
||||||
|
boolean testWithIncreasedCount = distributed.containsKey(pair);
|
||||||
|
int increasedCount = testWithIncreasedCount ? distributed.get(pair)
|
||||||
|
.getCount() : 0;
|
||||||
|
if (testWithIncreasedCount)
|
||||||
|
toOutput.grow(increasedCount);
|
||||||
|
|
||||||
|
ItemStack remainder = insertIntoTunnel(tunnel, side, toOutput, true);
|
||||||
|
|
||||||
|
if (remainder == null || remainder.getCount() == (testWithIncreasedCount ? count + 1 : count)) {
|
||||||
|
if (force)
|
||||||
|
return;
|
||||||
|
if (split && simulate)
|
||||||
|
remainingOutputs--;
|
||||||
|
if (!simulate)
|
||||||
|
full.add(pair);
|
||||||
|
continue;
|
||||||
|
} else if (!remainder.isEmpty() && !simulate) {
|
||||||
|
full.add(pair);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!simulate) {
|
||||||
|
toOutput.shrink(remainder.getCount());
|
||||||
|
distributed.put(pair, toOutput);
|
||||||
|
}
|
||||||
|
|
||||||
leftovers += remainder.getCount();
|
leftovers += remainder.getCount();
|
||||||
toDistribute.shrink(count);
|
toDistributeThisCycle.shrink(count);
|
||||||
if (toDistribute.isEmpty())
|
if (toDistributeThisCycle.isEmpty())
|
||||||
break;
|
break;
|
||||||
splitRemainder--;
|
splitRemainder--;
|
||||||
if (!split)
|
if (!split)
|
||||||
|
@ -252,7 +285,21 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stackToDistribute = ItemHandlerHelper.copyStackWithSize(stackToDistribute, toDistribute.getCount() + leftovers);
|
toDistribute.setCount(toDistributeThisCycle.getCount() + leftovers);
|
||||||
|
if (leftovers == 0 && distributeAgain)
|
||||||
|
break;
|
||||||
|
if (!split)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int failedTransferrals = 0;
|
||||||
|
for (Entry<Pair<BrassTunnelTileEntity, Direction>, ItemStack> entry : distributed.entrySet()) {
|
||||||
|
Pair<BrassTunnelTileEntity, Direction> pair = entry.getKey();
|
||||||
|
failedTransferrals += insertIntoTunnel(pair.getKey(), pair.getValue(), entry.getValue(), false).getCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
toDistribute.grow(failedTransferrals);
|
||||||
|
stackToDistribute = ItemHandlerHelper.copyStackWithSize(stackToDistribute, toDistribute.getCount());
|
||||||
previousOutputIndex++;
|
previousOutputIndex++;
|
||||||
previousOutputIndex %= amountTargets;
|
previousOutputIndex %= amountTargets;
|
||||||
notifyUpdate();
|
notifyUpdate();
|
||||||
|
@ -418,9 +465,16 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity {
|
||||||
if (!AllBlocks.BRASS_TUNNEL.has(blockState))
|
if (!AllBlocks.BRASS_TUNNEL.has(blockState))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
boolean prioritizeSides = tunnelTE == this;
|
||||||
|
|
||||||
|
for (boolean sidePass : Iterate.trueAndFalse) {
|
||||||
|
if (!prioritizeSides && sidePass)
|
||||||
|
continue;
|
||||||
for (Direction direction : Iterate.horizontalDirections) {
|
for (Direction direction : Iterate.horizontalDirections) {
|
||||||
if (direction == movementFacing && below.getSpeed() == 0)
|
if (direction == movementFacing && below.getSpeed() == 0)
|
||||||
continue;
|
continue;
|
||||||
|
if (prioritizeSides && sidePass == (direction.getAxis() == movementFacing.getAxis()))
|
||||||
|
continue;
|
||||||
if (direction == movementFacing.getOpposite())
|
if (direction == movementFacing.getOpposite())
|
||||||
continue;
|
continue;
|
||||||
if (tunnelTE.sides.contains(direction)) {
|
if (tunnelTE.sides.contains(direction)) {
|
||||||
|
@ -430,7 +484,8 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity {
|
||||||
TileEntityBehaviour.get(world, offset, DirectBeltInputBehaviour.TYPE);
|
TileEntityBehaviour.get(world, offset, DirectBeltInputBehaviour.TYPE);
|
||||||
if (inputBehaviour == null) {
|
if (inputBehaviour == null) {
|
||||||
if (direction == movementFacing)
|
if (direction == movementFacing)
|
||||||
if (!BlockHelper.hasBlockSolidSide(world.getBlockState(offset), world, offset, direction.getOpposite()))
|
if (!BlockHelper.hasBlockSolidSide(world.getBlockState(offset), world, offset,
|
||||||
|
direction.getOpposite()))
|
||||||
validOutputs.add(Pair.of(tunnelTE, direction));
|
validOutputs.add(Pair.of(tunnelTE, direction));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -440,6 +495,7 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBehavioursDeferred(List<TileEntityBehaviour> behaviours) {
|
public void addBehavioursDeferred(List<TileEntityBehaviour> behaviours) {
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package com.simibubi.create.content.logistics.block.chute;
|
package com.simibubi.create.content.logistics.block.chute;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.content.contraptions.components.fan.AirCurrent;
|
import com.simibubi.create.content.contraptions.components.fan.AirCurrent;
|
||||||
|
@ -207,7 +214,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
||||||
beltBelowOffset = i - 1;
|
beltBelowOffset = i - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.bottomPullDistance = flowLimit;
|
this.bottomPullDistance = Math.max(0, flowLimit);
|
||||||
}
|
}
|
||||||
sendData();
|
sendData();
|
||||||
}
|
}
|
||||||
|
@ -322,29 +329,40 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
||||||
private void handleInputFromAbove() {
|
private void handleInputFromAbove() {
|
||||||
if (!capAbove.isPresent())
|
if (!capAbove.isPresent())
|
||||||
capAbove = grabCapability(Direction.UP);
|
capAbove = grabCapability(Direction.UP);
|
||||||
if (capAbove.isPresent()) {
|
if (!capAbove.isPresent())
|
||||||
|
return;
|
||||||
|
|
||||||
int count = getExtractionAmount();
|
int count = getExtractionAmount();
|
||||||
if (count == 0)
|
IItemHandler inv = capAbove.orElse(null);
|
||||||
item =
|
Predicate<ItemStack> canAccept = this::canAcceptItem;
|
||||||
ItemHelper.extract(capAbove.orElse(null), this::canAcceptItem, ExtractionCountMode.UPTO, 16, false);
|
if (count == 0) {
|
||||||
else
|
item = ItemHelper.extract(inv, canAccept, ExtractionCountMode.UPTO, 16, false);
|
||||||
item = ItemHelper.extract(capAbove.orElse(null), this::canAcceptItem, ExtractionCountMode.EXACTLY,
|
return;
|
||||||
count, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ItemHelper.extract(inv, canAccept, ExtractionCountMode.EXACTLY, count, true)
|
||||||
|
.isEmpty())
|
||||||
|
item = ItemHelper.extract(inv, canAccept, ExtractionCountMode.EXACTLY, count, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleInputFromBelow() {
|
private void handleInputFromBelow() {
|
||||||
if (!capBelow.isPresent())
|
if (!capBelow.isPresent())
|
||||||
capBelow = grabCapability(Direction.DOWN);
|
capBelow = grabCapability(Direction.DOWN);
|
||||||
if (capBelow.isPresent()) {
|
if (!capBelow.isPresent())
|
||||||
|
return;
|
||||||
|
|
||||||
int count = getExtractionAmount();
|
int count = getExtractionAmount();
|
||||||
if (count == 0)
|
IItemHandler inv = capBelow.orElse(null);
|
||||||
item =
|
Predicate<ItemStack> canAccept = this::canAcceptItem;
|
||||||
ItemHelper.extract(capBelow.orElse(null), this::canAcceptItem, ExtractionCountMode.UPTO, 16, false);
|
|
||||||
else
|
if (count == 0) {
|
||||||
item = ItemHelper.extract(capBelow.orElse(null), this::canAcceptItem, ExtractionCountMode.EXACTLY,
|
item = ItemHelper.extract(inv, canAccept, ExtractionCountMode.UPTO, 16, false);
|
||||||
count, false);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ItemHelper.extract(inv, canAccept, ExtractionCountMode.EXACTLY, count, true)
|
||||||
|
.isEmpty())
|
||||||
|
item = ItemHelper.extract(inv, canAccept, ExtractionCountMode.EXACTLY, count, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean handleDownwardOutput(boolean simulate) {
|
private boolean handleDownwardOutput(boolean simulate) {
|
||||||
|
@ -358,9 +376,10 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
||||||
capBelow = grabCapability(Direction.DOWN);
|
capBelow = grabCapability(Direction.DOWN);
|
||||||
if (capBelow.isPresent()) {
|
if (capBelow.isPresent()) {
|
||||||
ItemStack remainder = ItemHandlerHelper.insertItemStacked(capBelow.orElse(null), item, simulate);
|
ItemStack remainder = ItemHandlerHelper.insertItemStacked(capBelow.orElse(null), item, simulate);
|
||||||
|
ItemStack held = getItem();
|
||||||
if (!simulate)
|
if (!simulate)
|
||||||
setItem(remainder);
|
setItem(remainder);
|
||||||
if (remainder.isEmpty())
|
if (remainder.getCount() != held.getCount())
|
||||||
return true;
|
return true;
|
||||||
if (direction == Direction.DOWN)
|
if (direction == Direction.DOWN)
|
||||||
return false;
|
return false;
|
||||||
|
@ -408,10 +427,11 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
||||||
if (!capAbove.isPresent())
|
if (!capAbove.isPresent())
|
||||||
capAbove = grabCapability(Direction.UP);
|
capAbove = grabCapability(Direction.UP);
|
||||||
if (capAbove.isPresent()) {
|
if (capAbove.isPresent()) {
|
||||||
|
int countBefore = item.getCount();
|
||||||
ItemStack remainder = ItemHandlerHelper.insertItemStacked(capAbove.orElse(null), item, simulate);
|
ItemStack remainder = ItemHandlerHelper.insertItemStacked(capAbove.orElse(null), item, simulate);
|
||||||
if (!simulate)
|
if (!simulate)
|
||||||
setItem(ItemStack.EMPTY);
|
item = remainder;
|
||||||
return remainder.isEmpty();
|
return countBefore != remainder.getCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.simibubi.create.foundation.block.ITE;
|
||||||
import com.simibubi.create.foundation.networking.AllPackets;
|
import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.item.ItemEntity;
|
import net.minecraft.entity.item.ItemEntity;
|
||||||
|
@ -49,10 +50,16 @@ public class EjectorBlock extends HorizontalKineticBlock implements ITE<EjectorT
|
||||||
.orElse(super.getSlipperiness(state, world, pos, entity));
|
.orElse(super.getSlipperiness(state, world, pos, entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void neighborChanged(BlockState state, World world, BlockPos pos, Block p_220069_4_,
|
||||||
|
BlockPos p_220069_5_, boolean p_220069_6_) {
|
||||||
|
withTileEntityDo(world, pos, EjectorTileEntity::updateSignal);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFallenUpon(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_) {
|
public void onFallenUpon(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_) {
|
||||||
Optional<EjectorTileEntity> tileEntityOptional = getTileEntityOptional(p_180658_1_, p_180658_2_);
|
Optional<EjectorTileEntity> tileEntityOptional = getTileEntityOptional(p_180658_1_, p_180658_2_);
|
||||||
if (tileEntityOptional.isPresent()) {
|
if (tileEntityOptional.isPresent() && !p_180658_3_.bypassesLandingEffects()) {
|
||||||
p_180658_3_.handleFallDamage(p_180658_4_, 0.0F);
|
p_180658_3_.handleFallDamage(p_180658_4_, 0.0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +74,8 @@ public class EjectorBlock extends HorizontalKineticBlock implements ITE<EjectorT
|
||||||
return;
|
return;
|
||||||
if (!entityIn.isAlive())
|
if (!entityIn.isAlive())
|
||||||
return;
|
return;
|
||||||
|
if (entityIn.bypassesLandingEffects())
|
||||||
|
return;
|
||||||
if (entityIn instanceof ItemEntity) {
|
if (entityIn instanceof ItemEntity) {
|
||||||
SharedDepotBlockMethods.onLanded(worldIn, entityIn);
|
SharedDepotBlockMethods.onLanded(worldIn, entityIn);
|
||||||
return;
|
return;
|
||||||
|
@ -79,6 +88,8 @@ public class EjectorBlock extends HorizontalKineticBlock implements ITE<EjectorT
|
||||||
EjectorTileEntity ejectorTileEntity = teProvider.get();
|
EjectorTileEntity ejectorTileEntity = teProvider.get();
|
||||||
if (ejectorTileEntity.getState() == State.RETRACTING)
|
if (ejectorTileEntity.getState() == State.RETRACTING)
|
||||||
return;
|
return;
|
||||||
|
if (ejectorTileEntity.powered)
|
||||||
|
return;
|
||||||
if (ejectorTileEntity.launcher.getHorizontalDistance() == 0)
|
if (ejectorTileEntity.launcher.getHorizontalDistance() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -97,7 +108,7 @@ public class EjectorBlock extends HorizontalKineticBlock implements ITE<EjectorT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ejectorTileEntity.launchAll();
|
ejectorTileEntity.activate();
|
||||||
ejectorTileEntity.notifyUpdate();
|
ejectorTileEntity.notifyUpdate();
|
||||||
if (entityIn.world.isRemote)
|
if (entityIn.world.isRemote)
|
||||||
AllPackets.channel.sendToServer(new EjectorTriggerPacket(ejectorTileEntity.getPos()));
|
AllPackets.channel.sendToServer(new EjectorTriggerPacket(ejectorTileEntity.getPos()));
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.simibubi.create.content.logistics.block.depot;
|
package com.simibubi.create.content.logistics.block.depot;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
|
@ -17,6 +19,8 @@ public class EjectorInstance extends ShaftInstance implements IDynamicInstance {
|
||||||
|
|
||||||
protected final InstanceKey<ModelData> plate;
|
protected final InstanceKey<ModelData> plate;
|
||||||
|
|
||||||
|
private float lastProgress = Float.NaN;
|
||||||
|
|
||||||
public EjectorInstance(InstancedTileRenderer<?> dispatcher, EjectorTileEntity tile) {
|
public EjectorInstance(InstancedTileRenderer<?> dispatcher, EjectorTileEntity tile) {
|
||||||
super(dispatcher, tile);
|
super(dispatcher, tile);
|
||||||
this.tile = tile;
|
this.tile = tile;
|
||||||
|
@ -29,21 +33,12 @@ public class EjectorInstance extends ShaftInstance implements IDynamicInstance {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beginFrame() {
|
public void beginFrame() {
|
||||||
|
float lidProgress = getLidProgress();
|
||||||
|
|
||||||
if (tile.lidProgress.settled()) return;
|
if (MathHelper.epsilonEquals(lidProgress, lastProgress)) return;
|
||||||
|
|
||||||
pivotPlate();
|
pivotPlate(lidProgress);
|
||||||
}
|
lastProgress = lidProgress;
|
||||||
|
|
||||||
private void pivotPlate() {
|
|
||||||
float lidProgress = tile.getLidProgress(AnimationTickHolder.getPartialTicks());
|
|
||||||
float angle = lidProgress * 70;
|
|
||||||
|
|
||||||
MatrixStack ms = new MatrixStack();
|
|
||||||
|
|
||||||
EjectorRenderer.applyLidAngle(tile, angle, MatrixStacker.of(ms).translate(getInstancePosition()));
|
|
||||||
|
|
||||||
plate.getInstance().setTransform(ms);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -57,4 +52,22 @@ public class EjectorInstance extends ShaftInstance implements IDynamicInstance {
|
||||||
super.remove();
|
super.remove();
|
||||||
plate.delete();
|
plate.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void pivotPlate() {
|
||||||
|
pivotPlate(getLidProgress());
|
||||||
|
}
|
||||||
|
|
||||||
|
private float getLidProgress() {
|
||||||
|
return tile.getLidProgress(AnimationTickHolder.getPartialTicks());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pivotPlate(float lidProgress) {
|
||||||
|
float angle = lidProgress * 70;
|
||||||
|
|
||||||
|
MatrixStack ms = new MatrixStack();
|
||||||
|
|
||||||
|
EjectorRenderer.applyLidAngle(tile, angle, MatrixStacker.of(ms).translate(getInstancePosition()));
|
||||||
|
|
||||||
|
plate.getInstance().setTransform(ms);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,8 @@ public class EjectorTileEntity extends KineticTileEntity {
|
||||||
DepotBehaviour depotBehaviour;
|
DepotBehaviour depotBehaviour;
|
||||||
EntityLauncher launcher;
|
EntityLauncher launcher;
|
||||||
LerpedFloat lidProgress;
|
LerpedFloat lidProgress;
|
||||||
|
boolean powered;
|
||||||
|
boolean launch;
|
||||||
State state;
|
State state;
|
||||||
|
|
||||||
public enum State {
|
public enum State {
|
||||||
|
@ -71,6 +73,7 @@ public class EjectorTileEntity extends KineticTileEntity {
|
||||||
.startWithValue(1);
|
.startWithValue(1);
|
||||||
state = State.RETRACTING;
|
state = State.RETRACTING;
|
||||||
launchedItems = new ArrayList<>();
|
launchedItems = new ArrayList<>();
|
||||||
|
powered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -92,10 +95,24 @@ public class EjectorTileEntity extends KineticTileEntity {
|
||||||
depotBehaviour.addSubBehaviours(behaviours);
|
depotBehaviour.addSubBehaviours(behaviours);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void launchAll() {
|
@Override
|
||||||
if (state != State.CHARGED && !(world.isRemote && state == State.LAUNCHING))
|
public void initialize() {
|
||||||
return;
|
super.initialize();
|
||||||
|
updateSignal();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void activate() {
|
||||||
|
launch = true;
|
||||||
|
nudgeEntities();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean cannotLaunch() {
|
||||||
|
return state != State.CHARGED && !(world.isRemote && state == State.LAUNCHING);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void activateDeferred() {
|
||||||
|
if (cannotLaunch())
|
||||||
|
return;
|
||||||
Direction facing = getFacing();
|
Direction facing = getFacing();
|
||||||
List<Entity> entities =
|
List<Entity> entities =
|
||||||
world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(pos).grow(-1 / 16f, 0, -1 / 16f));
|
world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(pos).grow(-1 / 16f, 0, -1 / 16f));
|
||||||
|
@ -135,12 +152,11 @@ public class EjectorTileEntity extends KineticTileEntity {
|
||||||
AllPackets.channel.sendToServer(new EjectorElytraPacket(pos));
|
AllPackets.channel.sendToServer(new EjectorElytraPacket(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!world.isRemote) {
|
||||||
lidProgress.chase(1, .8f, Chaser.EXP);
|
lidProgress.chase(1, .8f, Chaser.EXP);
|
||||||
state = State.LAUNCHING;
|
state = State.LAUNCHING;
|
||||||
|
world.playSound(null, pos, SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE, SoundCategory.BLOCKS, .35f, 1f);
|
||||||
if (!world.isRemote) {
|
world.playSound(null, pos, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, .1f, 1.4f);
|
||||||
world.playSound(null, pos, SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE, SoundCategory.BLOCKS, .5f, 1f);
|
|
||||||
world.playSound(null, pos, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, .125f, 1.4f);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,6 +203,9 @@ public class EjectorTileEntity extends KineticTileEntity {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!world.isRemote)
|
||||||
|
world.markAndNotifyBlock(pos, world.getChunkAt(pos), getBlockState(), getBlockState(), 0, 512);
|
||||||
|
|
||||||
if (depotBehaviour.heldItem != null) {
|
if (depotBehaviour.heldItem != null) {
|
||||||
launchedItems.add(IntAttached.withZero(heldItemStack));
|
launchedItems.add(IntAttached.withZero(heldItemStack));
|
||||||
depotBehaviour.removeHeldItem();
|
depotBehaviour.removeHeldItem();
|
||||||
|
@ -218,9 +237,13 @@ public class EjectorTileEntity extends KineticTileEntity {
|
||||||
|
|
||||||
boolean doLogic = !world.isRemote || isVirtual();
|
boolean doLogic = !world.isRemote || isVirtual();
|
||||||
State prevState = state;
|
State prevState = state;
|
||||||
|
|
||||||
float maxTime = Math.max(3, (float) launcher.getTotalFlyingTicks());
|
float maxTime = Math.max(3, (float) launcher.getTotalFlyingTicks());
|
||||||
|
|
||||||
|
if (launch) {
|
||||||
|
launch = false;
|
||||||
|
activateDeferred();
|
||||||
|
}
|
||||||
|
|
||||||
for (Iterator<IntAttached<ItemStack>> iterator = launchedItems.iterator(); iterator.hasNext();) {
|
for (Iterator<IntAttached<ItemStack>> iterator = launchedItems.iterator(); iterator.hasNext();) {
|
||||||
IntAttached<ItemStack> intAttached = iterator.next();
|
IntAttached<ItemStack> intAttached = iterator.next();
|
||||||
if (intAttached.exceeds((int) maxTime)) {
|
if (intAttached.exceeds((int) maxTime)) {
|
||||||
|
@ -241,11 +264,19 @@ public class EjectorTileEntity extends KineticTileEntity {
|
||||||
|
|
||||||
if (state == State.CHARGED) {
|
if (state == State.CHARGED) {
|
||||||
lidProgress.setValue(0);
|
lidProgress.setValue(0);
|
||||||
|
lidProgress.updateChaseSpeed(0);
|
||||||
if (doLogic)
|
if (doLogic)
|
||||||
ejectIfTriggered();
|
ejectIfTriggered();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == State.RETRACTING) {
|
if (state == State.RETRACTING) {
|
||||||
|
lidProgress.updateChaseSpeed(0);
|
||||||
|
if (lidProgress.getValue() == 0 && doLogic) {
|
||||||
|
state = State.CHARGED;
|
||||||
|
lidProgress.setValue(0);
|
||||||
|
sendData();
|
||||||
|
}
|
||||||
|
|
||||||
float value = MathHelper.clamp(lidProgress.getValue() - getWindUpSpeed(), 0, 1);
|
float value = MathHelper.clamp(lidProgress.getValue() - getWindUpSpeed(), 0, 1);
|
||||||
lidProgress.setValue(value);
|
lidProgress.setValue(value);
|
||||||
|
|
||||||
|
@ -255,24 +286,22 @@ public class EjectorTileEntity extends KineticTileEntity {
|
||||||
if (((int) world.getGameTime()) % soundRate == 0 && doLogic)
|
if (((int) world.getGameTime()) % soundRate == 0 && doLogic)
|
||||||
world.playSound(null, pos, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundCategory.BLOCKS, volume,
|
world.playSound(null, pos, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundCategory.BLOCKS, volume,
|
||||||
pitch);
|
pitch);
|
||||||
|
|
||||||
if (lidProgress.getValue() == 0 && doLogic) {
|
|
||||||
state = State.CHARGED;
|
|
||||||
lidProgress.setValue(0);
|
|
||||||
|
|
||||||
List<Entity> entities =
|
|
||||||
world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(pos).grow(-1 / 16f, 0, -1 / 16f));
|
|
||||||
for (Entity entity : entities)
|
|
||||||
if (!(entity instanceof PlayerEntity))
|
|
||||||
entity.setPosition(entity.getX(), entity.getY() + volume, entity.getZ());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state != prevState)
|
if (state != prevState)
|
||||||
notifyUpdate();
|
notifyUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void nudgeEntities() {
|
||||||
|
for (Entity entity : world.getEntitiesWithinAABB(Entity.class,
|
||||||
|
new AxisAlignedBB(pos).grow(-1 / 16f, 0, -1 / 16f)))
|
||||||
|
if (!(entity instanceof PlayerEntity))
|
||||||
|
entity.setPosition(entity.getX(), entity.getY() + .125f, entity.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
protected void ejectIfTriggered() {
|
protected void ejectIfTriggered() {
|
||||||
|
if (powered)
|
||||||
|
return;
|
||||||
int presentStackSize = depotBehaviour.getPresentStackSize();
|
int presentStackSize = depotBehaviour.getPresentStackSize();
|
||||||
if (presentStackSize == 0)
|
if (presentStackSize == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -280,11 +309,11 @@ public class EjectorTileEntity extends KineticTileEntity {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Direction funnelFacing = getFacing().getOpposite();
|
Direction funnelFacing = getFacing().getOpposite();
|
||||||
|
ItemStack held = depotBehaviour.getHeldItemStack();
|
||||||
if (AbstractFunnelBlock.getFunnelFacing(world.getBlockState(pos.up())) == funnelFacing) {
|
if (AbstractFunnelBlock.getFunnelFacing(world.getBlockState(pos.up())) == funnelFacing) {
|
||||||
DirectBeltInputBehaviour directOutput = getBehaviour(DirectBeltInputBehaviour.TYPE);
|
DirectBeltInputBehaviour directOutput = getBehaviour(DirectBeltInputBehaviour.TYPE);
|
||||||
if (depotBehaviour.heldItem != null) {
|
if (depotBehaviour.heldItem != null) {
|
||||||
ItemStack tryFunnel =
|
ItemStack tryFunnel = directOutput.tryExportingToBeltFunnel(held, funnelFacing, true);
|
||||||
directOutput.tryExportingToBeltFunnel(depotBehaviour.getHeldItemStack(), funnelFacing, true);
|
|
||||||
if (tryFunnel == null || !tryFunnel.isEmpty())
|
if (tryFunnel == null || !tryFunnel.isEmpty())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -294,11 +323,11 @@ public class EjectorTileEntity extends KineticTileEntity {
|
||||||
|
|
||||||
// Do not eject if target cannot accept held item
|
// Do not eject if target cannot accept held item
|
||||||
if (targetOpenInv != null && depotBehaviour.heldItem != null
|
if (targetOpenInv != null && depotBehaviour.heldItem != null
|
||||||
&& targetOpenInv.handleInsertion(depotBehaviour.getHeldItemStack(), Direction.UP, true)
|
&& targetOpenInv.handleInsertion(held, Direction.UP, true)
|
||||||
.isItemEqual(depotBehaviour.getHeldItemStack()))
|
.getCount() == held.getCount())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
launchAll();
|
activate();
|
||||||
notifyUpdate();
|
notifyUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,6 +397,7 @@ public class EjectorTileEntity extends KineticTileEntity {
|
||||||
super.write(compound, clientPacket);
|
super.write(compound, clientPacket);
|
||||||
compound.putInt("HorizontalDistance", launcher.getHorizontalDistance());
|
compound.putInt("HorizontalDistance", launcher.getHorizontalDistance());
|
||||||
compound.putInt("VerticalDistance", launcher.getVerticalDistance());
|
compound.putInt("VerticalDistance", launcher.getVerticalDistance());
|
||||||
|
compound.putBoolean("Powered", powered);
|
||||||
NBTHelper.writeEnum(compound, "State", state);
|
NBTHelper.writeEnum(compound, "State", state);
|
||||||
compound.put("Lid", lidProgress.writeNBT());
|
compound.put("Lid", lidProgress.writeNBT());
|
||||||
compound.put("LaunchedItems",
|
compound.put("LaunchedItems",
|
||||||
|
@ -386,12 +416,21 @@ public class EjectorTileEntity extends KineticTileEntity {
|
||||||
launcher.clamp(AllConfigs.SERVER.kinetics.maxEjectorDistance.get());
|
launcher.clamp(AllConfigs.SERVER.kinetics.maxEjectorDistance.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
powered = compound.getBoolean("Powered");
|
||||||
state = NBTHelper.readEnum(compound, "State", State.class);
|
state = NBTHelper.readEnum(compound, "State", State.class);
|
||||||
lidProgress.readNBT(compound.getCompound("Lid"), clientPacket);
|
lidProgress.readNBT(compound.getCompound("Lid"), clientPacket);
|
||||||
launchedItems = NBTHelper.readCompoundList(compound.getList("LaunchedItems", NBT.TAG_COMPOUND),
|
launchedItems = NBTHelper.readCompoundList(compound.getList("LaunchedItems", NBT.TAG_COMPOUND),
|
||||||
nbt -> IntAttached.read(nbt, ItemStack::read));
|
nbt -> IntAttached.read(nbt, ItemStack::read));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateSignal() {
|
||||||
|
boolean shoudPower = world.isBlockPowered(pos);
|
||||||
|
if (shoudPower == powered)
|
||||||
|
return;
|
||||||
|
powered = shoudPower;
|
||||||
|
sendData();
|
||||||
|
}
|
||||||
|
|
||||||
public void setTarget(int horizontalDistance, int verticalDistance) {
|
public void setTarget(int horizontalDistance, int verticalDistance) {
|
||||||
launcher.set(Math.max(1, horizontalDistance), verticalDistance);
|
launcher.set(Math.max(1, horizontalDistance), verticalDistance);
|
||||||
if (horizontalDistance == 0 && verticalDistance == 0) {
|
if (horizontalDistance == 0 && verticalDistance == 0) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class EjectorTriggerPacket extends TileEntityConfigurationPacket<EjectorT
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void applySettings(EjectorTileEntity te) {
|
protected void applySettings(EjectorTileEntity te) {
|
||||||
te.launchAll();
|
te.activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,6 +114,7 @@ public class AllPaletteBlocks {
|
||||||
|
|
||||||
public static final BlockEntry<Block> LIMESTONE =
|
public static final BlockEntry<Block> LIMESTONE =
|
||||||
REGISTRATE.baseBlock("limestone", Block::new, () -> Blocks.SANDSTONE, true)
|
REGISTRATE.baseBlock("limestone", Block::new, () -> Blocks.SANDSTONE, true)
|
||||||
|
.tag(BlockTags.BASE_STONE_OVERWORLD)
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final PalettesVariantEntry LIMESTONE_VARIANTS =
|
public static final PalettesVariantEntry LIMESTONE_VARIANTS =
|
||||||
|
@ -121,6 +122,7 @@ public class AllPaletteBlocks {
|
||||||
|
|
||||||
public static final BlockEntry<Block> WEATHERED_LIMESTONE =
|
public static final BlockEntry<Block> WEATHERED_LIMESTONE =
|
||||||
REGISTRATE.baseBlock("weathered_limestone", Block::new, () -> Blocks.SANDSTONE, true)
|
REGISTRATE.baseBlock("weathered_limestone", Block::new, () -> Blocks.SANDSTONE, true)
|
||||||
|
.tag(BlockTags.BASE_STONE_OVERWORLD)
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final PalettesVariantEntry WEATHERED_LIMESTONE_VARIANTS = new PalettesVariantEntry(
|
public static final PalettesVariantEntry WEATHERED_LIMESTONE_VARIANTS = new PalettesVariantEntry(
|
||||||
|
@ -128,6 +130,7 @@ public class AllPaletteBlocks {
|
||||||
|
|
||||||
public static final BlockEntry<Block> DOLOMITE =
|
public static final BlockEntry<Block> DOLOMITE =
|
||||||
REGISTRATE.baseBlock("dolomite", Block::new, () -> Blocks.QUARTZ_BLOCK, true)
|
REGISTRATE.baseBlock("dolomite", Block::new, () -> Blocks.QUARTZ_BLOCK, true)
|
||||||
|
.tag(BlockTags.BASE_STONE_OVERWORLD)
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final PalettesVariantEntry DOLOMITE_VARIANTS =
|
public static final PalettesVariantEntry DOLOMITE_VARIANTS =
|
||||||
|
@ -135,6 +138,7 @@ public class AllPaletteBlocks {
|
||||||
|
|
||||||
public static final BlockEntry<Block> GABBRO =
|
public static final BlockEntry<Block> GABBRO =
|
||||||
REGISTRATE.baseBlock("gabbro", Block::new, () -> Blocks.ANDESITE, true)
|
REGISTRATE.baseBlock("gabbro", Block::new, () -> Blocks.ANDESITE, true)
|
||||||
|
.tag(BlockTags.BASE_STONE_OVERWORLD)
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final PalettesVariantEntry GABBRO_VARIANTS =
|
public static final PalettesVariantEntry GABBRO_VARIANTS =
|
||||||
|
@ -146,6 +150,7 @@ public class AllPaletteBlocks {
|
||||||
|
|
||||||
public static final BlockEntry<Block> NATURAL_SCORIA = REGISTRATE.block("natural_scoria", Block::new)
|
public static final BlockEntry<Block> NATURAL_SCORIA = REGISTRATE.block("natural_scoria", Block::new)
|
||||||
.initialProperties(() -> Blocks.ANDESITE)
|
.initialProperties(() -> Blocks.ANDESITE)
|
||||||
|
.tag(BlockTags.BASE_STONE_OVERWORLD)
|
||||||
.onRegister(CreateRegistrate.blockVertexColors(new ScoriaVertexColor()))
|
.onRegister(CreateRegistrate.blockVertexColors(new ScoriaVertexColor()))
|
||||||
.loot((p, g) -> p.registerLootTable(g, RegistrateBlockLootTables.droppingWithSilkTouch(g, SCORIA.get())))
|
.loot((p, g) -> p.registerLootTable(g, RegistrateBlockLootTables.droppingWithSilkTouch(g, SCORIA.get())))
|
||||||
.blockstate(palettesCubeAll())
|
.blockstate(palettesCubeAll())
|
||||||
|
|
|
@ -3,32 +3,23 @@ package com.simibubi.create.content.schematics.block;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltPart;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltPart;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorItem;
|
import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorItem;
|
||||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import com.simibubi.create.content.contraptions.relays.elementary.AbstractShaftBlock;
|
import com.simibubi.create.content.contraptions.relays.elementary.AbstractShaftBlock;
|
||||||
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.nbt.NBTUtil;
|
import net.minecraft.nbt.NBTUtil;
|
||||||
import net.minecraft.particles.ParticleTypes;
|
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
|
||||||
import net.minecraft.tags.FluidTags;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.SoundCategory;
|
|
||||||
import net.minecraft.util.SoundEvents;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.IPlantable;
|
|
||||||
import net.minecraftforge.common.util.Constants;
|
import net.minecraftforge.common.util.Constants;
|
||||||
|
|
||||||
public abstract class LaunchedItem {
|
public abstract class LaunchedItem {
|
||||||
|
@ -129,46 +120,7 @@ public abstract class LaunchedItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void place(World world) {
|
void place(World world) {
|
||||||
// Piston
|
BlockHelper.placeSchematicBlock(world, state, target, stack, data);
|
||||||
if (state.contains(BlockStateProperties.EXTENDED))
|
|
||||||
state = state.with(BlockStateProperties.EXTENDED, Boolean.FALSE);
|
|
||||||
if (state.contains(BlockStateProperties.WATERLOGGED))
|
|
||||||
state = state.with(BlockStateProperties.WATERLOGGED, Boolean.FALSE);
|
|
||||||
|
|
||||||
if (AllBlocks.BELT.has(state)) {
|
|
||||||
world.setBlockState(target, state, 2);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (state.getBlock() == Blocks.COMPOSTER)
|
|
||||||
state = Blocks.COMPOSTER.getDefaultState();
|
|
||||||
else if (state.getBlock() != Blocks.SEA_PICKLE && state.getBlock() instanceof IPlantable)
|
|
||||||
state = ((IPlantable) state.getBlock()).getPlant(world, target);
|
|
||||||
|
|
||||||
if (world.getDimension().isUltrawarm() && state.getFluidState().getFluid().isIn(FluidTags.WATER)) {
|
|
||||||
int i = target.getX();
|
|
||||||
int j = target.getY();
|
|
||||||
int k = target.getZ();
|
|
||||||
world.playSound(null, target, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
|
||||||
|
|
||||||
for (int l = 0; l < 8; ++l) {
|
|
||||||
world.addParticle(ParticleTypes.LARGE_SMOKE, i + Math.random(), j + Math.random(), k + Math.random(), 0.0D, 0.0D, 0.0D);
|
|
||||||
}
|
|
||||||
Block.spawnDrops(state, world, target);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
world.setBlockState(target, state, 18);
|
|
||||||
if (data != null) {
|
|
||||||
TileEntity tile = world.getTileEntity(target);
|
|
||||||
if (tile != null) {
|
|
||||||
data.putInt("x", target.getX());
|
|
||||||
data.putInt("y", target.getY());
|
|
||||||
data.putInt("z", target.getZ());
|
|
||||||
if (tile instanceof KineticTileEntity)
|
|
||||||
((KineticTileEntity) tile).warnOfMovement();
|
|
||||||
tile.fromTag(state, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state.getBlock().onBlockPlacedBy(world, target, state, null, stack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,12 +375,14 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
}
|
}
|
||||||
|
|
||||||
if (missingItem == null && !positionNotLoaded) {
|
if (missingItem == null && !positionNotLoaded) {
|
||||||
|
do {
|
||||||
advanceCurrentPos();
|
advanceCurrentPos();
|
||||||
|
|
||||||
// End reached
|
|
||||||
if (state == State.STOPPED)
|
if (state == State.STOPPED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
} while (!blockReader.getBounds()
|
||||||
|
.isVecInside(currentPos));
|
||||||
|
|
||||||
sendUpdate = true;
|
sendUpdate = true;
|
||||||
target = schematicAnchor.add(currentPos);
|
target = schematicAnchor.add(currentPos);
|
||||||
}
|
}
|
||||||
|
@ -710,10 +712,12 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
if (world == null)
|
if (world == null)
|
||||||
return false;
|
return false;
|
||||||
BlockState toReplace = world.getBlockState(pos);
|
BlockState toReplace = world.getBlockState(pos);
|
||||||
boolean placingAir = state.getBlock().isAir(state, world, pos);
|
boolean placingAir = state.getBlock()
|
||||||
|
.isAir(state, world, pos);
|
||||||
|
|
||||||
BlockState toReplaceOther = null;
|
BlockState toReplaceOther = null;
|
||||||
if (state.contains(BlockStateProperties.BED_PART) && state.contains(BlockStateProperties.HORIZONTAL_FACING) && state.get(BlockStateProperties.BED_PART) == BedPart.FOOT)
|
if (state.contains(BlockStateProperties.BED_PART) && state.contains(BlockStateProperties.HORIZONTAL_FACING)
|
||||||
|
&& state.get(BlockStateProperties.BED_PART) == BedPart.FOOT)
|
||||||
toReplaceOther = world.getBlockState(pos.offset(state.get(BlockStateProperties.HORIZONTAL_FACING)));
|
toReplaceOther = world.getBlockState(pos.offset(state.get(BlockStateProperties.HORIZONTAL_FACING)));
|
||||||
if (state.contains(BlockStateProperties.DOUBLE_BLOCK_HALF)
|
if (state.contains(BlockStateProperties.DOUBLE_BLOCK_HALF)
|
||||||
&& state.get(BlockStateProperties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.LOWER)
|
&& state.get(BlockStateProperties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.LOWER)
|
||||||
|
@ -726,11 +730,13 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
return false;
|
return false;
|
||||||
if (toReplace == state)
|
if (toReplace == state)
|
||||||
return false;
|
return false;
|
||||||
if (toReplace.getBlockHardness(world, pos) == -1 || (toReplaceOther != null && toReplaceOther.getBlockHardness(world, pos) == -1))
|
if (toReplace.getBlockHardness(world, pos) == -1
|
||||||
|
|| (toReplaceOther != null && toReplaceOther.getBlockHardness(world, pos) == -1))
|
||||||
return false;
|
return false;
|
||||||
if (pos.withinDistance(getPos(), 2f))
|
if (pos.withinDistance(getPos(), 2f))
|
||||||
return false;
|
return false;
|
||||||
if (!replaceTileEntities && (toReplace.hasTileEntity() || (toReplaceOther != null && toReplaceOther.hasTileEntity())))
|
if (!replaceTileEntities
|
||||||
|
&& (toReplace.hasTileEntity() || (toReplaceOther != null && toReplaceOther.hasTileEntity())))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (shouldIgnoreBlockState(state))
|
if (shouldIgnoreBlockState(state))
|
||||||
|
@ -741,10 +747,12 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
if (replaceMode == 2 && !placingAir)
|
if (replaceMode == 2 && !placingAir)
|
||||||
return true;
|
return true;
|
||||||
if (replaceMode == 1
|
if (replaceMode == 1
|
||||||
&& (state.isNormalCube(blockReader, pos.subtract(schematicAnchor)) || (!toReplace.isNormalCube(world, pos) && (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos))))
|
&& (state.isNormalCube(blockReader, pos.subtract(schematicAnchor)) || (!toReplace.isNormalCube(world, pos)
|
||||||
|
&& (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos))))
|
||||||
&& !placingAir)
|
&& !placingAir)
|
||||||
return true;
|
return true;
|
||||||
if (replaceMode == 0 && !toReplace.isNormalCube(world, pos) && (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos)) && !placingAir)
|
if (replaceMode == 0 && !toReplace.isNormalCube(world, pos)
|
||||||
|
&& (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos)) && !placingAir)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -851,7 +859,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void launchBlock(BlockPos target, ItemStack stack, BlockState state, @Nullable CompoundNBT data) {
|
protected void launchBlock(BlockPos target, ItemStack stack, BlockState state, @Nullable CompoundNBT data) {
|
||||||
if (state.getBlock().isAir(state, world, target))
|
if (state.getBlock()
|
||||||
|
.isAir(state, world, target))
|
||||||
blocksPlaced++;
|
blocksPlaced++;
|
||||||
flyingBlocks.add(new LaunchedItem.ForBlockState(this.getPos(), target, stack, state, data));
|
flyingBlocks.add(new LaunchedItem.ForBlockState(this.getPos(), target, stack, state, data));
|
||||||
playFiringSound();
|
playFiringSound();
|
||||||
|
|
|
@ -20,6 +20,7 @@ import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
import com.simibubi.create.foundation.utility.outliner.AABBOutline;
|
import com.simibubi.create.foundation.utility.outliner.AABBOutline;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
|
@ -206,7 +207,10 @@ public class SchematicHandler {
|
||||||
return;
|
return;
|
||||||
if (mc.objectMouseOver instanceof BlockRayTraceResult) {
|
if (mc.objectMouseOver instanceof BlockRayTraceResult) {
|
||||||
BlockRayTraceResult blockRayTraceResult = (BlockRayTraceResult) mc.objectMouseOver;
|
BlockRayTraceResult blockRayTraceResult = (BlockRayTraceResult) mc.objectMouseOver;
|
||||||
if (AllBlocks.SCHEMATICANNON.has(mc.world.getBlockState(blockRayTraceResult.getPos())))
|
BlockState clickedBlock = mc.world.getBlockState(blockRayTraceResult.getPos());
|
||||||
|
if (AllBlocks.SCHEMATICANNON.has(clickedBlock))
|
||||||
|
return;
|
||||||
|
if (AllBlocks.DEPLOYER.has(clickedBlock))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
currentTool.getTool()
|
currentTool.getTool()
|
||||||
|
|
|
@ -6,6 +6,9 @@ import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.apache.commons.lang3.mutable.MutableInt;
|
import org.apache.commons.lang3.mutable.MutableInt;
|
||||||
|
|
||||||
|
import com.simibubi.create.AllBlocks;
|
||||||
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
|
@ -17,12 +20,16 @@ import net.minecraft.fluid.FluidState;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.state.Property;
|
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.state.properties.SlabType;
|
import net.minecraft.state.properties.SlabType;
|
||||||
import net.minecraft.tags.BlockTags;
|
import net.minecraft.tags.BlockTags;
|
||||||
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.particles.ParticleTypes;
|
||||||
|
import net.minecraft.tags.FluidTags;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.SoundCategory;
|
||||||
|
import net.minecraft.util.SoundEvents;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.shapes.VoxelShape;
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
|
@ -32,6 +39,7 @@ import net.minecraft.world.World;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
import net.minecraftforge.common.IPlantable;
|
||||||
|
|
||||||
public class BlockHelper {
|
public class BlockHelper {
|
||||||
|
|
||||||
|
@ -196,7 +204,61 @@ public class BlockHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean noCollisionInSpace(IBlockReader reader, BlockPos pos) {
|
public static boolean noCollisionInSpace(IBlockReader reader, BlockPos pos) {
|
||||||
return reader.getBlockState(pos).getCollisionShape(reader, pos).isEmpty();
|
return reader.getBlockState(pos)
|
||||||
|
.getCollisionShape(reader, pos)
|
||||||
|
.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void placeSchematicBlock(World world, BlockState state, BlockPos target, ItemStack stack,
|
||||||
|
@Nullable CompoundNBT data) {
|
||||||
|
// Piston
|
||||||
|
if (state.contains(BlockStateProperties.EXTENDED))
|
||||||
|
state = state.with(BlockStateProperties.EXTENDED, Boolean.FALSE);
|
||||||
|
if (state.contains(BlockStateProperties.WATERLOGGED))
|
||||||
|
state = state.with(BlockStateProperties.WATERLOGGED, Boolean.FALSE);
|
||||||
|
|
||||||
|
if (AllBlocks.BELT.has(state)) {
|
||||||
|
world.setBlockState(target, state, 2);
|
||||||
|
return;
|
||||||
|
} else if (state.getBlock() == Blocks.COMPOSTER)
|
||||||
|
state = Blocks.COMPOSTER.getDefaultState();
|
||||||
|
else if (state.getBlock() != Blocks.SEA_PICKLE && state.getBlock() instanceof IPlantable)
|
||||||
|
state = ((IPlantable) state.getBlock()).getPlant(world, target);
|
||||||
|
|
||||||
|
if (world.getDimension().isUltrawarm() && state.getFluidState()
|
||||||
|
.getFluid()
|
||||||
|
.isIn(FluidTags.WATER)) {
|
||||||
|
int i = target.getX();
|
||||||
|
int j = target.getY();
|
||||||
|
int k = target.getZ();
|
||||||
|
world.playSound(null, target, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F,
|
||||||
|
2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||||
|
|
||||||
|
for (int l = 0; l < 8; ++l) {
|
||||||
|
world.addParticle(ParticleTypes.LARGE_SMOKE, i + Math.random(), j + Math.random(), k + Math.random(),
|
||||||
|
0.0D, 0.0D, 0.0D);
|
||||||
|
}
|
||||||
|
Block.spawnDrops(state, world, target);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
world.setBlockState(target, state, 18);
|
||||||
|
if (data != null) {
|
||||||
|
TileEntity tile = world.getTileEntity(target);
|
||||||
|
if (tile != null) {
|
||||||
|
data.putInt("x", target.getX());
|
||||||
|
data.putInt("y", target.getY());
|
||||||
|
data.putInt("z", target.getZ());
|
||||||
|
if (tile instanceof KineticTileEntity)
|
||||||
|
((KineticTileEntity) tile).warnOfMovement();
|
||||||
|
tile.fromTag(tile.getBlockState(), data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
state.getBlock()
|
||||||
|
.onBlockPlacedBy(world, target, state, null, stack);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasBlockSolidSide(BlockState p_220056_0_, IBlockReader p_220056_1_, BlockPos p_220056_2_, Direction p_220056_3_) {
|
public static boolean hasBlockSolidSide(BlockState p_220056_0_, IBlockReader p_220056_1_, BlockPos p_220056_2_, Direction p_220056_3_) {
|
||||||
|
|
|
@ -228,7 +228,7 @@
|
||||||
"create.schematicAndQuill.noTarget": "Hold [Ctrl] to select Air blocks.",
|
"create.schematicAndQuill.noTarget": "Hold [Ctrl] to select Air blocks.",
|
||||||
"create.schematicAndQuill.abort": "Removed selection.",
|
"create.schematicAndQuill.abort": "Removed selection.",
|
||||||
"create.schematicAndQuill.title": "Schematic Name:",
|
"create.schematicAndQuill.title": "Schematic Name:",
|
||||||
"create.schematicAndQuill.convert": "Save and Deploy Immediately",
|
"create.schematicAndQuill.convert": "Save and Upload Immediately",
|
||||||
"create.schematicAndQuill.fallbackName": "My Schematic",
|
"create.schematicAndQuill.fallbackName": "My Schematic",
|
||||||
"create.schematicAndQuill.saved": "Saved as %1$s",
|
"create.schematicAndQuill.saved": "Saved as %1$s",
|
||||||
|
|
||||||
|
@ -244,12 +244,12 @@
|
||||||
"create.schematic.mirror.frontBack": "Front-Back",
|
"create.schematic.mirror.frontBack": "Front-Back",
|
||||||
"create.schematic.mirror.leftRight": "Left-Right",
|
"create.schematic.mirror.leftRight": "Left-Right",
|
||||||
|
|
||||||
"create.schematic.tool.deploy": "Deploy",
|
"create.schematic.tool.deploy": "Position",
|
||||||
"create.schematic.tool.move": "Move XZ",
|
"create.schematic.tool.move": "Move XZ",
|
||||||
"create.schematic.tool.movey": "Move Y",
|
"create.schematic.tool.movey": "Move Y",
|
||||||
"create.schematic.tool.rotate": "Rotate",
|
"create.schematic.tool.rotate": "Rotate",
|
||||||
"create.schematic.tool.print": "Print",
|
"create.schematic.tool.print": "Print",
|
||||||
"create.schematic.tool.flip": "Flip",
|
"create.schematic.tool.flip": "Mirror",
|
||||||
|
|
||||||
"create.schematic.tool.deploy.description.0": "Moves the structure to a location.",
|
"create.schematic.tool.deploy.description.0": "Moves the structure to a location.",
|
||||||
"create.schematic.tool.deploy.description.1": "Right-Click on the ground to place.",
|
"create.schematic.tool.deploy.description.1": "Right-Click on the ground to place.",
|
||||||
|
@ -329,7 +329,7 @@
|
||||||
"create.schematicannon.status.placing": "Placing",
|
"create.schematicannon.status.placing": "Placing",
|
||||||
"create.schematicannon.status.clearing": "Clearing Blocks",
|
"create.schematicannon.status.clearing": "Clearing Blocks",
|
||||||
"create.schematicannon.status.schematicInvalid": "Schematic Invalid",
|
"create.schematicannon.status.schematicInvalid": "Schematic Invalid",
|
||||||
"create.schematicannon.status.schematicNotPlaced": "Schematic Not Deployed",
|
"create.schematicannon.status.schematicNotPlaced": "Schematic not Positioned",
|
||||||
"create.schematicannon.status.schematicExpired": "Schematic File Expired",
|
"create.schematicannon.status.schematicExpired": "Schematic File Expired",
|
||||||
|
|
||||||
"create.materialChecklist": "Material Checklist",
|
"create.materialChecklist": "Material Checklist",
|
||||||
|
|
Loading…
Reference in a new issue