mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-05 01:45:00 +01:00
Check with Mates
- Clipboards can now be placed in the world
This commit is contained in:
parent
dc4ff5b26d
commit
e0fcc96bb2
33 changed files with 695 additions and 64 deletions
|
@ -51,6 +51,7 @@ ff1073a5451691c492102243084d92de42abfc26 assets/create/blockstates/calcite_pilla
|
|||
d01a750e6e8214ca8481e40aa69cedeb5c7210f8 assets/create/blockstates/cart_assembler.json
|
||||
470e8c6a9c37b91fa745bc4f6e9d3740bd72467e assets/create/blockstates/chocolate.json
|
||||
816c17d1f546d09bc4d7f2eac17a9d26d4a8f9ca assets/create/blockstates/chute.json
|
||||
948af9d46672221a5e404126c0427b9c9353944e assets/create/blockstates/clipboard.json
|
||||
4947c261310445fa55b92038326ac82967d192dd assets/create/blockstates/clockwork_bearing.json
|
||||
1f33834c685e3243882acfe20183fe64dfa872be assets/create/blockstates/clutch.json
|
||||
e5e3757e99c139d67b2a70288466d8a74d818841 assets/create/blockstates/cogwheel.json
|
||||
|
@ -577,8 +578,8 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo
|
|||
5616dda664dd106d576848124fc0fc1de18d0fd3 assets/create/blockstates/yellow_valve_handle.json
|
||||
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
|
||||
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
|
||||
11c1ebd001468641aacda3e4ed11995ed37853da assets/create/lang/en_ud.json
|
||||
ff4f0cd079e13fcc7eae4f8c9af2a455af019056 assets/create/lang/en_us.json
|
||||
ce9a5edbf3f6d35c11ce3894efb89d012a3e643b assets/create/lang/en_ud.json
|
||||
e19381716210baa2b86cd113017ab3ded998376f assets/create/lang/en_us.json
|
||||
487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json
|
||||
b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json
|
||||
3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 assets/create/models/block/acacia_window_pane_noside_alt.json
|
||||
|
@ -3277,6 +3278,7 @@ ce827895d9e1ac4ddb72a8228ec981c68d47a18e data/create/loot_tables/blocks/brown_to
|
|||
0730271bf0b0f648993e26aded5870588eb52588 data/create/loot_tables/blocks/calcite_pillar.json
|
||||
28cb11556296be42449dcd1c165c345adfb0eb82 data/create/loot_tables/blocks/cart_assembler.json
|
||||
1f748ab0b793350314446552693702874e34c910 data/create/loot_tables/blocks/chute.json
|
||||
374fc761ad454802cb3e7a484cfec94537b114d8 data/create/loot_tables/blocks/clipboard.json
|
||||
bd4ed53c029fcd6e5da7e43ebe4d15030d3fd9de data/create/loot_tables/blocks/clockwork_bearing.json
|
||||
8a5655e16f3da654e801cbfd81478c30180892a0 data/create/loot_tables/blocks/clutch.json
|
||||
982a41e1bccd9a130a2874aff995d4f7da0f0316 data/create/loot_tables/blocks/cogwheel.json
|
||||
|
@ -5288,7 +5290,7 @@ ee6d2b53d81f2bed492662b6c06f46c4f2b9ef9b data/create/tags/blocks/movable_empty_c
|
|||
6e5d3b2123fbb00e7f439c091623619502551bca data/create/tags/blocks/non_movable.json
|
||||
10781e8cfcbb3486327aace3aa00e437fb44b331 data/create/tags/blocks/ore_override_stone.json
|
||||
760adb521c2e475a6414f97291f46c02d294fa74 data/create/tags/blocks/passive_boiler_heaters.json
|
||||
ec0c664fa776b60b61ef8a8069355b6613b3b34f data/create/tags/blocks/safe_nbt.json
|
||||
af314e7ec90377e69387523a4c9af19e0056734e data/create/tags/blocks/safe_nbt.json
|
||||
6cdeeac1689f7b5bfd9bc40b462143d8eaf3ad0b data/create/tags/blocks/seats.json
|
||||
d063e12c9ef75f39518c6d129ea35d833464d547 data/create/tags/blocks/toolboxes.json
|
||||
9460e92c8e483446318b849abe7e6f52dcd4a269 data/create/tags/blocks/tree_attachments.json
|
||||
|
@ -5384,8 +5386,8 @@ e16d74571ae10007f06f3b86ddf05d3ca9b73559 data/minecraft/tags/blocks/doors.json
|
|||
2db7759fe036160c14c6ed19a68604ca16f4de60 data/minecraft/tags/blocks/dripstone_replaceable_blocks.json
|
||||
69f596fcb065e26b02ce246760432b5174191b76 data/minecraft/tags/blocks/impermeable.json
|
||||
2db7759fe036160c14c6ed19a68604ca16f4de60 data/minecraft/tags/blocks/lush_ground_replaceable.json
|
||||
d6b2543575bcedb3796dd681717dd6ac4d1399e6 data/minecraft/tags/blocks/mineable/axe.json
|
||||
90d279fe3866cca2717befb9d043c6677533685c data/minecraft/tags/blocks/mineable/pickaxe.json
|
||||
b477e815d5f38011414b67437c8e6ba16296eea9 data/minecraft/tags/blocks/mineable/axe.json
|
||||
9a18f38279c68dcddc7d976f97e740f3d49e4887 data/minecraft/tags/blocks/mineable/pickaxe.json
|
||||
2db7759fe036160c14c6ed19a68604ca16f4de60 data/minecraft/tags/blocks/moss_replaceable.json
|
||||
e157c1d3af30e409e34bbefbe15a037e6e1c8daa data/minecraft/tags/blocks/needs_iron_tool.json
|
||||
a08f67865337f62601c5e333b4011382d10020e4 data/minecraft/tags/blocks/needs_stone_tool.json
|
||||
|
|
216
src/generated/resources/assets/create/blockstates/clipboard.json
Normal file
216
src/generated/resources/assets/create/blockstates/clipboard.json
Normal file
|
@ -0,0 +1,216 @@
|
|||
{
|
||||
"variants": {
|
||||
"face=floor,facing=north,waterlogged=false,written=false": {
|
||||
"model": "create:block/clipboard/block_empty"
|
||||
},
|
||||
"face=wall,facing=north,waterlogged=false,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 90
|
||||
},
|
||||
"face=ceiling,facing=north,waterlogged=false,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 180,
|
||||
"y": 180
|
||||
},
|
||||
"face=floor,facing=south,waterlogged=false,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"y": 180
|
||||
},
|
||||
"face=wall,facing=south,waterlogged=false,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 90,
|
||||
"y": 180
|
||||
},
|
||||
"face=ceiling,facing=south,waterlogged=false,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 180
|
||||
},
|
||||
"face=floor,facing=west,waterlogged=false,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"y": 270
|
||||
},
|
||||
"face=wall,facing=west,waterlogged=false,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 90,
|
||||
"y": 270
|
||||
},
|
||||
"face=ceiling,facing=west,waterlogged=false,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 180,
|
||||
"y": 90
|
||||
},
|
||||
"face=floor,facing=east,waterlogged=false,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"y": 90
|
||||
},
|
||||
"face=wall,facing=east,waterlogged=false,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 90,
|
||||
"y": 90
|
||||
},
|
||||
"face=ceiling,facing=east,waterlogged=false,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 180,
|
||||
"y": 270
|
||||
},
|
||||
"face=floor,facing=north,waterlogged=true,written=false": {
|
||||
"model": "create:block/clipboard/block_empty"
|
||||
},
|
||||
"face=wall,facing=north,waterlogged=true,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 90
|
||||
},
|
||||
"face=ceiling,facing=north,waterlogged=true,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 180,
|
||||
"y": 180
|
||||
},
|
||||
"face=floor,facing=south,waterlogged=true,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"y": 180
|
||||
},
|
||||
"face=wall,facing=south,waterlogged=true,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 90,
|
||||
"y": 180
|
||||
},
|
||||
"face=ceiling,facing=south,waterlogged=true,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 180
|
||||
},
|
||||
"face=floor,facing=west,waterlogged=true,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"y": 270
|
||||
},
|
||||
"face=wall,facing=west,waterlogged=true,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 90,
|
||||
"y": 270
|
||||
},
|
||||
"face=ceiling,facing=west,waterlogged=true,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 180,
|
||||
"y": 90
|
||||
},
|
||||
"face=floor,facing=east,waterlogged=true,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"y": 90
|
||||
},
|
||||
"face=wall,facing=east,waterlogged=true,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 90,
|
||||
"y": 90
|
||||
},
|
||||
"face=ceiling,facing=east,waterlogged=true,written=false": {
|
||||
"model": "create:block/clipboard/block_empty",
|
||||
"x": 180,
|
||||
"y": 270
|
||||
},
|
||||
"face=floor,facing=north,waterlogged=false,written=true": {
|
||||
"model": "create:block/clipboard/block_written"
|
||||
},
|
||||
"face=wall,facing=north,waterlogged=false,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 90
|
||||
},
|
||||
"face=ceiling,facing=north,waterlogged=false,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 180,
|
||||
"y": 180
|
||||
},
|
||||
"face=floor,facing=south,waterlogged=false,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"y": 180
|
||||
},
|
||||
"face=wall,facing=south,waterlogged=false,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 90,
|
||||
"y": 180
|
||||
},
|
||||
"face=ceiling,facing=south,waterlogged=false,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 180
|
||||
},
|
||||
"face=floor,facing=west,waterlogged=false,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"y": 270
|
||||
},
|
||||
"face=wall,facing=west,waterlogged=false,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 90,
|
||||
"y": 270
|
||||
},
|
||||
"face=ceiling,facing=west,waterlogged=false,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 180,
|
||||
"y": 90
|
||||
},
|
||||
"face=floor,facing=east,waterlogged=false,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"y": 90
|
||||
},
|
||||
"face=wall,facing=east,waterlogged=false,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 90,
|
||||
"y": 90
|
||||
},
|
||||
"face=ceiling,facing=east,waterlogged=false,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 180,
|
||||
"y": 270
|
||||
},
|
||||
"face=floor,facing=north,waterlogged=true,written=true": {
|
||||
"model": "create:block/clipboard/block_written"
|
||||
},
|
||||
"face=wall,facing=north,waterlogged=true,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 90
|
||||
},
|
||||
"face=ceiling,facing=north,waterlogged=true,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 180,
|
||||
"y": 180
|
||||
},
|
||||
"face=floor,facing=south,waterlogged=true,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"y": 180
|
||||
},
|
||||
"face=wall,facing=south,waterlogged=true,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 90,
|
||||
"y": 180
|
||||
},
|
||||
"face=ceiling,facing=south,waterlogged=true,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 180
|
||||
},
|
||||
"face=floor,facing=west,waterlogged=true,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"y": 270
|
||||
},
|
||||
"face=wall,facing=west,waterlogged=true,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 90,
|
||||
"y": 270
|
||||
},
|
||||
"face=ceiling,facing=west,waterlogged=true,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 180,
|
||||
"y": 90
|
||||
},
|
||||
"face=floor,facing=east,waterlogged=true,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"y": 90
|
||||
},
|
||||
"face=wall,facing=east,waterlogged=true,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 90,
|
||||
"y": 90
|
||||
},
|
||||
"face=ceiling,facing=east,waterlogged=true,written=true": {
|
||||
"model": "create:block/clipboard/block_written",
|
||||
"x": 180,
|
||||
"y": 270
|
||||
}
|
||||
}
|
||||
}
|
|
@ -52,6 +52,7 @@
|
|||
"block.create.cart_assembler": "\u0279\u01DD\u05DFq\u026F\u01DDss\u2C6F \u0287\u0279\u0250\u0186",
|
||||
"block.create.chocolate": "\u01DD\u0287\u0250\u05DFo\u0254o\u0265\u0186",
|
||||
"block.create.chute": "\u01DD\u0287n\u0265\u0186",
|
||||
"block.create.clipboard": "p\u0279\u0250oqd\u0131\u05DF\u0186",
|
||||
"block.create.clockwork_bearing": "bu\u0131\u0279\u0250\u01DD\u15FA \u029E\u0279o\u028D\u029E\u0254o\u05DF\u0186",
|
||||
"block.create.clutch": "\u0265\u0254\u0287n\u05DF\u0186",
|
||||
"block.create.cogwheel": "\u05DF\u01DD\u01DD\u0265\u028Dbo\u0186",
|
||||
|
@ -606,7 +607,6 @@
|
|||
"item.create.chocolate_glazed_berries": "s\u01DD\u0131\u0279\u0279\u01DD\u15FA p\u01DDz\u0250\u05DF\u2141 \u01DD\u0287\u0250\u05DFo\u0254o\u0265\u0186",
|
||||
"item.create.chromatic_compound": "punod\u026Fo\u0186 \u0254\u0131\u0287\u0250\u026Fo\u0279\u0265\u0186",
|
||||
"item.create.cinder_flour": "\u0279no\u05DF\u2132 \u0279\u01DDpu\u0131\u0186",
|
||||
"item.create.clipboard": "p\u0279\u0250oqd\u0131\u05DF\u0186",
|
||||
"item.create.copper_backtank": "\u029Eu\u0250\u0287\u029E\u0254\u0250\u15FA \u0279\u01DDddo\u0186",
|
||||
"item.create.copper_backtank_placeable": "\u01DD\u05DFq\u0250\u01DD\u0254\u0250\u05DF\u0500 \u029Eu\u0250\u0287\u029E\u0254\u0250\u15FA \u0279\u01DDddo\u0186",
|
||||
"item.create.copper_diving_boots": "s\u0287oo\u15FA bu\u0131\u028C\u0131\u15E1 \u0279\u01DDddo\u0186",
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
"block.create.cart_assembler": "Cart Assembler",
|
||||
"block.create.chocolate": "Chocolate",
|
||||
"block.create.chute": "Chute",
|
||||
"block.create.clipboard": "Clipboard",
|
||||
"block.create.clockwork_bearing": "Clockwork Bearing",
|
||||
"block.create.clutch": "Clutch",
|
||||
"block.create.cogwheel": "Cogwheel",
|
||||
|
@ -613,7 +614,6 @@
|
|||
"item.create.chocolate_glazed_berries": "Chocolate Glazed Berries",
|
||||
"item.create.chromatic_compound": "Chromatic Compound",
|
||||
"item.create.cinder_flour": "Cinder Flour",
|
||||
"item.create.clipboard": "Clipboard",
|
||||
"item.create.copper_backtank": "Copper Backtank",
|
||||
"item.create.copper_backtank_placeable": "Copper Backtank Placeable",
|
||||
"item.create.copper_diving_boots": "Copper Diving Boots",
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"type": "minecraft:block"
|
||||
}
|
|
@ -25,6 +25,7 @@
|
|||
"create:placard",
|
||||
"create:pulse_repeater",
|
||||
"create:pulse_extender",
|
||||
"create:clipboard",
|
||||
"create:copycat_step",
|
||||
"create:copycat_panel",
|
||||
"#minecraft:banners",
|
||||
|
|
|
@ -110,6 +110,7 @@
|
|||
"create:redstone_link",
|
||||
"create:analog_lever",
|
||||
"create:lectern_controller",
|
||||
"create:clipboard",
|
||||
"create:copycat_step",
|
||||
"create:copycat_panel"
|
||||
]
|
||||
|
|
|
@ -163,6 +163,7 @@
|
|||
"create:netherite_backtank",
|
||||
"create:peculiar_bell",
|
||||
"create:haunted_bell",
|
||||
"create:clipboard",
|
||||
"create:andesite_ladder",
|
||||
"create:brass_ladder",
|
||||
"create:copper_ladder",
|
||||
|
|
|
@ -146,6 +146,7 @@ import com.simibubi.create.content.curiosities.armor.BacktankRenderer;
|
|||
import com.simibubi.create.content.curiosities.bell.BellRenderer;
|
||||
import com.simibubi.create.content.curiosities.bell.HauntedBellBlockEntity;
|
||||
import com.simibubi.create.content.curiosities.bell.PeculiarBellBlockEntity;
|
||||
import com.simibubi.create.content.curiosities.clipboard.ClipboardBlockEntity;
|
||||
import com.simibubi.create.content.curiosities.deco.PlacardBlockEntity;
|
||||
import com.simibubi.create.content.curiosities.deco.PlacardRenderer;
|
||||
import com.simibubi.create.content.curiosities.deco.SlidingDoorBlockEntity;
|
||||
|
@ -880,6 +881,11 @@ public class AllBlockEntityTypes {
|
|||
.renderer(() -> TrackObserverRenderer::new)
|
||||
.validBlocks(AllBlocks.TRACK_OBSERVER)
|
||||
.register();
|
||||
|
||||
public static final BlockEntityEntry<ClipboardBlockEntity> CLIPBOARD = REGISTRATE
|
||||
.blockEntity("clipboard", ClipboardBlockEntity::new)
|
||||
.validBlocks(AllBlocks.CLIPBOARD)
|
||||
.register();
|
||||
|
||||
public static void register() {}
|
||||
}
|
||||
|
|
|
@ -145,6 +145,9 @@ import com.simibubi.create.content.curiosities.armor.BacktankBlock;
|
|||
import com.simibubi.create.content.curiosities.bell.HauntedBellBlock;
|
||||
import com.simibubi.create.content.curiosities.bell.HauntedBellMovementBehaviour;
|
||||
import com.simibubi.create.content.curiosities.bell.PeculiarBellBlock;
|
||||
import com.simibubi.create.content.curiosities.clipboard.ClipboardBlock;
|
||||
import com.simibubi.create.content.curiosities.clipboard.ClipboardBlockItem;
|
||||
import com.simibubi.create.content.curiosities.clipboard.ClipboardOverrides;
|
||||
import com.simibubi.create.content.curiosities.deco.MetalLadderBlock;
|
||||
import com.simibubi.create.content.curiosities.deco.MetalScaffoldingBlock;
|
||||
import com.simibubi.create.content.curiosities.deco.PlacardBlock;
|
||||
|
@ -265,6 +268,7 @@ import net.minecraft.client.renderer.RenderType;
|
|||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.core.Direction.AxisDirection;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.data.loot.BlockLoot;
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
|
@ -2051,6 +2055,19 @@ public class AllBlocks {
|
|||
.register();
|
||||
});
|
||||
|
||||
public static final BlockEntry<ClipboardBlock> CLIPBOARD = REGISTRATE.block("clipboard", ClipboardBlock::new)
|
||||
.initialProperties(SharedProperties::wooden)
|
||||
.transform(axeOrPickaxe())
|
||||
.tag(AllBlockTags.SAFE_NBT.tag)
|
||||
.blockstate((c, p) -> p.horizontalFaceBlock(c.get(),
|
||||
s -> AssetLookup.partialBaseModel(c, p, s.getValue(ClipboardBlock.WRITTEN) ? "written" : "empty")))
|
||||
.loot((lt, b) -> lt.add(b, BlockLoot.noDrop()))
|
||||
.item(ClipboardBlockItem::new)
|
||||
.onRegister(ClipboardBlockItem::registerModelOverrides)
|
||||
.model((c, p) -> ClipboardOverrides.addOverrideModels(c, p))
|
||||
.build()
|
||||
.register();
|
||||
|
||||
// Materials
|
||||
|
||||
static {
|
||||
|
|
|
@ -39,7 +39,7 @@ import com.simibubi.create.content.curiosities.armor.BacktankItem;
|
|||
import com.simibubi.create.content.curiosities.armor.BacktankItem.BacktankBlockItem;
|
||||
import com.simibubi.create.content.curiosities.armor.DivingBootsItem;
|
||||
import com.simibubi.create.content.curiosities.armor.DivingHelmetItem;
|
||||
import com.simibubi.create.content.curiosities.clipboard.ClipboardItem;
|
||||
import com.simibubi.create.content.curiosities.clipboard.ClipboardBlockItem;
|
||||
import com.simibubi.create.content.curiosities.clipboard.ClipboardOverrides;
|
||||
import com.simibubi.create.content.curiosities.symmetry.SymmetryWandItem;
|
||||
import com.simibubi.create.content.curiosities.tools.BlueprintItem;
|
||||
|
@ -74,11 +74,6 @@ public class AllItems {
|
|||
REGISTRATE.creativeModeTab(() -> AllCreativeModeTabs.BASE_CREATIVE_TAB);
|
||||
}
|
||||
|
||||
public static final ItemEntry<ClipboardItem> CLIPBOARD = REGISTRATE.item("clipboard", ClipboardItem::new)
|
||||
.onRegister(ClipboardItem::registerModelOverrides)
|
||||
.model((c, p) -> ClipboardOverrides.addOverrideModels(c, p))
|
||||
.register();
|
||||
|
||||
public static final ItemEntry<Item> WHEAT_FLOUR =
|
||||
taggedIngredient("wheat_flour", forgeItemTag("flour/wheat"), forgeItemTag("flour")),
|
||||
DOUGH = taggedIngredient("dough", forgeItemTag("dough"), forgeItemTag("dough/wheat")),
|
||||
|
|
|
@ -161,6 +161,10 @@ public class AllShapes {
|
|||
.forHorizontal(SOUTH),
|
||||
|
||||
PLACARD = shape(2, 0, 2, 14, 3, 14).forDirectional(UP),
|
||||
|
||||
CLIPBOARD_FLOOR = shape(3, 0, 1, 13, 1, 15).forHorizontal(SOUTH),
|
||||
CLIPBOARD_CEILING = shape(3, 15, 1, 13, 16, 15).forHorizontal(SOUTH),
|
||||
CLIPBOARD_WALL = shape(3, 1, 0, 13, 15, 1).forHorizontal(SOUTH),
|
||||
|
||||
TRACK_ORTHO = shape(TrackVoxelShapes.orthogonal()).forHorizontal(NORTH),
|
||||
TRACK_ASC = shape(TrackVoxelShapes.ascending()).forHorizontal(SOUTH),
|
||||
|
|
|
@ -0,0 +1,171 @@
|
|||
package com.simibubi.create.content.curiosities.clipboard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.simibubi.create.AllBlockEntityTypes;
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
|
||||
import com.simibubi.create.foundation.gui.ScreenOpener;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
|
||||
import net.minecraft.world.level.block.ShulkerBoxBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition.Builder;
|
||||
import net.minecraft.world.level.block.state.properties.AttachFace;
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
|
||||
public class ClipboardBlock extends FaceAttachedHorizontalDirectionalBlock
|
||||
implements IBE<ClipboardBlockEntity>, IWrenchable, ProperWaterloggedBlock {
|
||||
|
||||
public static final BooleanProperty WRITTEN = BooleanProperty.create("written");
|
||||
|
||||
public ClipboardBlock(Properties pProperties) {
|
||||
super(pProperties);
|
||||
registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false)
|
||||
.setValue(WRITTEN, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createBlockStateDefinition(Builder<Block, BlockState> pBuilder) {
|
||||
super.createBlockStateDefinition(pBuilder.add(WRITTEN, FACE, FACING, WATERLOGGED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
|
||||
BlockState stateForPlacement = super.getStateForPlacement(pContext);
|
||||
if (stateForPlacement.getValue(FACE) != AttachFace.WALL)
|
||||
stateForPlacement = stateForPlacement.setValue(FACING, stateForPlacement.getValue(FACING)
|
||||
.getOpposite());
|
||||
return withWater(stateForPlacement, pContext).setValue(WRITTEN, pContext.getItemInHand()
|
||||
.hasTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) {
|
||||
return (switch (pState.getValue(FACE)) {
|
||||
case FLOOR -> AllShapes.CLIPBOARD_FLOOR;
|
||||
case CEILING -> AllShapes.CLIPBOARD_CEILING;
|
||||
default -> AllShapes.CLIPBOARD_WALL;
|
||||
}).get(pState.getValue(FACING));
|
||||
}
|
||||
|
||||
public boolean canSurvive(BlockState pState, LevelReader pLevel, BlockPos pPos) {
|
||||
return !pLevel.getBlockState(pPos.relative(getConnectedDirection(pState).getOpposite()))
|
||||
.getMaterial()
|
||||
.isReplaceable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand,
|
||||
BlockHitResult pHit) {
|
||||
if (pPlayer.isSteppingCarefully()) {
|
||||
breakAndCollect(pState, pLevel, pPos, pPlayer);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
return onBlockEntityUse(pLevel, pPos, cbe -> {
|
||||
if (pLevel.isClientSide())
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> openScreen(pPlayer, cbe.dataContainer, pPos));
|
||||
return InteractionResult.SUCCESS;
|
||||
});
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private void openScreen(Player player, ItemStack stack, BlockPos pos) {
|
||||
if (Minecraft.getInstance().player == player)
|
||||
ScreenOpener.open(new ClipboardScreen(player.getInventory().selected, stack, pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer) {
|
||||
breakAndCollect(pState, pLevel, pPos, pPlayer);
|
||||
}
|
||||
|
||||
private void breakAndCollect(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer) {
|
||||
if (pPlayer instanceof FakePlayer)
|
||||
return;
|
||||
if (pLevel.isClientSide)
|
||||
return;
|
||||
ItemStack cloneItemStack = getCloneItemStack(pLevel, pPos, pState);
|
||||
pLevel.destroyBlock(pPos, false);
|
||||
if (pLevel.getBlockState(pPos) != pState)
|
||||
pPlayer.getInventory()
|
||||
.placeItemBackInInventory(cloneItemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCloneItemStack(BlockGetter world, BlockPos pos, BlockState state) {
|
||||
if (world.getBlockEntity(pos) instanceof ClipboardBlockEntity cbe)
|
||||
return cbe.dataContainer;
|
||||
return new ItemStack(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playerWillDestroy(Level pLevel, BlockPos pPos, BlockState pState, Player pPlayer) {
|
||||
if (!(pLevel.getBlockEntity(pPos) instanceof ClipboardBlockEntity cbe))
|
||||
return;
|
||||
if (pLevel.isClientSide || pPlayer.isCreative())
|
||||
return;
|
||||
Block.popResource(pLevel, pPos, cbe.dataContainer.copy());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState pState, LootContext.Builder pBuilder) {
|
||||
if (!(pBuilder.getOptionalParameter(LootContextParams.BLOCK_ENTITY) instanceof ClipboardBlockEntity cbe))
|
||||
return super.getDrops(pState, pBuilder);
|
||||
pBuilder.withDynamicDrop(ShulkerBoxBlock.CONTENTS,
|
||||
(p_56218_, p_56219_) -> p_56219_.accept(cbe.dataContainer.copy()));
|
||||
return ImmutableList.of(cbe.dataContainer.copy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidState getFluidState(BlockState pState) {
|
||||
return fluidState(pState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState updateShape(BlockState pState, Direction pFacing, BlockState pFacingState, LevelAccessor pLevel,
|
||||
BlockPos pCurrentPos, BlockPos pFacingPos) {
|
||||
updateWater(pLevel, pState, pCurrentPos);
|
||||
return super.updateShape(pState, pFacing, pFacingState, pLevel, pCurrentPos, pFacingPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ClipboardBlockEntity> getBlockEntityClass() {
|
||||
return ClipboardBlockEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<? extends ClipboardBlockEntity> getBlockEntityType() {
|
||||
return AllBlockEntityTypes.CLIPBOARD.get();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.simibubi.create.content.curiosities.clipboard;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.blockEntity.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
|
||||
public class ClipboardBlockEntity extends SmartBlockEntity {
|
||||
|
||||
public ItemStack dataContainer;
|
||||
private UUID lastEdit;
|
||||
|
||||
public ClipboardBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
dataContainer = AllBlocks.CLIPBOARD.asStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
super.initialize();
|
||||
updateWrittenState();
|
||||
}
|
||||
|
||||
public void onEditedBy(Player player) {
|
||||
lastEdit = player.getUUID();
|
||||
notifyUpdate();
|
||||
updateWrittenState();
|
||||
}
|
||||
|
||||
public void updateWrittenState() {
|
||||
BlockState blockState = getBlockState();
|
||||
if (!AllBlocks.CLIPBOARD.has(blockState))
|
||||
return;
|
||||
if (level.isClientSide())
|
||||
return;
|
||||
boolean isWritten = blockState.getValue(ClipboardBlock.WRITTEN);
|
||||
boolean shouldBeWritten = dataContainer.getTag() != null;
|
||||
if (isWritten == shouldBeWritten)
|
||||
return;
|
||||
level.setBlockAndUpdate(worldPosition, blockState.setValue(ClipboardBlock.WRITTEN, shouldBeWritten));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {}
|
||||
|
||||
@Override
|
||||
protected void write(CompoundTag tag, boolean clientPacket) {
|
||||
super.write(tag, clientPacket);
|
||||
tag.put("Item", dataContainer.serializeNBT());
|
||||
if (clientPacket && lastEdit != null)
|
||||
tag.putUUID("LastEdit", lastEdit);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void read(CompoundTag tag, boolean clientPacket) {
|
||||
super.read(tag, clientPacket);
|
||||
dataContainer = ItemStack.of(tag.getCompound("Item"));
|
||||
|
||||
if (clientPacket)
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> readClientSide(tag));
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private void readClientSide(CompoundTag tag) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (!(mc.screen instanceof ClipboardScreen cs))
|
||||
return;
|
||||
if (tag.contains("LastEdit") && tag.getUUID("LastEdit")
|
||||
.equals(mc.player.getUUID()))
|
||||
return;
|
||||
if (!worldPosition.equals(cs.targetedBlock))
|
||||
return;
|
||||
cs.reopenWith(dataContainer);
|
||||
}
|
||||
|
||||
}
|
|
@ -5,31 +5,50 @@ import javax.annotation.Nonnull;
|
|||
import com.simibubi.create.foundation.gui.ScreenOpener;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
public class ClipboardItem extends Item {
|
||||
public class ClipboardBlockItem extends BlockItem {
|
||||
|
||||
public ClipboardItem(Properties pProperties) {
|
||||
super(pProperties);
|
||||
public ClipboardBlockItem(Block pBlock, Properties pProperties) {
|
||||
super(pBlock, pProperties);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public InteractionResult useOn(UseOnContext context) {
|
||||
if (context.getPlayer() == null)
|
||||
Player player = context.getPlayer();
|
||||
if (player == null)
|
||||
return InteractionResult.PASS;
|
||||
return use(context.getLevel(), context.getPlayer(), context.getHand()).getResult();
|
||||
if (player.isSteppingCarefully())
|
||||
return super.useOn(context);
|
||||
return use(context.getLevel(), player, context.getHand()).getResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean updateCustomBlockEntityTag(BlockPos pPos, Level pLevel, Player pPlayer, ItemStack pStack,
|
||||
BlockState pState) {
|
||||
if (pLevel.isClientSide())
|
||||
return false;
|
||||
if (!(pLevel.getBlockEntity(pPos) instanceof ClipboardBlockEntity cbe))
|
||||
return false;
|
||||
cbe.dataContainer = ItemHandlerHelper.copyStackWithSize(pStack, 1);
|
||||
cbe.notifyUpdate();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,14 +64,14 @@ public class ClipboardItem extends Item {
|
|||
CompoundTag tag = heldItem.getOrCreateTag();
|
||||
tag.putInt("Type", ClipboardOverrides.ClipboardType.EDITING.ordinal());
|
||||
heldItem.setTag(tag);
|
||||
|
||||
|
||||
return InteractionResultHolder.success(heldItem);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private void openScreen(Player player, ItemStack stack) {
|
||||
if (Minecraft.getInstance().player == player)
|
||||
ScreenOpener.open(new ClipboardScreen(player.getInventory().selected, stack));
|
||||
ScreenOpener.open(new ClipboardScreen(player.getInventory().selected, stack, null));
|
||||
}
|
||||
|
||||
public void registerModelOverrides() {
|
|
@ -1,41 +1,66 @@
|
|||
package com.simibubi.create.content.curiosities.clipboard;
|
||||
|
||||
import com.simibubi.create.AllItems;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.network.NetworkEvent.Context;
|
||||
|
||||
public class ClipboardEditPacket extends SimplePacketBase {
|
||||
|
||||
private int hotbarSlot;
|
||||
private CompoundTag data;
|
||||
private BlockPos targetedBlock;
|
||||
|
||||
public ClipboardEditPacket(int hotbarSlot, CompoundTag data) {
|
||||
public ClipboardEditPacket(int hotbarSlot, CompoundTag data, @Nullable BlockPos targetedBlock) {
|
||||
this.hotbarSlot = hotbarSlot;
|
||||
this.data = data;
|
||||
this.targetedBlock = targetedBlock;
|
||||
}
|
||||
|
||||
public ClipboardEditPacket(FriendlyByteBuf buffer) {
|
||||
hotbarSlot = buffer.readVarInt();
|
||||
data = buffer.readNbt();
|
||||
if (buffer.readBoolean())
|
||||
targetedBlock = buffer.readBlockPos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buffer) {
|
||||
buffer.writeVarInt(hotbarSlot);
|
||||
buffer.writeNbt(data);
|
||||
buffer.writeBoolean(targetedBlock != null);
|
||||
if (targetedBlock != null)
|
||||
buffer.writeBlockPos(targetedBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Context context) {
|
||||
ServerPlayer sender = context.getSender();
|
||||
|
||||
if (targetedBlock != null) {
|
||||
Level world = sender.level;
|
||||
if (world == null || !world.isLoaded(targetedBlock))
|
||||
return true;
|
||||
if (!targetedBlock.closerThan(sender.blockPosition(), 20))
|
||||
return true;
|
||||
if (world.getBlockEntity(targetedBlock) instanceof ClipboardBlockEntity cbe) {
|
||||
cbe.dataContainer.setTag(data.isEmpty() ? null : data);
|
||||
cbe.onEditedBy(sender);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemStack itemStack = sender.getInventory()
|
||||
.getItem(hotbarSlot);
|
||||
if (!AllItems.CLIPBOARD.isIn(itemStack))
|
||||
if (!AllBlocks.CLIPBOARD.isIn(itemStack))
|
||||
return true;
|
||||
itemStack.setTag(data.isEmpty() ? null : data);
|
||||
return true;
|
||||
|
|
|
@ -33,14 +33,14 @@ public class ClipboardOverrides {
|
|||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void registerModelOverridesClient(ClipboardItem item) {
|
||||
public static void registerModelOverridesClient(ClipboardBlockItem item) {
|
||||
ItemProperties.register(item, ClipboardType.ID, (pStack, pLevel, pEntity, pSeed) -> {
|
||||
CompoundTag tag = pStack.getTag();
|
||||
return tag == null ? 0 : tag.getInt("Type");
|
||||
});
|
||||
}
|
||||
|
||||
public static ItemModelBuilder addOverrideModels(DataGenContext<Item, ClipboardItem> c,
|
||||
public static ItemModelBuilder addOverrideModels(DataGenContext<Item, ClipboardBlockItem> c,
|
||||
RegistrateItemModelProvider p) {
|
||||
ItemModelBuilder builder = p.generated(() -> c.get());
|
||||
for (int i = 0; i < ClipboardType.values().length; i++) {
|
||||
|
|
|
@ -4,6 +4,8 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.mutable.MutableBoolean;
|
||||
import org.apache.commons.lang3.mutable.MutableInt;
|
||||
|
@ -16,6 +18,7 @@ import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.Tesselator;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.curiosities.clipboard.ClipboardOverrides.ClipboardType;
|
||||
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
|
@ -35,8 +38,10 @@ import net.minecraft.client.gui.GuiComponent;
|
|||
import net.minecraft.client.gui.font.TextFieldHelper;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.inventory.PageButton;
|
||||
import net.minecraft.client.multiplayer.ClientPacketListener;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.Rect2i;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.Style;
|
||||
|
@ -50,7 +55,8 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
|
||||
public class ClipboardScreen extends AbstractSimiScreen {
|
||||
|
||||
private ItemStack item;
|
||||
public ItemStack item;
|
||||
public BlockPos targetedBlock;
|
||||
|
||||
List<List<ClipboardEntry>> pages;
|
||||
List<ClipboardEntry> currentEntries;
|
||||
|
@ -74,16 +80,23 @@ public class ClipboardScreen extends AbstractSimiScreen {
|
|||
|
||||
private int targetSlot;
|
||||
|
||||
public ClipboardScreen(int targetSlot, ItemStack item) {
|
||||
public ClipboardScreen(int targetSlot, ItemStack item, @Nullable BlockPos pos) {
|
||||
this.targetSlot = targetSlot;
|
||||
this.item = item;
|
||||
this.targetedBlock = pos;
|
||||
reopenWith(item);
|
||||
}
|
||||
|
||||
public void reopenWith(ItemStack clipboard) {
|
||||
item = clipboard;
|
||||
pages = ClipboardEntry.readAll(item);
|
||||
if (pages.isEmpty())
|
||||
pages.add(new ArrayList<>());
|
||||
currentPage = item.getTag() == null ? 0
|
||||
: item.getTag()
|
||||
.getInt("PreviouslyOpenedPage");
|
||||
currentPage = Mth.clamp(currentPage, 0, pages.size() - 1);
|
||||
if (clearBtn == null) {
|
||||
currentPage = item.getTag() == null ? 0
|
||||
: item.getTag()
|
||||
.getInt("PreviouslyOpenedPage");
|
||||
currentPage = Mth.clamp(currentPage, 0, pages.size() - 1);
|
||||
}
|
||||
currentEntries = pages.get(currentPage);
|
||||
boolean startEmpty = currentEntries.isEmpty();
|
||||
if (startEmpty)
|
||||
|
@ -96,6 +109,8 @@ public class ClipboardScreen extends AbstractSimiScreen {
|
|||
.getBoolean("Readonly");
|
||||
if (readonly)
|
||||
editingIndex = -1;
|
||||
if (clearBtn != null)
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -114,6 +129,7 @@ public class ClipboardScreen extends AbstractSimiScreen {
|
|||
currentEntries.removeIf(ce -> ce.checked);
|
||||
if (currentEntries.isEmpty())
|
||||
currentEntries.add(new ClipboardEntry(false, Components.empty()));
|
||||
sendIfEditingBlock();
|
||||
});
|
||||
clearBtn.setToolTip(Lang.translateDirect("gui.clipboard.erase_checked"));
|
||||
closeBtn = new IconButton(x + 234, y + 175, AllIcons.I_PRIORITY_VERY_LOW)
|
||||
|
@ -139,6 +155,18 @@ public class ClipboardScreen extends AbstractSimiScreen {
|
|||
super.tick();
|
||||
frameTick++;
|
||||
|
||||
if (targetedBlock != null) {
|
||||
if (!minecraft.player.blockPosition()
|
||||
.closerThan(targetedBlock, 10)) {
|
||||
removed();
|
||||
return;
|
||||
}
|
||||
if (!AllBlocks.CLIPBOARD.has(minecraft.level.getBlockState(targetedBlock))) {
|
||||
removed();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int mx = (int) (this.minecraft.mouseHandler.xpos() * (double) this.minecraft.getWindow()
|
||||
.getGuiScaledWidth() / (double) this.minecraft.getWindow()
|
||||
.getScreenWidth());
|
||||
|
@ -177,6 +205,7 @@ public class ClipboardScreen extends AbstractSimiScreen {
|
|||
|
||||
private void setCurrentEntryText(String text) {
|
||||
currentEntries.get(editingIndex).text = Components.literal(text);
|
||||
sendIfEditingBlock();
|
||||
}
|
||||
|
||||
private void setClipboard(String p_98148_) {
|
||||
|
@ -303,26 +332,37 @@ public class ClipboardScreen extends AbstractSimiScreen {
|
|||
.isBlank()));
|
||||
pages.removeIf(List::isEmpty);
|
||||
|
||||
ClipboardEntry.saveAll(pages, item);
|
||||
ClipboardOverrides.switchTo(ClipboardType.WRITTEN, item);
|
||||
|
||||
for (int i = 0; i < pages.size(); i++)
|
||||
if (pages.get(i) == currentEntries)
|
||||
item.getTag()
|
||||
item.getOrCreateTag()
|
||||
.putInt("PreviouslyOpenedPage", i);
|
||||
|
||||
send();
|
||||
|
||||
super.removed();
|
||||
}
|
||||
|
||||
private void sendIfEditingBlock() {
|
||||
ClientPacketListener handler = minecraft.player.connection;
|
||||
if (handler.getOnlinePlayers()
|
||||
.size() > 1 && targetedBlock != null)
|
||||
send();
|
||||
}
|
||||
|
||||
private void send() {
|
||||
ClipboardEntry.saveAll(pages, item);
|
||||
ClipboardOverrides.switchTo(ClipboardType.WRITTEN, item);
|
||||
if (pages.isEmpty())
|
||||
item.setTag(new CompoundTag());
|
||||
AllPackets.getChannel()
|
||||
.sendToServer(new ClipboardEditPacket(targetSlot, item.getOrCreateTag()));
|
||||
super.removed();
|
||||
.sendToServer(new ClipboardEditPacket(targetSlot, item.getOrCreateTag(), targetedBlock));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPauseScreen() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(double pMouseX, double pMouseY, double pDelta) {
|
||||
changePage(pDelta < 0);
|
||||
|
@ -546,6 +586,7 @@ public class ClipboardScreen extends AbstractSimiScreen {
|
|||
editingIndex = -1;
|
||||
if (hoveredEntry < currentEntries.size())
|
||||
currentEntries.get(hoveredEntry).checked ^= true;
|
||||
sendIfEditingBlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.curiosities.clipboard.ClipboardOverrides.ClipboardType;
|
||||
import com.simibubi.create.content.logistics.trains.track.TrackBlockOutline;
|
||||
|
@ -51,7 +51,7 @@ public class ClipboardValueSettingsHandler {
|
|||
if (!mc.level.getWorldBorder()
|
||||
.isWithinBounds(pos))
|
||||
return;
|
||||
if (!AllItems.CLIPBOARD.isIn(mc.player.getMainHandItem()))
|
||||
if (!AllBlocks.CLIPBOARD.isIn(mc.player.getMainHandItem()))
|
||||
return;
|
||||
if (!(mc.level.getBlockEntity(pos) instanceof SmartBlockEntity smartBE))
|
||||
return;
|
||||
|
@ -85,7 +85,7 @@ public class ClipboardValueSettingsHandler {
|
|||
Minecraft mc = Minecraft.getInstance();
|
||||
if (!(mc.hitResult instanceof BlockHitResult target))
|
||||
return;
|
||||
if (!AllItems.CLIPBOARD.isIn(mc.player.getMainHandItem()))
|
||||
if (!AllBlocks.CLIPBOARD.isIn(mc.player.getMainHandItem()))
|
||||
return;
|
||||
BlockPos pos = target.getBlockPos();
|
||||
if (!(mc.level.getBlockEntity(pos) instanceof SmartBlockEntity smartBE))
|
||||
|
@ -133,7 +133,7 @@ public class ClipboardValueSettingsHandler {
|
|||
|
||||
private static void interact(PlayerInteractEvent event, boolean paste) {
|
||||
ItemStack itemStack = event.getItemStack();
|
||||
if (!AllItems.CLIPBOARD.isIn(itemStack))
|
||||
if (!AllBlocks.CLIPBOARD.isIn(itemStack))
|
||||
return;
|
||||
|
||||
BlockPos pos = event.getPos();
|
||||
|
@ -141,6 +141,8 @@ public class ClipboardValueSettingsHandler {
|
|||
Player player = event.getPlayer();
|
||||
if (player != null && player.isSpectator())
|
||||
return;
|
||||
if (player.isSteppingCarefully())
|
||||
return;
|
||||
if (!(world.getBlockEntity(pos) instanceof SmartBlockEntity smartBE))
|
||||
return;
|
||||
CompoundTag tag = itemStack.getTagElement("CopiedValues");
|
||||
|
|
|
@ -8,7 +8,6 @@ import java.util.function.BiConsumer;
|
|||
|
||||
import com.simibubi.create.AllBlockEntityTypes;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||
import com.simibubi.create.content.curiosities.clipboard.ClipboardEntry;
|
||||
|
@ -81,7 +80,7 @@ public class NixieTubeBlock extends DoubleFaceAttachedBlock
|
|||
}
|
||||
|
||||
boolean display =
|
||||
heldItem.getItem() == Items.NAME_TAG && heldItem.hasCustomHoverName() || AllItems.CLIPBOARD.isIn(heldItem);
|
||||
heldItem.getItem() == Items.NAME_TAG && heldItem.hasCustomHoverName() || AllBlocks.CLIPBOARD.isIn(heldItem);
|
||||
DyeColor dye = DyeColor.getColor(heldItem);
|
||||
|
||||
if (!display && dye == null)
|
||||
|
@ -90,7 +89,7 @@ public class NixieTubeBlock extends DoubleFaceAttachedBlock
|
|||
CompoundTag tag = heldItem.getTagElement("display");
|
||||
String tagElement = tag != null && tag.contains("Name", Tag.TAG_STRING) ? tag.getString("Name") : null;
|
||||
|
||||
if (AllItems.CLIPBOARD.isIn(heldItem)) {
|
||||
if (AllBlocks.CLIPBOARD.isIn(heldItem)) {
|
||||
List<ClipboardEntry> entries = ClipboardEntry.getLastViewedEntries(heldItem);
|
||||
for (int i = 0; i < entries.size();) {
|
||||
tagElement = Component.Serializer.toJson(entries.get(i).text);
|
||||
|
|
|
@ -8,7 +8,6 @@ import java.util.function.Predicate;
|
|||
|
||||
import com.simibubi.create.AllBlockEntityTypes;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock;
|
||||
import com.simibubi.create.content.contraptions.base.KineticBlockEntity;
|
||||
|
@ -163,7 +162,7 @@ public class FlapDisplayBlock extends HorizontalKineticBlock
|
|||
}
|
||||
|
||||
boolean display =
|
||||
heldItem.getItem() == Items.NAME_TAG && heldItem.hasCustomHoverName() || AllItems.CLIPBOARD.isIn(heldItem);
|
||||
heldItem.getItem() == Items.NAME_TAG && heldItem.hasCustomHoverName() || AllBlocks.CLIPBOARD.isIn(heldItem);
|
||||
DyeColor dye = DyeColor.getColor(heldItem);
|
||||
|
||||
if (!display && dye == null)
|
||||
|
@ -177,7 +176,7 @@ public class FlapDisplayBlock extends HorizontalKineticBlock
|
|||
String tagElement = tag != null && tag.contains("Name", Tag.TAG_STRING) ? tag.getString("Name") : null;
|
||||
|
||||
if (display) {
|
||||
if (AllItems.CLIPBOARD.isIn(heldItem)) {
|
||||
if (AllBlocks.CLIPBOARD.isIn(heldItem)) {
|
||||
List<ClipboardEntry> entries = ClipboardEntry.getLastViewedEntries(heldItem);
|
||||
int line = lineIndex;
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.curiosities.clipboard.ClipboardEntry;
|
||||
import com.simibubi.create.content.curiosities.clipboard.ClipboardOverrides;
|
||||
import com.simibubi.create.content.curiosities.clipboard.ClipboardOverrides.ClipboardType;
|
||||
|
@ -156,7 +156,7 @@ public class MaterialChecklist {
|
|||
}
|
||||
|
||||
public ItemStack createWrittenClipboard() {
|
||||
ItemStack clipboard = AllItems.CLIPBOARD.asStack();
|
||||
ItemStack clipboard = AllBlocks.CLIPBOARD.asStack();
|
||||
CompoundTag tag = clipboard.getOrCreateTag();
|
||||
int itemsWritten = 0;
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import com.simibubi.create.AllTags.AllBlockTags;
|
|||
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.BeltBlockEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.BeltBlockEntity.CasingType;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.BeltHelper;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.BeltPart;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.BeltSlope;
|
||||
import com.simibubi.create.content.contraptions.relays.elementary.AbstractSimpleShaftBlock;
|
||||
|
@ -704,7 +703,7 @@ public class SchematicannonBlockEntity extends SmartBlockEntity implements MenuP
|
|||
|
||||
dontUpdateChecklist = true;
|
||||
ItemStack extractItem = inventory.extractItem(BookInput, 1, false);
|
||||
ItemStack stack = AllItems.CLIPBOARD.isIn(extractItem) ? checklist.createWrittenClipboard()
|
||||
ItemStack stack = AllBlocks.CLIPBOARD.isIn(extractItem) ? checklist.createWrittenClipboard()
|
||||
: checklist.createWrittenBook();
|
||||
stack.setCount(inventory.getStackInSlot(BookOutput)
|
||||
.getCount() + 1);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.simibubi.create.content.schematics.block;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -28,7 +29,7 @@ public class SchematicannonInventory extends ItemStackHandler {
|
|||
case 1: // Blueprint output
|
||||
return false;
|
||||
case 2: // Book input
|
||||
return AllItems.CLIPBOARD.isIn(stack) || stack.sameItem(new ItemStack(Items.BOOK))
|
||||
return AllBlocks.CLIPBOARD.isIn(stack) || stack.sameItem(new ItemStack(Items.BOOK))
|
||||
|| stack.sameItem(new ItemStack(Items.WRITTEN_BOOK));
|
||||
case 3: // Material List output
|
||||
return false;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.foundation.blockEntity.behaviour;
|
|||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.blockEntity.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.gui.ScreenOpener;
|
||||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
|
@ -70,7 +70,7 @@ public class ValueSettingsClient implements IIngameOverlay {
|
|||
return;
|
||||
Player player = mc.player;
|
||||
|
||||
if (!ValueSettingsInputHandler.canInteract(player) || AllItems.CLIPBOARD.isIn(player.getMainHandItem())) {
|
||||
if (!ValueSettingsInputHandler.canInteract(player) || AllBlocks.CLIPBOARD.isIn(player.getMainHandItem())) {
|
||||
cancelInteraction();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.foundation.blockEntity.behaviour;
|
||||
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllTags.AllItemTags;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.foundation.blockEntity.BlockEntityBehaviour;
|
||||
|
@ -34,7 +34,7 @@ public class ValueSettingsInputHandler {
|
|||
|
||||
if (!canInteract(player))
|
||||
return;
|
||||
if (AllItems.CLIPBOARD.isIn(player.getMainHandItem()))
|
||||
if (AllBlocks.CLIPBOARD.isIn(player.getMainHandItem()))
|
||||
return;
|
||||
if (!(world.getBlockEntity(pos)instanceof SmartBlockEntity sbe))
|
||||
return;
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllSpecialTextures;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.logistics.item.filter.FilterItem;
|
||||
|
@ -81,7 +80,7 @@ public class FilteringRenderer {
|
|||
AABB bb = isFilterSlotted ? emptyBB.inflate(.45f, .31f, .2f) : emptyBB.inflate(.25f);
|
||||
|
||||
ValueBox box = new ItemValueBox(label, bb, pos, filter, showCount ? behaviour.count : -1, behaviour.upTo);
|
||||
box.passive(!hit || AllItems.CLIPBOARD.isIn(mainhandItem));
|
||||
box.passive(!hit || AllBlocks.CLIPBOARD.isIn(mainhandItem));
|
||||
|
||||
CreateClient.OUTLINER.showValueBox(Pair.of("filter", pos), box.transform(behaviour.slotPositioning))
|
||||
.lineWidth(1 / 64f)
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.foundation.blockEntity.behaviour.scrollvalue;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllKeys;
|
||||
import com.simibubi.create.CreateClient;
|
||||
|
@ -48,7 +49,7 @@ public class ScrollValueRenderer {
|
|||
return;
|
||||
}
|
||||
ItemStack mainhandItem = mc.player.getItemInHand(InteractionHand.MAIN_HAND);
|
||||
boolean clipboard = AllItems.CLIPBOARD.isIn(mainhandItem);
|
||||
boolean clipboard = AllBlocks.CLIPBOARD.isIn(mainhandItem);
|
||||
if (behaviour.needsWrench && !AllItems.WRENCH.isIn(mainhandItem) && !clipboard)
|
||||
return;
|
||||
boolean highlight = behaviour.testHit(target.getLocation()) && !clipboard;
|
||||
|
|
|
@ -1022,7 +1022,7 @@ public class StandardRecipeGen extends CreateRecipeProvider {
|
|||
.viaShapeless(b -> b.requires(I.wheatFlour())
|
||||
.requires(Items.WATER_BUCKET)),
|
||||
|
||||
CLIPBOARD = create(AllItems.CLIPBOARD).unlockedBy(I::andesite)
|
||||
CLIPBOARD = create(AllBlocks.CLIPBOARD).unlockedBy(I::andesite)
|
||||
.viaShaped(b -> b.define('G', I.planks())
|
||||
.define('P', Items.PAPER)
|
||||
.define('A', I.andesite())
|
||||
|
@ -1030,7 +1030,7 @@ public class StandardRecipeGen extends CreateRecipeProvider {
|
|||
.pattern("P")
|
||||
.pattern("G")),
|
||||
|
||||
CLIPBOARD_CLEAR = clearData(AllItems.CLIPBOARD),
|
||||
CLIPBOARD_CLEAR = clearData(AllBlocks.CLIPBOARD),
|
||||
SCHEDULE_CLEAR = clearData(AllItems.SCHEDULE),
|
||||
FILTER_CLEAR = clearData(AllItems.FILTER),
|
||||
ATTRIBUTE_FILTER_CLEAR = clearData(AllItems.ATTRIBUTE_FILTER),
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"ambientocclusion": false,
|
||||
"textures": {
|
||||
"0": "create:block/clipboard_model_blank",
|
||||
"1": "create:block/belt/andesite_belt_casing",
|
||||
"particle": "create:block/clipboard_model_blank"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [3, 0, 1],
|
||||
"to": [13, 1, 15],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [16, 16, 0]},
|
||||
"faces": {
|
||||
"north": {"uv": [1, 15, 11, 16], "rotation": 180, "texture": "#0"},
|
||||
"east": {"uv": [0, 1, 1, 15], "rotation": 270, "texture": "#0"},
|
||||
"south": {"uv": [1, 0, 11, 1], "rotation": 180, "texture": "#0"},
|
||||
"west": {"uv": [0, 1, 1, 15], "rotation": 90, "texture": "#0"},
|
||||
"up": {"uv": [1, 1, 11, 15], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [8.75, 12, 11.25, 16], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 1, 14.95],
|
||||
"to": [10, 1, 15.95],
|
||||
"rotation": {"angle": -45, "axis": "x", "origin": [8, 1, 15]},
|
||||
"faces": {
|
||||
"up": {"uv": [12, 0, 16, 1], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [12, 0, 16, 1], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"parent": "create:block/clipboard/block_empty",
|
||||
"textures": {
|
||||
"0": "create:block/clipboard_model_filled",
|
||||
"particle": "create:block/clipboard_model_filled"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 341 B |
Loading…
Reference in a new issue