mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-18 07:53:07 +01:00
Merge remote-tracking branch 'origin/mc1.14-v0.2.2' into mc1.15-v0.2.2
Conflicts: build.gradle src/main/java/com/simibubi/create/AllTileEntities.java src/main/java/com/simibubi/create/foundation/world/OreFeature.java src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionEntity.java src/main/java/com/simibubi/create/modules/contraptions/components/crafter/MechanicalCrafterTileEntityRenderer.java src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltColor.java
This commit is contained in:
commit
748f8af229
222 changed files with 5775 additions and 1266 deletions
|
@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
|
||||||
apply plugin: 'eclipse'
|
apply plugin: 'eclipse'
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
version = 'mc1.15.2_v0.2.1'
|
version = 'mc1.15.2_v0.2.2'
|
||||||
group = 'com.simibubi.create'
|
group = 'com.simibubi.create'
|
||||||
archivesBaseName = 'create'
|
archivesBaseName = 'create'
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ minecraft {
|
||||||
client {
|
client {
|
||||||
workingDirectory project.file('run')
|
workingDirectory project.file('run')
|
||||||
property 'forge.logging.console.level', 'info'
|
property 'forge.logging.console.level', 'info'
|
||||||
|
property 'fml.earlyprogresswindow', 'false'
|
||||||
mods {
|
mods {
|
||||||
create {
|
create {
|
||||||
source sourceSets.main
|
source sourceSets.main
|
||||||
|
@ -45,8 +46,9 @@ minecraft {
|
||||||
|
|
||||||
data {
|
data {
|
||||||
workingDirectory project.file('run')
|
workingDirectory project.file('run')
|
||||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
|
||||||
property 'forge.logging.console.level', 'debug'
|
property 'forge.logging.console.level', 'debug'
|
||||||
|
property 'fml.earlyprogresswindow', 'false'
|
||||||
args '--mod', 'create', '--all', '--output', file('src/generated/resources/')
|
args '--mod', 'create', '--all', '--output', file('src/generated/resources/')
|
||||||
mods {
|
mods {
|
||||||
create {
|
create {
|
||||||
|
|
|
@ -67,6 +67,7 @@ public enum AllBlockPartials {
|
||||||
ROPE_COIL("pulley/rope_coil"),
|
ROPE_COIL("pulley/rope_coil"),
|
||||||
ROPE_HALF("pulley/rope_half"),
|
ROPE_HALF("pulley/rope_half"),
|
||||||
ROPE_HALF_MAGNET("pulley/rope_half_magnet"),
|
ROPE_HALF_MAGNET("pulley/rope_half_magnet"),
|
||||||
|
MILLSTONE_COG("millstone/inner"),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.simibubi.create.foundation.block.IHaveCustomBlockItem;
|
||||||
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
|
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
|
||||||
import com.simibubi.create.foundation.block.ProperStairsBlock;
|
import com.simibubi.create.foundation.block.ProperStairsBlock;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
import com.simibubi.create.foundation.utility.data.ITaggable;
|
||||||
import com.simibubi.create.foundation.world.OxidizingBlock;
|
import com.simibubi.create.foundation.world.OxidizingBlock;
|
||||||
import com.simibubi.create.modules.IModule;
|
import com.simibubi.create.modules.IModule;
|
||||||
import com.simibubi.create.modules.contraptions.CasingBlock;
|
import com.simibubi.create.modules.contraptions.CasingBlock;
|
||||||
|
@ -31,6 +32,7 @@ import com.simibubi.create.modules.contraptions.components.fan.EncasedFanBlock;
|
||||||
import com.simibubi.create.modules.contraptions.components.fan.NozzleBlock;
|
import com.simibubi.create.modules.contraptions.components.fan.NozzleBlock;
|
||||||
import com.simibubi.create.modules.contraptions.components.flywheel.FlywheelBlock;
|
import com.simibubi.create.modules.contraptions.components.flywheel.FlywheelBlock;
|
||||||
import com.simibubi.create.modules.contraptions.components.flywheel.engine.FurnaceEngineBlock;
|
import com.simibubi.create.modules.contraptions.components.flywheel.engine.FurnaceEngineBlock;
|
||||||
|
import com.simibubi.create.modules.contraptions.components.millstone.MillstoneBlock;
|
||||||
import com.simibubi.create.modules.contraptions.components.mixer.MechanicalMixerBlock;
|
import com.simibubi.create.modules.contraptions.components.mixer.MechanicalMixerBlock;
|
||||||
import com.simibubi.create.modules.contraptions.components.motor.MotorBlock;
|
import com.simibubi.create.modules.contraptions.components.motor.MotorBlock;
|
||||||
import com.simibubi.create.modules.contraptions.components.press.MechanicalPressBlock;
|
import com.simibubi.create.modules.contraptions.components.press.MechanicalPressBlock;
|
||||||
|
@ -98,12 +100,16 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.color.BlockColors;
|
import net.minecraft.client.renderer.color.BlockColors;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
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.ToolType;
|
import net.minecraftforge.common.ToolType;
|
||||||
import net.minecraftforge.event.RegistryEvent;
|
import net.minecraftforge.event.RegistryEvent;
|
||||||
import net.minecraftforge.registries.IForgeRegistry;
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public enum AllBlocks {
|
public enum AllBlocks {
|
||||||
|
|
||||||
__SCHEMATICS__(),
|
__SCHEMATICS__(),
|
||||||
|
@ -131,6 +137,7 @@ public enum AllBlocks {
|
||||||
CUCKOO_CLOCK(new CuckooClockBlock(false)),
|
CUCKOO_CLOCK(new CuckooClockBlock(false)),
|
||||||
MYSTERIOUS_CUCKOO_CLOCK(new CuckooClockBlock(true)),
|
MYSTERIOUS_CUCKOO_CLOCK(new CuckooClockBlock(true)),
|
||||||
|
|
||||||
|
MILLSTONE(new MillstoneBlock()),
|
||||||
CRUSHING_WHEEL(new CrushingWheelBlock()),
|
CRUSHING_WHEEL(new CrushingWheelBlock()),
|
||||||
CRUSHING_WHEEL_CONTROLLER(new CrushingWheelControllerBlock()),
|
CRUSHING_WHEEL_CONTROLLER(new CrushingWheelControllerBlock()),
|
||||||
MECHANICAL_PRESS(new MechanicalPressBlock()),
|
MECHANICAL_PRESS(new MechanicalPressBlock()),
|
||||||
|
@ -148,7 +155,7 @@ public enum AllBlocks {
|
||||||
ROPE_PULLEY(new PulleyBlock()),
|
ROPE_PULLEY(new PulleyBlock()),
|
||||||
ROPE(new PulleyBlock.RopeBlock()),
|
ROPE(new PulleyBlock.RopeBlock()),
|
||||||
PULLEY_MAGNET(new PulleyBlock.MagnetBlock()),
|
PULLEY_MAGNET(new PulleyBlock.MagnetBlock()),
|
||||||
CART_ASSEMBLER(new CartAssemblerBlock()),
|
CART_ASSEMBLER(new TaggedBlock(new CartAssemblerBlock()).withVanillaTags(ITaggable.TagType.BLOCK, "rails")),
|
||||||
MINECART_ANCHOR(new MinecartAnchorBlock()),
|
MINECART_ANCHOR(new MinecartAnchorBlock()),
|
||||||
TRANSLATION_CHASSIS(new LinearChassisBlock()),
|
TRANSLATION_CHASSIS(new LinearChassisBlock()),
|
||||||
TRANSLATION_CHASSIS_SECONDARY(new LinearChassisBlock()),
|
TRANSLATION_CHASSIS_SECONDARY(new LinearChassisBlock()),
|
||||||
|
@ -169,7 +176,7 @@ public enum AllBlocks {
|
||||||
FLYWHEEL(new FlywheelBlock()),
|
FLYWHEEL(new FlywheelBlock()),
|
||||||
FURNACE_ENGINE(new FurnaceEngineBlock()),
|
FURNACE_ENGINE(new FurnaceEngineBlock()),
|
||||||
ROTATION_SPEED_CONTROLLER(new SpeedControllerBlock()),
|
ROTATION_SPEED_CONTROLLER(new SpeedControllerBlock()),
|
||||||
|
|
||||||
__LOGISTICS__(),
|
__LOGISTICS__(),
|
||||||
CONTACT(new ContactBlock()),
|
CONTACT(new ContactBlock()),
|
||||||
REDSTONE_BRIDGE(new RedstoneLinkBlock()),
|
REDSTONE_BRIDGE(new RedstoneLinkBlock()),
|
||||||
|
@ -198,10 +205,10 @@ public enum AllBlocks {
|
||||||
SYMMETRY_CROSSPLANE(new CrossPlaneSymmetryBlock()),
|
SYMMETRY_CROSSPLANE(new CrossPlaneSymmetryBlock()),
|
||||||
SYMMETRY_TRIPLEPLANE(new TriplePlaneSymmetryBlock()),
|
SYMMETRY_TRIPLEPLANE(new TriplePlaneSymmetryBlock()),
|
||||||
WINDOW_IN_A_BLOCK(new WindowInABlockBlock()),
|
WINDOW_IN_A_BLOCK(new WindowInABlockBlock()),
|
||||||
COCOA_LOG(new CocoaLogBlock()),
|
COCOA_LOG(new TaggedBlock(new CocoaLogBlock()).withVanillaTags(ITaggable.TagType.BLOCK, "jungle_logs")),
|
||||||
|
|
||||||
__PALETTES__(),
|
__PALETTES__(),
|
||||||
TILED_GLASS(new GlassBlock(Properties.from(Blocks.GLASS))),
|
TILED_GLASS(new TaggedBlock(new GlassBlock(Properties.from(Blocks.GLASS))).withVanillaTags(ITaggable.TagType.BLOCK, "impermeable").withForgeTags("glass")),
|
||||||
FRAMED_GLASS(new CTGlassBlock(AllCTs.FRAMED_GLASS, false)),
|
FRAMED_GLASS(new CTGlassBlock(AllCTs.FRAMED_GLASS, false)),
|
||||||
HORIZONTAL_FRAMED_GLASS(new HorizontalCTGlassBlock(AllCTs.HORIZONTAL_FRAMED_GLASS, AllCTs.FRAMED_GLASS, false)),
|
HORIZONTAL_FRAMED_GLASS(new HorizontalCTGlassBlock(AllCTs.HORIZONTAL_FRAMED_GLASS, AllCTs.FRAMED_GLASS, false)),
|
||||||
VERTICAL_FRAMED_GLASS(new VerticalCTGlassBlock(AllCTs.VERTICAL_FRAMED_GLASS, false)),
|
VERTICAL_FRAMED_GLASS(new VerticalCTGlassBlock(AllCTs.VERTICAL_FRAMED_GLASS, false)),
|
||||||
|
@ -214,17 +221,17 @@ public enum AllBlocks {
|
||||||
ACACIA_GLASS(new CTWindowBlock(AllCTs.ACACIA_GLASS, false)),
|
ACACIA_GLASS(new CTWindowBlock(AllCTs.ACACIA_GLASS, false)),
|
||||||
IRON_GLASS(new CTWindowBlock(AllCTs.IRON_GLASS, false)),
|
IRON_GLASS(new CTWindowBlock(AllCTs.IRON_GLASS, false)),
|
||||||
|
|
||||||
TILED_GLASS_PANE(new GlassPaneBlock(Properties.from(Blocks.GLASS))),
|
TILED_GLASS_PANE(new TaggedBlock(new GlassPaneBlock(Properties.from(Blocks.GLASS))).withForgeTags("glass_panes")),
|
||||||
FRAMED_GLASS_PANE(new CTGlassPaneBlock(FRAMED_GLASS.block)),
|
FRAMED_GLASS_PANE(new CTGlassPaneBlock(FRAMED_GLASS.get())),
|
||||||
HORIZONTAL_FRAMED_GLASS_PANE(new CTGlassPaneBlock(HORIZONTAL_FRAMED_GLASS.block)),
|
HORIZONTAL_FRAMED_GLASS_PANE(new CTGlassPaneBlock(HORIZONTAL_FRAMED_GLASS.get())),
|
||||||
VERTICAL_FRAMED_GLASS_PANE(new CTGlassPaneBlock(VERTICAL_FRAMED_GLASS.block)),
|
VERTICAL_FRAMED_GLASS_PANE(new CTGlassPaneBlock(VERTICAL_FRAMED_GLASS.get())),
|
||||||
OAK_GLASS_PANE(new CTGlassPaneBlock(OAK_GLASS.block)),
|
OAK_GLASS_PANE(new CTGlassPaneBlock(OAK_GLASS.get())),
|
||||||
SPRUCE_GLASS_PANE(new CTGlassPaneBlock(SPRUCE_GLASS.block)),
|
SPRUCE_GLASS_PANE(new CTGlassPaneBlock(SPRUCE_GLASS.get())),
|
||||||
BIRCH_GLASS_PANE(new CTGlassPaneBlock(BIRCH_GLASS.block)),
|
BIRCH_GLASS_PANE(new CTGlassPaneBlock(BIRCH_GLASS.get())),
|
||||||
JUNGLE_GLASS_PANE(new CTGlassPaneBlock(JUNGLE_GLASS.block)),
|
JUNGLE_GLASS_PANE(new CTGlassPaneBlock(JUNGLE_GLASS.get())),
|
||||||
DARK_OAK_GLASS_PANE(new CTGlassPaneBlock(DARK_OAK_GLASS.block)),
|
DARK_OAK_GLASS_PANE(new CTGlassPaneBlock(DARK_OAK_GLASS.get())),
|
||||||
ACACIA_GLASS_PANE(new CTGlassPaneBlock(ACACIA_GLASS.block)),
|
ACACIA_GLASS_PANE(new CTGlassPaneBlock(ACACIA_GLASS.get())),
|
||||||
IRON_GLASS_PANE(new CTGlassPaneBlock(IRON_GLASS.block)),
|
IRON_GLASS_PANE(new CTGlassPaneBlock(IRON_GLASS.get())),
|
||||||
|
|
||||||
GRANITE_BRICKS(new Block(Properties.from(Blocks.GRANITE))),
|
GRANITE_BRICKS(new Block(Properties.from(Blocks.GRANITE))),
|
||||||
GRANITE_LAYERS(new LayeredCTBlock(Properties.from(Blocks.GRANITE), AllCTs.GRANITE_LAYERS, AllCTs.POLISHED_GRANITE)),
|
GRANITE_LAYERS(new LayeredCTBlock(Properties.from(Blocks.GRANITE), AllCTs.GRANITE_LAYERS, AllCTs.POLISHED_GRANITE)),
|
||||||
|
@ -234,86 +241,89 @@ public enum AllBlocks {
|
||||||
ANDESITE_LAYERS(
|
ANDESITE_LAYERS(
|
||||||
new LayeredCTBlock(Properties.from(Blocks.ANDESITE), AllCTs.ANDESITE_LAYERS, AllCTs.POLISHED_ANDESITE)),
|
new LayeredCTBlock(Properties.from(Blocks.ANDESITE), AllCTs.ANDESITE_LAYERS, AllCTs.POLISHED_ANDESITE)),
|
||||||
|
|
||||||
GABBRO(new Block(Properties.from(Blocks.GRANITE)), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
|
GABBRO(new TaggedBlock(new Block(Properties.from(Blocks.GRANITE))).withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
|
||||||
POLISHED_GABBRO(new Block(Properties.from(GABBRO.block))),
|
POLISHED_GABBRO(new TaggedBlock(new Block(Properties.from(GABBRO.get()))).withForgeTags("stone")),
|
||||||
GABBRO_BRICKS(new Block(Properties.from(GABBRO.block)), ComesWith.STAIRS, ComesWith.WALL),
|
GABBRO_BRICKS(new Block(Properties.from(GABBRO.get())), ComesWith.STAIRS, ComesWith.WALL),
|
||||||
PAVED_GABBRO_BRICKS(new Block(Properties.from(GABBRO.block)), ComesWith.SLAB),
|
PAVED_GABBRO_BRICKS(new Block(Properties.from(GABBRO.get())), ComesWith.SLAB),
|
||||||
INDENTED_GABBRO(new Block(Properties.from(GABBRO.block)), ComesWith.SLAB),
|
INDENTED_GABBRO(new Block(Properties.from(GABBRO.get())), ComesWith.SLAB),
|
||||||
SLIGHTLY_MOSSY_GABBRO_BRICKS(new Block(Properties.from(GABBRO.block))),
|
SLIGHTLY_MOSSY_GABBRO_BRICKS(new Block(Properties.from(GABBRO.get()))),
|
||||||
MOSSY_GABBRO_BRICKS(new Block(Properties.from(GABBRO.block))),
|
MOSSY_GABBRO_BRICKS(new Block(Properties.from(GABBRO.get()))),
|
||||||
GABBRO_LAYERS(new LayeredCTBlock(Properties.from(GABBRO.block), AllCTs.GABBRO_LAYERS, AllCTs.POLISHED_GABBRO)),
|
GABBRO_LAYERS(new LayeredCTBlock(Properties.from(GABBRO.get()), AllCTs.GABBRO_LAYERS, AllCTs.POLISHED_GABBRO)),
|
||||||
|
|
||||||
DOLOMITE(new Block(Properties.from(Blocks.QUARTZ_BLOCK)), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
|
DOLOMITE(new TaggedBlock(new Block(Properties.from(Blocks.QUARTZ_BLOCK))).withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
|
||||||
DOLOMITE_BRICKS(new Block(Properties.from(DOLOMITE.block))),
|
DOLOMITE_BRICKS(new Block(Properties.from(DOLOMITE.get()))),
|
||||||
POLISHED_DOLOMITE(new Block(Properties.from(DOLOMITE.block))),
|
POLISHED_DOLOMITE(new TaggedBlock(new Block(Properties.from(DOLOMITE.get()))).withForgeTags("stone")),
|
||||||
DOLOMITE_PILLAR(new RotatedPillarBlock(Properties.from(DOLOMITE.block))),
|
DOLOMITE_PILLAR(new RotatedPillarBlock(Properties.from(DOLOMITE.get()))),
|
||||||
DOLOMITE_LAYERS(
|
DOLOMITE_LAYERS(
|
||||||
new LayeredCTBlock(Properties.from(DOLOMITE.block), AllCTs.DOLOMITE_LAYERS, AllCTs.POLISHED_DOLOMITE)),
|
new LayeredCTBlock(Properties.from(DOLOMITE.get()), AllCTs.DOLOMITE_LAYERS, AllCTs.POLISHED_DOLOMITE)),
|
||||||
|
|
||||||
LIMESAND(new FallingBlock(Properties.from(Blocks.SAND))),
|
LIMESAND(new FallingBlock(Properties.from(Blocks.SAND))),
|
||||||
LIMESTONE(new Block(Properties.from(Blocks.SANDSTONE)), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
|
LIMESTONE(new TaggedBlock(new Block(Properties.from(Blocks.SANDSTONE))).withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
|
||||||
LIMESTONE_BRICKS(new Block(Properties.from(LIMESTONE.block)), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
|
LIMESTONE_BRICKS(new Block(Properties.from(LIMESTONE.get())), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
|
||||||
POLISHED_LIMESTONE(new Block(Properties.from(LIMESTONE.block)), ComesWith.SLAB),
|
POLISHED_LIMESTONE(new TaggedBlock(new Block(Properties.from(LIMESTONE.get()))).withForgeTags("stone"), ComesWith.SLAB),
|
||||||
LIMESTONE_PILLAR(new RotatedPillarBlock(Properties.from(LIMESTONE.block))),
|
LIMESTONE_PILLAR(new RotatedPillarBlock(Properties.from(LIMESTONE.get()))),
|
||||||
LIMESTONE_LAYERS(
|
LIMESTONE_LAYERS(
|
||||||
new LayeredCTBlock(Properties.from(LIMESTONE.block), AllCTs.LIMESTONE_LAYERS, AllCTs.POLISHED_LIMESTONE)),
|
new LayeredCTBlock(Properties.from(LIMESTONE.get()), AllCTs.LIMESTONE_LAYERS, AllCTs.POLISHED_LIMESTONE)),
|
||||||
WEATHERED_LIMESTONE(new Block(Properties.from(Blocks.ANDESITE)), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
|
WEATHERED_LIMESTONE(new TaggedBlock(new Block(Properties.from(Blocks.ANDESITE))).withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
|
||||||
WEATHERED_LIMESTONE_BRICKS(new Block(Properties.from(WEATHERED_LIMESTONE.block)), ComesWith.STAIRS, ComesWith.SLAB,
|
WEATHERED_LIMESTONE_BRICKS(new Block(Properties.from(WEATHERED_LIMESTONE.get())), ComesWith.STAIRS, ComesWith.SLAB,
|
||||||
ComesWith.WALL),
|
ComesWith.WALL),
|
||||||
POLISHED_WEATHERED_LIMESTONE(new Block(Properties.from(WEATHERED_LIMESTONE.block)), ComesWith.SLAB),
|
POLISHED_WEATHERED_LIMESTONE(new TaggedBlock(new Block(Properties.from(WEATHERED_LIMESTONE.get()))).withForgeTags("stone"), ComesWith.SLAB),
|
||||||
WEATHERED_LIMESTONE_PILLAR(new RotatedPillarBlock(Properties.from(WEATHERED_LIMESTONE.block))),
|
WEATHERED_LIMESTONE_PILLAR(new RotatedPillarBlock(Properties.from(WEATHERED_LIMESTONE.get()))),
|
||||||
WEATHERED_LIMESTONE_LAYERS(new LayeredCTBlock(Properties.from(WEATHERED_LIMESTONE.block),
|
WEATHERED_LIMESTONE_LAYERS(new LayeredCTBlock(Properties.from(WEATHERED_LIMESTONE.get()),
|
||||||
AllCTs.WEATHERED_LIMESTONE_LAYERS, AllCTs.POLISHED_WEATHERED_LIMESTONE)),
|
AllCTs.WEATHERED_LIMESTONE_LAYERS, AllCTs.POLISHED_WEATHERED_LIMESTONE)),
|
||||||
|
|
||||||
NATURAL_SCORIA(new ScoriaBlock()),
|
NATURAL_SCORIA(new ScoriaBlock()),
|
||||||
SCORIA(new Block(Properties.from(Blocks.ANDESITE)), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
|
SCORIA(new TaggedBlock(new Block(Properties.from(Blocks.ANDESITE))).withForgeTags("stone"), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
|
||||||
POLISHED_SCORIA(new Block(Properties.from(SCORIA.block)), ComesWith.SLAB),
|
POLISHED_SCORIA(new TaggedBlock(new Block(Properties.from(SCORIA.get()))).withForgeTags("stone"), ComesWith.SLAB),
|
||||||
SCORIA_BRICKS(new Block(Properties.from(SCORIA.block))),
|
SCORIA_BRICKS(new Block(Properties.from(SCORIA.get()))),
|
||||||
SCORIA_LAYERS(new LayeredCTBlock(Properties.from(SCORIA.block), AllCTs.SCORIA_LAYERS, AllCTs.POLISHED_SCORIA)),
|
SCORIA_LAYERS(new LayeredCTBlock(Properties.from(SCORIA.get()), AllCTs.SCORIA_LAYERS, AllCTs.POLISHED_SCORIA)),
|
||||||
SCORIA_PILLAR(new RotatedPillarBlock(Properties.from(SCORIA.block))),
|
SCORIA_PILLAR(new RotatedPillarBlock(Properties.from(SCORIA.get()))),
|
||||||
|
|
||||||
DARK_SCORIA(new Block(Properties.from(Blocks.ANDESITE))),
|
DARK_SCORIA(new Block(Properties.from(Blocks.ANDESITE))),
|
||||||
POLISHED_DARK_SCORIA(new Block(Properties.from(DARK_SCORIA.block))),
|
POLISHED_DARK_SCORIA(new Block(Properties.from(DARK_SCORIA.get()))),
|
||||||
DARK_SCORIA_TILES(new Block(Properties.from(DARK_SCORIA.block)), ComesWith.STAIRS, ComesWith.SLAB),
|
DARK_SCORIA_TILES(new Block(Properties.from(DARK_SCORIA.get())), ComesWith.STAIRS, ComesWith.SLAB),
|
||||||
DARK_SCORIA_BRICKS(new Block(Properties.from(DARK_SCORIA.block)), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
|
DARK_SCORIA_BRICKS(new Block(Properties.from(DARK_SCORIA.get())), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL),
|
||||||
|
|
||||||
__MATERIALS__(),
|
__MATERIALS__(),
|
||||||
COPPER_ORE(new OxidizingBlock(Properties.from(Blocks.IRON_ORE), 1)),
|
COPPER_ORE(new TaggedBlock(new OxidizingBlock(Properties.from(Blocks.IRON_ORE), 1)).withForgeTags("ores/copper")),
|
||||||
ZINC_ORE(new Block(Properties.from(Blocks.GOLD_ORE).harvestLevel(2).harvestTool(ToolType.PICKAXE))),
|
ZINC_ORE(new TaggedBlock(new Block(Properties.from(Blocks.GOLD_ORE).harvestLevel(2).harvestTool(ToolType.PICKAXE))).withForgeTags("ores/zinc")),
|
||||||
COPPER_BLOCK(new OxidizingBlock(Properties.from(Blocks.IRON_BLOCK), 1/32f)),
|
COPPER_BLOCK(new TaggedBlock(new OxidizingBlock(Properties.from(Blocks.IRON_BLOCK), 1 / 32f)).withForgeTags("storage_blocks/copper")),
|
||||||
COPPER_SHINGLES(new OxidizingBlock(Properties.from(Blocks.IRON_BLOCK), 1/32f)),
|
COPPER_SHINGLES(new OxidizingBlock(Properties.from(Blocks.IRON_BLOCK), 1 / 32f)),
|
||||||
|
ZINC_BLOCK(new TaggedBlock(new Block(Properties.from(Blocks.IRON_BLOCK))).withForgeTags("storage_blocks/zinc")),
|
||||||
|
BRASS_BLOCK(new TaggedBlock(new Block(Properties.from(Blocks.IRON_BLOCK))).withForgeTags("storage_blocks/brass")),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private enum ComesWith {
|
private enum ComesWith {
|
||||||
WALL, FENCE, FENCE_GATE, SLAB, STAIRS;
|
WALL, FENCE, FENCE_GATE, SLAB, STAIRS
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class CategoryTracker {
|
private static class CategoryTracker {
|
||||||
static IModule currentModule;
|
static IModule currentModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block block;
|
private TaggedBlock taggedBlock;
|
||||||
public Block[] alsoRegistered;
|
public TaggedBlock[] alsoRegistered;
|
||||||
public IModule module;
|
public IModule module;
|
||||||
|
|
||||||
private AllBlocks() {
|
AllBlocks() {
|
||||||
CategoryTracker.currentModule = new IModule() {
|
CategoryTracker.currentModule = () -> Lang.asId(name()).replaceAll("__", "");
|
||||||
@Override
|
taggedBlock = new TaggedBlock(null);
|
||||||
public String getModuleName() {
|
|
||||||
return Lang.asId(name()).replaceAll("__", "");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private AllBlocks(Block block, ComesWith... comesWith) {
|
AllBlocks(Block block, ComesWith... comesWith) {
|
||||||
this.block = block;
|
this(new TaggedBlock(block), comesWith);
|
||||||
this.block.setRegistryName(Create.ID, Lang.asId(name()));
|
}
|
||||||
|
|
||||||
|
AllBlocks(TaggedBlock taggedBlockIn, ComesWith... comesWith){
|
||||||
|
this.taggedBlock = taggedBlockIn;
|
||||||
|
this.taggedBlock.getBlock().setRegistryName(Create.ID, Lang.asId(name()));
|
||||||
this.module = CategoryTracker.currentModule;
|
this.module = CategoryTracker.currentModule;
|
||||||
|
|
||||||
alsoRegistered = new Block[comesWith.length];
|
alsoRegistered = new TaggedBlock[comesWith.length];
|
||||||
for (int i = 0; i < comesWith.length; i++)
|
for (int i = 0; i < comesWith.length; i++)
|
||||||
alsoRegistered[i] = makeRelatedBlock(block, comesWith[i]);
|
alsoRegistered[i] = makeRelatedBlock(taggedBlock.getBlock(), comesWith[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register(RegistryEvent.Register<Block> event) {
|
public static void register(RegistryEvent.Register<Block> event) {
|
||||||
|
@ -323,9 +333,9 @@ public enum AllBlocks {
|
||||||
if (block.get() == null)
|
if (block.get() == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
registry.register(block.block);
|
registry.register(block.get());
|
||||||
for (Block extra : block.alsoRegistered)
|
for (TaggedBlock extra : block.alsoRegistered)
|
||||||
registry.register(extra);
|
registry.register(extra.block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,13 +348,13 @@ public enum AllBlocks {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
registerAsItem(registry, def);
|
registerAsItem(registry, def);
|
||||||
for (Block extra : block.alsoRegistered)
|
for (TaggedBlock extra : block.alsoRegistered)
|
||||||
registerAsItem(registry, extra);
|
registerAsItem(registry, extra.block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerAsItem(IForgeRegistry<Item> registry, Block blockIn) {
|
private static void registerAsItem(IForgeRegistry<Item> registry, Block blockIn) {
|
||||||
BlockItem blockItem = null;
|
BlockItem blockItem;
|
||||||
Item.Properties standardItemProperties = AllItems.includeInItemGroup();
|
Item.Properties standardItemProperties = AllItems.includeInItemGroup();
|
||||||
|
|
||||||
if (blockIn instanceof IHaveCustomBlockItem)
|
if (blockIn instanceof IHaveCustomBlockItem)
|
||||||
|
@ -356,52 +366,77 @@ public enum AllBlocks {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block get() {
|
public Block get() {
|
||||||
return block;
|
return taggedBlock.getBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITaggable<?> getTaggable() {
|
||||||
|
return taggedBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockState getDefault() {
|
public BlockState getDefault() {
|
||||||
return block.getDefaultState();
|
return get().getDefaultState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean typeOf(BlockState state) {
|
public boolean typeOf(BlockState state) {
|
||||||
return state.getBlock() == block;
|
return state.getBlock() == get();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Block makeRelatedBlock(Block block, ComesWith feature) {
|
private TaggedBlock makeRelatedBlock(Block block, ComesWith feature) {
|
||||||
Properties properties = Properties.from(block);
|
Properties properties = Properties.from(block);
|
||||||
Block featured = null;
|
TaggedBlock featured;
|
||||||
|
|
||||||
switch (feature) {
|
switch (feature) {
|
||||||
case FENCE:
|
case FENCE:
|
||||||
featured = new FenceBlock(properties);
|
featured = new TaggedBlock(new FenceBlock(properties)).withVanillaTags(ITaggable.TagType.BLOCK, "fences");
|
||||||
break;
|
break;
|
||||||
case SLAB:
|
case SLAB:
|
||||||
featured = new SlabBlock(properties);
|
featured = new TaggedBlock(new SlabBlock(properties)).withVanillaTags(ITaggable.TagType.BLOCK, "slabs");
|
||||||
break;
|
break;
|
||||||
case STAIRS:
|
case STAIRS:
|
||||||
featured = new ProperStairsBlock(block);
|
featured = new TaggedBlock(new ProperStairsBlock(block)).withVanillaTags(ITaggable.TagType.BLOCK, "stairs");
|
||||||
break;
|
break;
|
||||||
case WALL:
|
case WALL:
|
||||||
featured = new WallBlock(properties);
|
featured = new TaggedBlock(new WallBlock(properties)).withVanillaTags(ITaggable.TagType.BLOCK, "walls");
|
||||||
break;
|
break;
|
||||||
case FENCE_GATE:
|
case FENCE_GATE:
|
||||||
featured = new FenceGateBlock(properties);
|
featured = new TaggedBlock(new FenceGateBlock(properties));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return featured.setRegistryName(Create.ID, block.getRegistryName().getPath() + "_" + Lang.asId(feature.name()));
|
featured.block.setRegistryName(Create.ID, block.getRegistryName().getPath() + "_" + Lang.asId(feature.name()));
|
||||||
|
return featured;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static void registerColorHandlers() {
|
public static void registerColorHandlers() {
|
||||||
BlockColors blockColors = Minecraft.getInstance().getBlockColors();
|
BlockColors blockColors = Minecraft.getInstance().getBlockColors();
|
||||||
for (AllBlocks block : values()) {
|
for (AllBlocks block : values()) {
|
||||||
if (block.block instanceof IHaveColorHandler) {
|
if (block.get() instanceof IHaveColorHandler) {
|
||||||
blockColors.register(((IHaveColorHandler) block.block).getColorHandler(), block.block);
|
blockColors.register(((IHaveColorHandler) block.get()).getColorHandler(), block.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class TaggedBlock implements ITaggable<TaggedBlock> {
|
||||||
|
//A wrapper around Block that allows for tags to be included. needed for datagen
|
||||||
|
|
||||||
|
private Set<ResourceLocation> tagSetBlock = new HashSet<>();
|
||||||
|
private Set<ResourceLocation> tagSetBlockItem = new HashSet<>();
|
||||||
|
private Block block;
|
||||||
|
|
||||||
|
public TaggedBlock(Block blockIn){
|
||||||
|
block = blockIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Block getBlock() {
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<ResourceLocation> getTagSet(TagType type) {
|
||||||
|
return type == TagType.BLOCK ? tagSetBlock : tagSetBlockItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,15 @@ import static com.simibubi.create.foundation.item.AllToolTypes.AXE;
|
||||||
import static com.simibubi.create.foundation.item.AllToolTypes.HOE;
|
import static com.simibubi.create.foundation.item.AllToolTypes.HOE;
|
||||||
import static com.simibubi.create.foundation.item.AllToolTypes.PICKAXE;
|
import static com.simibubi.create.foundation.item.AllToolTypes.PICKAXE;
|
||||||
import static com.simibubi.create.foundation.item.AllToolTypes.SHOVEL;
|
import static com.simibubi.create.foundation.item.AllToolTypes.SHOVEL;
|
||||||
import static com.simibubi.create.foundation.item.AllToolTypes.SWORD;
|
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.item.IHaveCustomItemModel;
|
import com.simibubi.create.foundation.item.IHaveCustomItemModel;
|
||||||
import com.simibubi.create.foundation.item.IItemWithColorHandler;
|
import com.simibubi.create.foundation.item.IItemWithColorHandler;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
import com.simibubi.create.foundation.utility.data.ITaggable;
|
||||||
import com.simibubi.create.modules.IModule;
|
import com.simibubi.create.modules.IModule;
|
||||||
import com.simibubi.create.modules.contraptions.GogglesItem;
|
import com.simibubi.create.modules.contraptions.GogglesItem;
|
||||||
import com.simibubi.create.modules.contraptions.WrenchItem;
|
import com.simibubi.create.modules.contraptions.WrenchItem;
|
||||||
|
@ -21,6 +23,7 @@ import com.simibubi.create.modules.curiosities.RefinedRadianceItem;
|
||||||
import com.simibubi.create.modules.curiosities.ShadowSteelItem;
|
import com.simibubi.create.modules.curiosities.ShadowSteelItem;
|
||||||
import com.simibubi.create.modules.curiosities.deforester.DeforesterItem;
|
import com.simibubi.create.modules.curiosities.deforester.DeforesterItem;
|
||||||
import com.simibubi.create.modules.curiosities.symmetry.SymmetryWandItem;
|
import com.simibubi.create.modules.curiosities.symmetry.SymmetryWandItem;
|
||||||
|
import com.simibubi.create.modules.curiosities.tools.AllToolTiers;
|
||||||
import com.simibubi.create.modules.curiosities.tools.BlazingToolItem;
|
import com.simibubi.create.modules.curiosities.tools.BlazingToolItem;
|
||||||
import com.simibubi.create.modules.curiosities.tools.RoseQuartzToolItem;
|
import com.simibubi.create.modules.curiosities.tools.RoseQuartzToolItem;
|
||||||
import com.simibubi.create.modules.curiosities.tools.SandPaperItem;
|
import com.simibubi.create.modules.curiosities.tools.SandPaperItem;
|
||||||
|
@ -39,6 +42,8 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.Item.Properties;
|
import net.minecraft.item.Item.Properties;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Rarity;
|
import net.minecraft.item.Rarity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.item.SwordItem;
|
||||||
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.event.RegistryEvent;
|
import net.minecraftforge.event.RegistryEvent;
|
||||||
|
@ -50,14 +55,14 @@ import net.minecraftforge.registries.IForgeRegistry;
|
||||||
public enum AllItems {
|
public enum AllItems {
|
||||||
|
|
||||||
__MATERIALS__(module()),
|
__MATERIALS__(module()),
|
||||||
COPPER_NUGGET,
|
COPPER_NUGGET(new TaggedItem().withForgeTags("nuggets/copper")),
|
||||||
ZINC_NUGGET,
|
ZINC_NUGGET(new TaggedItem().withForgeTags("nuggets/zinc")),
|
||||||
BRASS_NUGGET,
|
BRASS_NUGGET(new TaggedItem().withForgeTags("nuggets/brass")),
|
||||||
IRON_SHEET,
|
IRON_SHEET(new TaggedItem().withForgeTags("plates/iron")),
|
||||||
GOLD_SHEET,
|
GOLD_SHEET(new TaggedItem().withForgeTags("plates/gold")),
|
||||||
COPPER_SHEET,
|
COPPER_SHEET(new TaggedItem().withForgeTags("plates/copper")),
|
||||||
BRASS_SHEET,
|
BRASS_SHEET(new TaggedItem().withForgeTags("plates/brass")),
|
||||||
LAPIS_PLATE,
|
LAPIS_PLATE(new TaggedItem().withForgeTags("plates/lapis")),
|
||||||
|
|
||||||
CRUSHED_IRON,
|
CRUSHED_IRON,
|
||||||
CRUSHED_GOLD,
|
CRUSHED_GOLD,
|
||||||
|
@ -66,9 +71,9 @@ public enum AllItems {
|
||||||
CRUSHED_BRASS,
|
CRUSHED_BRASS,
|
||||||
|
|
||||||
ANDESITE_ALLOY,
|
ANDESITE_ALLOY,
|
||||||
COPPER_INGOT,
|
COPPER_INGOT(new TaggedItem().withForgeTags("ingots/copper")),
|
||||||
ZINC_INGOT,
|
ZINC_INGOT(new TaggedItem().withForgeTags("ingots/zinc")),
|
||||||
BRASS_INGOT,
|
BRASS_INGOT(new TaggedItem().withForgeTags("ingots/brass")),
|
||||||
|
|
||||||
SAND_PAPER(SandPaperItem::new),
|
SAND_PAPER(SandPaperItem::new),
|
||||||
RED_SAND_PAPER(SandPaperItem::new),
|
RED_SAND_PAPER(SandPaperItem::new),
|
||||||
|
@ -113,16 +118,16 @@ public enum AllItems {
|
||||||
BLAZING_PICKAXE(p -> new BlazingToolItem(1, -2.8F, p, PICKAXE)),
|
BLAZING_PICKAXE(p -> new BlazingToolItem(1, -2.8F, p, PICKAXE)),
|
||||||
BLAZING_SHOVEL(p -> new BlazingToolItem(1.5F, -3.0F, p, SHOVEL)),
|
BLAZING_SHOVEL(p -> new BlazingToolItem(1.5F, -3.0F, p, SHOVEL)),
|
||||||
BLAZING_AXE(p -> new BlazingToolItem(5.0F, -3.0F, p, AXE)),
|
BLAZING_AXE(p -> new BlazingToolItem(5.0F, -3.0F, p, AXE)),
|
||||||
BLAZING_SWORD(p -> new BlazingToolItem(3, -2.4F, p, SWORD)),
|
BLAZING_SWORD(p -> new SwordItem(AllToolTiers.BLAZING, 3, -2.4F, p)),
|
||||||
|
|
||||||
ROSE_QUARTZ_PICKAXE(p -> new RoseQuartzToolItem(1, -2.8F, p, PICKAXE)),
|
ROSE_QUARTZ_PICKAXE(p -> new RoseQuartzToolItem(1, -2.8F, p, PICKAXE)),
|
||||||
ROSE_QUARTZ_SHOVEL(p -> new RoseQuartzToolItem(1.5F, -3.0F, p, SHOVEL)),
|
ROSE_QUARTZ_SHOVEL(p -> new RoseQuartzToolItem(1.5F, -3.0F, p, SHOVEL)),
|
||||||
ROSE_QUARTZ_AXE(p -> new RoseQuartzToolItem(5.0F, -3.0F, p, AXE)),
|
ROSE_QUARTZ_AXE(p -> new RoseQuartzToolItem(5.0F, -3.0F, p, AXE)),
|
||||||
ROSE_QUARTZ_SWORD(p -> new RoseQuartzToolItem(3, -2.4F, p, SWORD)),
|
ROSE_QUARTZ_SWORD(p -> new SwordItem(AllToolTiers.ROSE_QUARTZ, 3, -2.4F, p)),
|
||||||
|
|
||||||
SHADOW_STEEL_PICKAXE(p -> new ShadowSteelToolItem(2.5F, -2.0F, p, PICKAXE)),
|
SHADOW_STEEL_PICKAXE(p -> new ShadowSteelToolItem(2.5F, -2.0F, p, PICKAXE)),
|
||||||
SHADOW_STEEL_MATTOCK(p -> new ShadowSteelToolItem(2.5F, -1.5F, p, SHOVEL, AXE, HOE)),
|
SHADOW_STEEL_MATTOCK(p -> new ShadowSteelToolItem(2.5F, -1.5F, p, SHOVEL, AXE, HOE)),
|
||||||
SHADOW_STEEL_SWORD(p -> new ShadowSteelToolItem(3, -2.0F, p, SWORD)),
|
SHADOW_STEEL_SWORD(p -> new SwordItem(AllToolTiers.SHADOW_STEEL, 3, -2.0F, p)),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -134,28 +139,32 @@ public enum AllItems {
|
||||||
|
|
||||||
public IModule module;
|
public IModule module;
|
||||||
private Function<Properties, Properties> specialProperties;
|
private Function<Properties, Properties> specialProperties;
|
||||||
private Function<Properties, Item> itemSupplier;
|
private TaggedItem taggedItem;
|
||||||
private Item item;
|
private Item item;
|
||||||
|
|
||||||
private AllItems(int moduleMarker) {
|
AllItems(int moduleMarker) {
|
||||||
CategoryTracker.currentModule = new IModule() {
|
CategoryTracker.currentModule = () -> Lang.asId(name()).replaceAll("__", "");
|
||||||
@Override
|
taggedItem = new TaggedItem(null);
|
||||||
public String getModuleName() {
|
|
||||||
return Lang.asId(name()).replaceAll("__", "");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private AllItems() {
|
AllItems(Function<Properties, Item> itemSupplier) {
|
||||||
this(Item::new);
|
this(new TaggedItem(itemSupplier), Function.identity());
|
||||||
}
|
}
|
||||||
|
|
||||||
private AllItems(Function<Properties, Item> itemSupplier) {
|
AllItems(Function<Properties, Item> itemSupplier, Function<Properties, Properties> specialProperties) {
|
||||||
this(itemSupplier, Function.identity());
|
this(new TaggedItem(itemSupplier), specialProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
private AllItems(Function<Properties, Item> itemSupplier, Function<Properties, Properties> specialProperties) {
|
AllItems() {
|
||||||
this.itemSupplier = itemSupplier;
|
this(new TaggedItem(Item::new));
|
||||||
|
}
|
||||||
|
|
||||||
|
AllItems(TaggedItem taggedItemIn) {
|
||||||
|
this(taggedItemIn, Function.identity());
|
||||||
|
}
|
||||||
|
|
||||||
|
AllItems(TaggedItem taggedItemIn, Function<Properties, Properties> specialProperties) {
|
||||||
|
this.taggedItem = taggedItemIn;
|
||||||
this.module = CategoryTracker.currentModule;
|
this.module = CategoryTracker.currentModule;
|
||||||
this.specialProperties = specialProperties;
|
this.specialProperties = specialProperties;
|
||||||
}
|
}
|
||||||
|
@ -184,11 +193,11 @@ public enum AllItems {
|
||||||
IForgeRegistry<Item> registry = event.getRegistry();
|
IForgeRegistry<Item> registry = event.getRegistry();
|
||||||
|
|
||||||
for (AllItems entry : values()) {
|
for (AllItems entry : values()) {
|
||||||
if (entry.itemSupplier == null)
|
if (entry.taggedItem == null || entry.taggedItem.getItemSupplier() == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
entry.item = entry.itemSupplier.apply(new Properties());
|
entry.item = entry.taggedItem.getItemSupplier().apply(new Properties());
|
||||||
entry.item = entry.itemSupplier.apply(entry.specialProperties.apply(defaultProperties(entry)));
|
entry.item = entry.taggedItem.getItemSupplier().apply(entry.specialProperties.apply(defaultProperties(entry)));
|
||||||
entry.item.setRegistryName(Create.ID, Lang.asId(entry.name()));
|
entry.item.setRegistryName(Create.ID, Lang.asId(entry.name()));
|
||||||
registry.register(entry.item);
|
registry.register(entry.item);
|
||||||
}
|
}
|
||||||
|
@ -200,6 +209,10 @@ public enum AllItems {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TaggedItem getTaggable() {
|
||||||
|
return taggedItem;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean typeOf(ItemStack stack) {
|
public boolean typeOf(ItemStack stack) {
|
||||||
return stack.getItem() == item;
|
return stack.getItem() == item;
|
||||||
}
|
}
|
||||||
|
@ -208,6 +221,29 @@ public enum AllItems {
|
||||||
return new ItemStack(item);
|
return new ItemStack(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class TaggedItem implements ITaggable<TaggedItem> {
|
||||||
|
|
||||||
|
private Set<ResourceLocation> tagSetItem = new HashSet<>();
|
||||||
|
private Function<Properties, Item> itemSupplier;
|
||||||
|
|
||||||
|
public TaggedItem(){
|
||||||
|
this(Item::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaggedItem(Function<Properties, Item> itemSupplierIn){
|
||||||
|
this.itemSupplier = itemSupplierIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Function<Properties, Item> getItemSupplier() {
|
||||||
|
return itemSupplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<ResourceLocation> getTagSet(TagType type) {
|
||||||
|
return tagSetItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Client
|
// Client
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.modules.contraptions.components.crafter.MechanicalCraftingRecipe;
|
import com.simibubi.create.modules.contraptions.components.crafter.MechanicalCraftingRecipe;
|
||||||
import com.simibubi.create.modules.contraptions.components.crusher.CrushingRecipe;
|
import com.simibubi.create.modules.contraptions.components.crusher.CrushingRecipe;
|
||||||
import com.simibubi.create.modules.contraptions.components.fan.SplashingRecipe;
|
import com.simibubi.create.modules.contraptions.components.fan.SplashingRecipe;
|
||||||
|
import com.simibubi.create.modules.contraptions.components.millstone.MillingRecipe;
|
||||||
import com.simibubi.create.modules.contraptions.components.mixer.MixingRecipe;
|
import com.simibubi.create.modules.contraptions.components.mixer.MixingRecipe;
|
||||||
import com.simibubi.create.modules.contraptions.components.press.PressingRecipe;
|
import com.simibubi.create.modules.contraptions.components.press.PressingRecipe;
|
||||||
import com.simibubi.create.modules.contraptions.components.saw.CuttingRecipe;
|
import com.simibubi.create.modules.contraptions.components.saw.CuttingRecipe;
|
||||||
|
@ -30,6 +31,7 @@ public enum AllRecipes {
|
||||||
BLOCKZAPPER_UPGRADE(BlockzapperUpgradeRecipe.Serializer::new, IRecipeType.CRAFTING),
|
BLOCKZAPPER_UPGRADE(BlockzapperUpgradeRecipe.Serializer::new, IRecipeType.CRAFTING),
|
||||||
MECHANICAL_CRAFTING(MechanicalCraftingRecipe.Serializer::new),
|
MECHANICAL_CRAFTING(MechanicalCraftingRecipe.Serializer::new),
|
||||||
CRUSHING(processingSerializer(CrushingRecipe::new)),
|
CRUSHING(processingSerializer(CrushingRecipe::new)),
|
||||||
|
MILLING(processingSerializer(MillingRecipe::new)),
|
||||||
SPLASHING(processingSerializer(SplashingRecipe::new)),
|
SPLASHING(processingSerializer(SplashingRecipe::new)),
|
||||||
PRESSING(processingSerializer(PressingRecipe::new)),
|
PRESSING(processingSerializer(PressingRecipe::new)),
|
||||||
CUTTING(processingSerializer(CuttingRecipe::new)),
|
CUTTING(processingSerializer(CuttingRecipe::new)),
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
package com.simibubi.create;
|
package com.simibubi.create;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.foundation.utility.data.ICanGenerateJson;
|
|
||||||
import net.minecraft.data.DirectoryCache;
|
import net.minecraft.data.DirectoryCache;
|
||||||
import net.minecraft.data.IDataProvider;
|
import net.minecraft.data.IDataProvider;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
@ -14,10 +17,7 @@ import net.minecraft.util.SoundEvents;
|
||||||
import net.minecraftforge.event.RegistryEvent;
|
import net.minecraftforge.event.RegistryEvent;
|
||||||
import net.minecraftforge.registries.IForgeRegistry;
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
|
||||||
import java.io.IOException;
|
public enum AllSoundEvents implements IDataProvider {
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
public enum AllSoundEvents implements ICanGenerateJson {
|
|
||||||
|
|
||||||
CUCKOO_PIG("creeperclock"),
|
CUCKOO_PIG("creeperclock"),
|
||||||
CUCKOO_CREEPER("pigclock"),
|
CUCKOO_CREEPER("pigclock"),
|
||||||
|
@ -58,7 +58,7 @@ public enum AllSoundEvents implements ICanGenerateJson {
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getName() {
|
private String getEventName() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public enum AllSoundEvents implements ICanGenerateJson {
|
||||||
|
|
||||||
for (AllSoundEvents entry : values()) {
|
for (AllSoundEvents entry : values()) {
|
||||||
|
|
||||||
ResourceLocation rec = new ResourceLocation(Create.ID, entry.getName());
|
ResourceLocation rec = new ResourceLocation(Create.ID, entry.getEventName());
|
||||||
SoundEvent sound = new SoundEvent(rec).setRegistryName(rec);
|
SoundEvent sound = new SoundEvent(rec).setRegistryName(rec);
|
||||||
registry.register(sound);
|
registry.register(sound);
|
||||||
entry.event = sound;
|
entry.event = sound;
|
||||||
|
@ -91,11 +91,11 @@ public enum AllSoundEvents implements ICanGenerateJson {
|
||||||
arr.add(s);
|
arr.add(s);
|
||||||
} else {
|
} else {
|
||||||
// own sound
|
// own sound
|
||||||
arr.add(Create.ID + ":" + soundEvent.getName());
|
arr.add(Create.ID + ":" + soundEvent.getEventName());
|
||||||
}
|
}
|
||||||
entry.add("sounds", arr);
|
entry.add("sounds", arr);
|
||||||
entry.addProperty("subtitle", Create.ID + ".subtitle." + soundEvent.getName());
|
entry.addProperty("subtitle", Create.ID + ".subtitle." + soundEvent.getEventName());
|
||||||
json.add(soundEvent.getName(), entry);
|
json.add(soundEvent.getEventName(), entry);
|
||||||
}
|
}
|
||||||
IDataProvider.save(GSON, cache, json, path.resolve("sounds.json"));
|
IDataProvider.save(GSON, cache, json, path.resolve("sounds.json"));
|
||||||
|
|
||||||
|
@ -104,4 +104,14 @@ public enum AllSoundEvents implements ICanGenerateJson {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void act(DirectoryCache cache) throws IOException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ import com.simibubi.create.modules.contraptions.components.flywheel.FlywheelRend
|
||||||
import com.simibubi.create.modules.contraptions.components.flywheel.FlywheelTileEntity;
|
import com.simibubi.create.modules.contraptions.components.flywheel.FlywheelTileEntity;
|
||||||
import com.simibubi.create.modules.contraptions.components.flywheel.engine.EngineRenderer;
|
import com.simibubi.create.modules.contraptions.components.flywheel.engine.EngineRenderer;
|
||||||
import com.simibubi.create.modules.contraptions.components.flywheel.engine.FurnaceEngineTileEntity;
|
import com.simibubi.create.modules.contraptions.components.flywheel.engine.FurnaceEngineTileEntity;
|
||||||
|
import com.simibubi.create.modules.contraptions.components.millstone.MillstoneRenderer;
|
||||||
|
import com.simibubi.create.modules.contraptions.components.millstone.MillstoneTileEntity;
|
||||||
import com.simibubi.create.modules.contraptions.components.mixer.MechanicalMixerTileEntity;
|
import com.simibubi.create.modules.contraptions.components.mixer.MechanicalMixerTileEntity;
|
||||||
import com.simibubi.create.modules.contraptions.components.mixer.MechanicalMixerTileEntityRenderer;
|
import com.simibubi.create.modules.contraptions.components.mixer.MechanicalMixerTileEntityRenderer;
|
||||||
import com.simibubi.create.modules.contraptions.components.motor.MotorTileEntity;
|
import com.simibubi.create.modules.contraptions.components.motor.MotorTileEntity;
|
||||||
|
@ -131,6 +133,8 @@ public enum AllTileEntities {
|
||||||
HARVESTER(HarvesterTileEntity::new, AllBlocks.HARVESTER),
|
HARVESTER(HarvesterTileEntity::new, AllBlocks.HARVESTER),
|
||||||
FLYWHEEL(FlywheelTileEntity::new, AllBlocks.FLYWHEEL),
|
FLYWHEEL(FlywheelTileEntity::new, AllBlocks.FLYWHEEL),
|
||||||
FURNACE_ENGINE(FurnaceEngineTileEntity::new, AllBlocks.FURNACE_ENGINE),
|
FURNACE_ENGINE(FurnaceEngineTileEntity::new, AllBlocks.FURNACE_ENGINE),
|
||||||
|
|
||||||
|
MILLSTONE(MillstoneTileEntity::new, AllBlocks.MILLSTONE),
|
||||||
CRUSHING_WHEEL(CrushingWheelTileEntity::new, AllBlocks.CRUSHING_WHEEL),
|
CRUSHING_WHEEL(CrushingWheelTileEntity::new, AllBlocks.CRUSHING_WHEEL),
|
||||||
CRUSHING_WHEEL_CONTROLLER(CrushingWheelControllerTileEntity::new, AllBlocks.CRUSHING_WHEEL_CONTROLLER),
|
CRUSHING_WHEEL_CONTROLLER(CrushingWheelControllerTileEntity::new, AllBlocks.CRUSHING_WHEEL_CONTROLLER),
|
||||||
WATER_WHEEL(WaterWheelTileEntity::new, AllBlocks.WATER_WHEEL),
|
WATER_WHEEL(WaterWheelTileEntity::new, AllBlocks.WATER_WHEEL),
|
||||||
|
@ -181,7 +185,7 @@ public enum AllTileEntities {
|
||||||
for (AllTileEntities tileEntity : values()) {
|
for (AllTileEntities tileEntity : values()) {
|
||||||
Block[] blocks = new Block[tileEntity.blocks.length];
|
Block[] blocks = new Block[tileEntity.blocks.length];
|
||||||
for (int i = 0; i < blocks.length; i++)
|
for (int i = 0; i < blocks.length; i++)
|
||||||
blocks[i] = tileEntity.blocks[i].block;
|
blocks[i] = tileEntity.blocks[i].get();
|
||||||
|
|
||||||
ResourceLocation resourceLocation = new ResourceLocation(Create.ID, Lang.asId(tileEntity.name()));
|
ResourceLocation resourceLocation = new ResourceLocation(Create.ID, Lang.asId(tileEntity.name()));
|
||||||
tileEntity.type = TileEntityType.Builder.create(tileEntity.supplier, blocks).build(null)
|
tileEntity.type = TileEntityType.Builder.create(tileEntity.supplier, blocks).build(null)
|
||||||
|
@ -218,6 +222,7 @@ public enum AllTileEntities {
|
||||||
bind(ROPE_PULLEY, PulleyRenderer::new);
|
bind(ROPE_PULLEY, PulleyRenderer::new);
|
||||||
bind(HARVESTER, HarvesterTileEntityRenderer::new);
|
bind(HARVESTER, HarvesterTileEntityRenderer::new);
|
||||||
|
|
||||||
|
bind(MILLSTONE, MillstoneRenderer::new);
|
||||||
bind(CRUSHING_WHEEL, KineticTileEntityRenderer::new);
|
bind(CRUSHING_WHEEL, KineticTileEntityRenderer::new);
|
||||||
bind(MECHANICAL_PRESS, MechanicalPressTileEntityRenderer::new);
|
bind(MECHANICAL_PRESS, MechanicalPressTileEntityRenderer::new);
|
||||||
bind(MECHANICAL_MIXER, MechanicalMixerTileEntityRenderer::new);
|
bind(MECHANICAL_MIXER, MechanicalMixerTileEntityRenderer::new);
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
package com.simibubi.create;
|
package com.simibubi.create;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.advancement.AllTriggers;
|
|
||||||
import net.minecraft.util.SoundEvent;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import com.simibubi.create.config.AllConfigs;
|
import com.simibubi.create.config.AllConfigs;
|
||||||
|
import com.simibubi.create.foundation.advancement.AllTriggers;
|
||||||
import com.simibubi.create.foundation.command.CreateCommand;
|
import com.simibubi.create.foundation.command.CreateCommand;
|
||||||
import com.simibubi.create.foundation.command.ServerLagger;
|
import com.simibubi.create.foundation.command.ServerLagger;
|
||||||
import com.simibubi.create.foundation.world.AllWorldFeatures;
|
import com.simibubi.create.foundation.world.AllWorldFeatures;
|
||||||
|
@ -22,6 +21,7 @@ import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||||
import net.minecraft.particles.ParticleType;
|
import net.minecraft.particles.ParticleType;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
|
import net.minecraft.util.SoundEvent;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class CreateClient {
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
protected static ModelResourceLocation getBlockModelLocation(AllBlocks block, String suffix) {
|
protected static ModelResourceLocation getBlockModelLocation(AllBlocks block, String suffix) {
|
||||||
return new ModelResourceLocation(block.block.getRegistryName(), suffix);
|
return new ModelResourceLocation(block.get().getRegistryName(), suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
|
|
@ -46,8 +46,8 @@ public final class CreateItemGroup extends ItemGroup {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
def.asItem().fillItemGroup(this, items);
|
def.asItem().fillItemGroup(this, items);
|
||||||
for (Block alsoRegistered : block.alsoRegistered)
|
for (AllBlocks.TaggedBlock alsoRegistered : block.alsoRegistered)
|
||||||
alsoRegistered.asItem().fillItemGroup(this, items);
|
alsoRegistered.getBlock().asItem().fillItemGroup(this, items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.simibubi.create.compat.jei.category.BlockCuttingCategory.CondensedBlo
|
||||||
import com.simibubi.create.compat.jei.category.BlockzapperUpgradeCategory;
|
import com.simibubi.create.compat.jei.category.BlockzapperUpgradeCategory;
|
||||||
import com.simibubi.create.compat.jei.category.CrushingCategory;
|
import com.simibubi.create.compat.jei.category.CrushingCategory;
|
||||||
import com.simibubi.create.compat.jei.category.MechanicalCraftingCategory;
|
import com.simibubi.create.compat.jei.category.MechanicalCraftingCategory;
|
||||||
|
import com.simibubi.create.compat.jei.category.MillingCategory;
|
||||||
import com.simibubi.create.compat.jei.category.MixingCategory;
|
import com.simibubi.create.compat.jei.category.MixingCategory;
|
||||||
import com.simibubi.create.compat.jei.category.MysteriousItemConversionCategory;
|
import com.simibubi.create.compat.jei.category.MysteriousItemConversionCategory;
|
||||||
import com.simibubi.create.compat.jei.category.PackingCategory;
|
import com.simibubi.create.compat.jei.category.PackingCategory;
|
||||||
|
@ -55,6 +56,7 @@ import net.minecraft.util.text.TextFormatting;
|
||||||
public class CreateJEI implements IModPlugin {
|
public class CreateJEI implements IModPlugin {
|
||||||
|
|
||||||
private static ResourceLocation ID = new ResourceLocation(Create.ID, "jei_plugin");
|
private static ResourceLocation ID = new ResourceLocation(Create.ID, "jei_plugin");
|
||||||
|
private MillingCategory millingCategory;
|
||||||
private CrushingCategory crushingCategory;
|
private CrushingCategory crushingCategory;
|
||||||
private SplashingCategory splashingCategory;
|
private SplashingCategory splashingCategory;
|
||||||
private SmokingViaFanCategory smokingCategory;
|
private SmokingViaFanCategory smokingCategory;
|
||||||
|
@ -76,6 +78,7 @@ public class CreateJEI implements IModPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public CreateJEI() {
|
public CreateJEI() {
|
||||||
|
millingCategory = new MillingCategory();
|
||||||
crushingCategory = new CrushingCategory();
|
crushingCategory = new CrushingCategory();
|
||||||
splashingCategory = new SplashingCategory();
|
splashingCategory = new SplashingCategory();
|
||||||
pressingCategory = new PressingCategory();
|
pressingCategory = new PressingCategory();
|
||||||
|
@ -99,15 +102,18 @@ public class CreateJEI implements IModPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerCategories(IRecipeCategoryRegistration registration) {
|
public void registerCategories(IRecipeCategoryRegistration registration) {
|
||||||
registration.addRecipeCategories(crushingCategory, splashingCategory, pressingCategory, smokingCategory,
|
registration.addRecipeCategories(millingCategory, crushingCategory, splashingCategory, pressingCategory,
|
||||||
blastingCategory, blockzapperCategory, mixingCategory, sawingCategory, blockCuttingCategory,
|
smokingCategory, blastingCategory, blockzapperCategory, mixingCategory, sawingCategory,
|
||||||
packingCategory, polishingCategory, mysteryConversionCategory, smallMechanicalCraftingCategory,
|
blockCuttingCategory, packingCategory, polishingCategory, mysteryConversionCategory,
|
||||||
largeMechanicalCraftingCategory);
|
smallMechanicalCraftingCategory, largeMechanicalCraftingCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerRecipes(IRecipeRegistration registration) {
|
public void registerRecipes(IRecipeRegistration registration) {
|
||||||
|
registration.addRecipes(findRecipes(AllRecipes.MILLING), millingCategory.getUid());
|
||||||
registration.addRecipes(findRecipes(AllRecipes.CRUSHING), crushingCategory.getUid());
|
registration.addRecipes(findRecipes(AllRecipes.CRUSHING), crushingCategory.getUid());
|
||||||
|
registration.addRecipes(findRecipesByTypeExcluding(AllRecipes.MILLING.getType(), AllRecipes.CRUSHING.getType()),
|
||||||
|
crushingCategory.getUid());
|
||||||
registration.addRecipes(findRecipes(AllRecipes.SPLASHING), splashingCategory.getUid());
|
registration.addRecipes(findRecipes(AllRecipes.SPLASHING), splashingCategory.getUid());
|
||||||
registration.addRecipes(findRecipes(AllRecipes.PRESSING), pressingCategory.getUid());
|
registration.addRecipes(findRecipes(AllRecipes.PRESSING), pressingCategory.getUid());
|
||||||
registration.addRecipes(findRecipesById(AllRecipes.BLOCKZAPPER_UPGRADE.serializer.getRegistryName()),
|
registration.addRecipes(findRecipesById(AllRecipes.BLOCKZAPPER_UPGRADE.serializer.getRegistryName()),
|
||||||
|
@ -134,11 +140,14 @@ public class CreateJEI implements IModPlugin {
|
||||||
r -> (r instanceof MechanicalCraftingRecipe) && MechanicalCraftingCategory.isSmall((ShapedRecipe) r)),
|
r -> (r instanceof MechanicalCraftingRecipe) && MechanicalCraftingCategory.isSmall((ShapedRecipe) r)),
|
||||||
smallMechanicalCraftingCategory.getUid());
|
smallMechanicalCraftingCategory.getUid());
|
||||||
registration.addRecipes(
|
registration.addRecipes(
|
||||||
findRecipes(r -> (r instanceof ShapedRecipe) && !(r instanceof MechanicalCraftingRecipe)
|
findRecipes(
|
||||||
&& MechanicalCraftingCategory.isSmall((ShapedRecipe) r)),
|
r -> (r.getType() == IRecipeType.CRAFTING || r.getType() == AllRecipes.MECHANICAL_CRAFTING.type)
|
||||||
|
&& (r instanceof ShapedRecipe) && !(r instanceof MechanicalCraftingRecipe)
|
||||||
|
&& MechanicalCraftingCategory.isSmall((ShapedRecipe) r)),
|
||||||
smallMechanicalCraftingCategory.getUid());
|
smallMechanicalCraftingCategory.getUid());
|
||||||
registration.addRecipes(
|
registration.addRecipes(findRecipes(
|
||||||
findRecipes(r -> (r instanceof ShapedRecipe) && !MechanicalCraftingCategory.isSmall((ShapedRecipe) r)),
|
r -> (r.getType() == IRecipeType.CRAFTING || r.getType() == AllRecipes.MECHANICAL_CRAFTING.type)
|
||||||
|
&& (r instanceof ShapedRecipe) && !MechanicalCraftingCategory.isSmall((ShapedRecipe) r)),
|
||||||
largeMechanicalCraftingCategory.getUid());
|
largeMechanicalCraftingCategory.getUid());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -154,6 +163,7 @@ public class CreateJEI implements IModPlugin {
|
||||||
ItemStack blastingFan = fan.copy().setDisplayName(
|
ItemStack blastingFan = fan.copy().setDisplayName(
|
||||||
new StringTextComponent(TextFormatting.RESET + Lang.translate("recipe.blastingViaFan.fan")));
|
new StringTextComponent(TextFormatting.RESET + Lang.translate("recipe.blastingViaFan.fan")));
|
||||||
|
|
||||||
|
registration.addRecipeCatalyst(new ItemStack(AllBlocks.MILLSTONE.get()), millingCategory.getUid());
|
||||||
registration.addRecipeCatalyst(new ItemStack(AllBlocks.CRUSHING_WHEEL.get()), crushingCategory.getUid());
|
registration.addRecipeCatalyst(new ItemStack(AllBlocks.CRUSHING_WHEEL.get()), crushingCategory.getUid());
|
||||||
registration.addRecipeCatalyst(splashingFan, splashingCategory.getUid());
|
registration.addRecipeCatalyst(splashingFan, splashingCategory.getUid());
|
||||||
registration.addRecipeCatalyst(smokingFan, smokingCategory.getUid());
|
registration.addRecipeCatalyst(smokingFan, smokingCategory.getUid());
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.simibubi.create.compat.jei.DoubleItemIcon;
|
||||||
import com.simibubi.create.compat.jei.EmptyBackground;
|
import com.simibubi.create.compat.jei.EmptyBackground;
|
||||||
import com.simibubi.create.compat.jei.category.animations.AnimatedCrushingWheels;
|
import com.simibubi.create.compat.jei.category.animations.AnimatedCrushingWheels;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.modules.contraptions.components.crusher.CrushingRecipe;
|
import com.simibubi.create.modules.contraptions.components.crusher.AbstractCrushingRecipe;
|
||||||
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
|
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
|
||||||
|
|
||||||
import mezz.jei.api.constants.VanillaTypes;
|
import mezz.jei.api.constants.VanillaTypes;
|
||||||
|
@ -24,7 +24,7 @@ import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class CrushingCategory implements IRecipeCategory<CrushingRecipe> {
|
public class CrushingCategory implements IRecipeCategory<AbstractCrushingRecipe> {
|
||||||
|
|
||||||
private static ResourceLocation ID = new ResourceLocation(Create.ID, "crushing");
|
private static ResourceLocation ID = new ResourceLocation(Create.ID, "crushing");
|
||||||
private AnimatedCrushingWheels crushingWheels = new AnimatedCrushingWheels();
|
private AnimatedCrushingWheels crushingWheels = new AnimatedCrushingWheels();
|
||||||
|
@ -33,7 +33,7 @@ public class CrushingCategory implements IRecipeCategory<CrushingRecipe> {
|
||||||
|
|
||||||
public CrushingCategory() {
|
public CrushingCategory() {
|
||||||
icon = new DoubleItemIcon(() -> new ItemStack(AllBlocks.CRUSHING_WHEEL.get()),
|
icon = new DoubleItemIcon(() -> new ItemStack(AllBlocks.CRUSHING_WHEEL.get()),
|
||||||
() -> new ItemStack(AllItems.FLOUR.get()));
|
() -> new ItemStack(AllItems.CRUSHED_GOLD.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,8 +47,8 @@ public class CrushingCategory implements IRecipeCategory<CrushingRecipe> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends CrushingRecipe> getRecipeClass() {
|
public Class<? extends AbstractCrushingRecipe> getRecipeClass() {
|
||||||
return CrushingRecipe.class;
|
return AbstractCrushingRecipe.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -62,13 +62,13 @@ public class CrushingCategory implements IRecipeCategory<CrushingRecipe> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIngredients(CrushingRecipe recipe, IIngredients ingredients) {
|
public void setIngredients(AbstractCrushingRecipe recipe, IIngredients ingredients) {
|
||||||
ingredients.setInputIngredients(recipe.getIngredients());
|
ingredients.setInputIngredients(recipe.getIngredients());
|
||||||
ingredients.setOutputs(VanillaTypes.ITEM, recipe.getPossibleOutputs());
|
ingredients.setOutputs(VanillaTypes.ITEM, recipe.getPossibleOutputs());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRecipe(IRecipeLayout recipeLayout, CrushingRecipe recipe, IIngredients ingredients) {
|
public void setRecipe(IRecipeLayout recipeLayout, AbstractCrushingRecipe recipe, IIngredients ingredients) {
|
||||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||||
itemStacks.init(0, true, 50, 2);
|
itemStacks.init(0, true, 50, 2);
|
||||||
itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks()));
|
itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks()));
|
||||||
|
@ -85,7 +85,7 @@ public class CrushingCategory implements IRecipeCategory<CrushingRecipe> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(CrushingRecipe recipe, double mouseX, double mouseY) {
|
public void draw(AbstractCrushingRecipe recipe, double mouseX, double mouseY) {
|
||||||
List<ProcessingOutput> results = recipe.getRollableResults();
|
List<ProcessingOutput> results = recipe.getRollableResults();
|
||||||
ScreenResources.JEI_SLOT.draw(50, 2);
|
ScreenResources.JEI_SLOT.draw(50, 2);
|
||||||
ScreenResources.JEI_DOWN_ARROW.draw(72, 7);
|
ScreenResources.JEI_DOWN_ARROW.draw(72, 7);
|
||||||
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
package com.simibubi.create.compat.jei.category;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.simibubi.create.AllBlocks;
|
||||||
|
import com.simibubi.create.AllItems;
|
||||||
|
import com.simibubi.create.Create;
|
||||||
|
import com.simibubi.create.ScreenResources;
|
||||||
|
import com.simibubi.create.compat.jei.CreateJEI;
|
||||||
|
import com.simibubi.create.compat.jei.DoubleItemIcon;
|
||||||
|
import com.simibubi.create.compat.jei.EmptyBackground;
|
||||||
|
import com.simibubi.create.compat.jei.category.animations.AnimatedMillstone;
|
||||||
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
import com.simibubi.create.modules.contraptions.components.crusher.AbstractCrushingRecipe;
|
||||||
|
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
|
||||||
|
|
||||||
|
import mezz.jei.api.constants.VanillaTypes;
|
||||||
|
import mezz.jei.api.gui.IRecipeLayout;
|
||||||
|
import mezz.jei.api.gui.drawable.IDrawable;
|
||||||
|
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
|
||||||
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
|
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class MillingCategory implements IRecipeCategory<AbstractCrushingRecipe> {
|
||||||
|
|
||||||
|
private static ResourceLocation ID = new ResourceLocation(Create.ID, "milling");
|
||||||
|
private AnimatedMillstone millstone = new AnimatedMillstone();
|
||||||
|
private IDrawable icon;
|
||||||
|
private IDrawable background = new EmptyBackground(177, 53);
|
||||||
|
|
||||||
|
public MillingCategory() {
|
||||||
|
icon = new DoubleItemIcon(() -> new ItemStack(AllBlocks.MILLSTONE.get()),
|
||||||
|
() -> new ItemStack(AllItems.FLOUR.get()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IDrawable getBackground() {
|
||||||
|
return background;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getUid() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends AbstractCrushingRecipe> getRecipeClass() {
|
||||||
|
return AbstractCrushingRecipe.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTitle() {
|
||||||
|
return Lang.translate("recipe.milling");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IDrawable getIcon() {
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIngredients(AbstractCrushingRecipe recipe, IIngredients ingredients) {
|
||||||
|
ingredients.setInputIngredients(recipe.getIngredients());
|
||||||
|
ingredients.setOutputs(VanillaTypes.ITEM, recipe.getPossibleOutputs());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRecipe(IRecipeLayout recipeLayout, AbstractCrushingRecipe recipe, IIngredients ingredients) {
|
||||||
|
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||||
|
itemStacks.init(0, true, 14, 8);
|
||||||
|
itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks()));
|
||||||
|
|
||||||
|
List<ProcessingOutput> results = recipe.getRollableResults();
|
||||||
|
boolean single = results.size() == 1;
|
||||||
|
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) {
|
||||||
|
int xOffset = outputIndex % 2 == 0 ? 0 : 19;
|
||||||
|
int yOffset = (outputIndex / 2) * -19;
|
||||||
|
|
||||||
|
itemStacks.init(outputIndex + 1, false, single ? 139 : 133 + xOffset, 27 + yOffset);
|
||||||
|
itemStacks.set(outputIndex + 1, results.get(outputIndex).getStack());
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateJEI.addStochasticTooltip(itemStacks, results);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(AbstractCrushingRecipe recipe, double mouseX, double mouseY) {
|
||||||
|
int size = recipe.getPossibleOutputs().size();
|
||||||
|
|
||||||
|
ScreenResources.JEI_SLOT.draw(14, 8);
|
||||||
|
ScreenResources.JEI_SHADOW.draw(30, 40);
|
||||||
|
ScreenResources.JEI_ARROW.draw(85, 32);
|
||||||
|
ScreenResources.JEI_DOWN_ARROW.draw(43, 4);
|
||||||
|
|
||||||
|
if (size > 1) {
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
int xOffset = i % 2 == 0 ? 0 : 19;
|
||||||
|
int yOffset = (i / 2) * -19;
|
||||||
|
ScreenResources.JEI_SLOT.draw(133 + xOffset, 27 + yOffset);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ScreenResources.JEI_SLOT.draw(139, 27);
|
||||||
|
}
|
||||||
|
|
||||||
|
millstone.draw(57, 27);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.simibubi.create.compat.jei.category.animations;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
import com.simibubi.create.AllBlocks;
|
||||||
|
import com.simibubi.create.foundation.gui.ScreenElementRenderer;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
|
|
||||||
|
public class AnimatedMillstone extends AnimatedKinetics {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWidth() {
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHeight() {
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(int xOffset, int yOffset) {
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
GlStateManager.enableDepthTest();
|
||||||
|
GlStateManager.translatef(xOffset, yOffset, 0);
|
||||||
|
GlStateManager.rotatef(-15.5f, 1, 0, 0);
|
||||||
|
GlStateManager.rotatef(22.5f, 0, 1, 0);
|
||||||
|
GlStateManager.translatef(-45, -5, 0);
|
||||||
|
GlStateManager.scaled(.45f, .45f, .45f);
|
||||||
|
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
ScreenElementRenderer.renderModel(this::cogwheel);
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
ScreenElementRenderer.renderBlock(this::body);
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
private IBakedModel cogwheel() {
|
||||||
|
float t = 25;
|
||||||
|
GlStateManager.translatef(t, -t, -t);
|
||||||
|
GlStateManager.rotated(getCurrentAngle() * 2, 0, 1, 0);
|
||||||
|
GlStateManager.translatef(-t, t, t);
|
||||||
|
return AllBlockPartials.MILLSTONE_COG.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
private BlockState body() {
|
||||||
|
return AllBlocks.MILLSTONE.get().getDefaultState();
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,8 @@ public class CClient extends ConfigBase {
|
||||||
public ConfigGroup client = group(0, "client",
|
public ConfigGroup client = group(0, "client",
|
||||||
"Client-only settings - If you're looking for general settings, look inside your worlds serverconfig folder!");
|
"Client-only settings - If you're looking for general settings, look inside your worlds serverconfig folder!");
|
||||||
public ConfigBool tooltips = b(true, "enableTooltips", "Show item descriptions on Shift and controls on Ctrl.");
|
public ConfigBool tooltips = b(true, "enableTooltips", "Show item descriptions on Shift and controls on Ctrl.");
|
||||||
|
public ConfigBool enableOverstressedTooltip =
|
||||||
|
b(true, "enableOverstressedTooltip", "Display a tooltip when looking at overstressed components.");
|
||||||
public ConfigBool explainRenderErrors =
|
public ConfigBool explainRenderErrors =
|
||||||
b(false, "explainRenderErrors", "Log a stack-trace when rendering issues happen within a moving contraption.");
|
b(false, "explainRenderErrors", "Log a stack-trace when rendering issues happen within a moving contraption.");
|
||||||
public ConfigFloat fanParticleDensity = f(.5f, 0, 1, "fanParticleDensity");
|
public ConfigFloat fanParticleDensity = f(.5f, 0, 1, "fanParticleDensity");
|
||||||
|
|
|
@ -40,6 +40,7 @@ public class StressConfigDefaults {
|
||||||
case SAW:
|
case SAW:
|
||||||
case DEPLOYER:
|
case DEPLOYER:
|
||||||
case MECHANICAL_MIXER:
|
case MECHANICAL_MIXER:
|
||||||
|
case MILLSTONE:
|
||||||
return 4;
|
return 4;
|
||||||
|
|
||||||
case MECHANICAL_CRAFTER:
|
case MECHANICAL_CRAFTER:
|
||||||
|
|
|
@ -1,16 +1,21 @@
|
||||||
package com.simibubi.create.foundation.advancement;
|
package com.simibubi.create.foundation.advancement;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
|
|
||||||
import net.minecraft.advancements.ICriterionTrigger;
|
import net.minecraft.advancements.ICriterionTrigger;
|
||||||
import net.minecraft.advancements.PlayerAdvancements;
|
import net.minecraft.advancements.PlayerAdvancements;
|
||||||
import net.minecraft.advancements.criterion.CriterionInstance;
|
import net.minecraft.advancements.criterion.CriterionInstance;
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
public abstract class CriterionTriggerBase<T extends CriterionTriggerBase.Instance> implements ICriterionTrigger<T> {
|
public abstract class CriterionTriggerBase<T extends CriterionTriggerBase.Instance> implements ICriterionTrigger<T> {
|
||||||
|
|
||||||
public CriterionTriggerBase(String id) {
|
public CriterionTriggerBase(String id) {
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
package com.simibubi.create.foundation.advancement;
|
package com.simibubi.create.foundation.advancement;
|
||||||
|
|
||||||
import com.google.gson.JsonDeserializationContext;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import net.minecraft.advancements.criterion.ItemPredicate;
|
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import com.google.gson.JsonDeserializationContext;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import net.minecraft.advancements.criterion.ItemPredicate;
|
||||||
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class SandpaperUseTrigger extends CriterionTriggerBase<SandpaperUseTrigger.Instance> {
|
public class SandpaperUseTrigger extends CriterionTriggerBase<SandpaperUseTrigger.Instance> {
|
||||||
|
|
||||||
public SandpaperUseTrigger(String id) {
|
public SandpaperUseTrigger(String id) {
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package com.simibubi.create.foundation.advancement;
|
package com.simibubi.create.foundation.advancement;
|
||||||
|
|
||||||
import com.google.gson.JsonDeserializationContext;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import com.google.gson.JsonDeserializationContext;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class SimpleTrigger extends CriterionTriggerBase<SimpleTrigger.Instance> {
|
public class SimpleTrigger extends CriterionTriggerBase<SimpleTrigger.Instance> {
|
||||||
|
|
||||||
public SimpleTrigger(String id) {
|
public SimpleTrigger(String id) {
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class FilteringBehaviour extends TileEntityBehaviour {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean test(ItemStack stack) {
|
public boolean test(ItemStack stack) {
|
||||||
return filter.isEmpty() || FilterItem.test(stack, filter);
|
return filter.isEmpty() || FilterItem.test(tileEntity.getWorld(), stack, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.simibubi.create.foundation.command;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.builder.ArgumentBuilder;
|
||||||
|
import com.simibubi.create.CreateClient;
|
||||||
|
|
||||||
|
import net.minecraft.command.CommandSource;
|
||||||
|
import net.minecraft.command.Commands;
|
||||||
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
|
public class ClearBufferCacheCommand {
|
||||||
|
|
||||||
|
static ArgumentBuilder<CommandSource, ?> register() {
|
||||||
|
return Commands.literal("clearRenderBuffers").requires(cs -> cs.hasPermissionLevel(0)).executes(ctx -> {
|
||||||
|
DistExecutor.runWhenOn(Dist.CLIENT, () -> ClearBufferCacheCommand::execute);
|
||||||
|
ctx.getSource().sendFeedback(new StringTextComponent("Cleared rendering buffers."), true);
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
private static void execute() {
|
||||||
|
CreateClient.bufferCache.invalidate();
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,10 @@ import net.minecraft.command.Commands;
|
||||||
public class CreateCommand {
|
public class CreateCommand {
|
||||||
|
|
||||||
public CreateCommand(CommandDispatcher<CommandSource> dispatcher) {
|
public CreateCommand(CommandDispatcher<CommandSource> dispatcher) {
|
||||||
// KillTPSCommand.register(dispatcher); Commented out for release
|
dispatcher.register(Commands.literal("create")
|
||||||
dispatcher.register(Commands.literal("create").then(ToggleDebugCommand.register()));
|
.then(ToggleDebugCommand.register())
|
||||||
|
.then(ClearBufferCacheCommand.register())
|
||||||
|
//.then(KillTPSCommand.register()) //Commented out for release
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.simibubi.create.foundation.command;
|
package com.simibubi.create.foundation.command;
|
||||||
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
|
||||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||||
|
import com.mojang.brigadier.builder.ArgumentBuilder;
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ import net.minecraft.command.Commands;
|
||||||
|
|
||||||
public class KillTPSCommand {
|
public class KillTPSCommand {
|
||||||
|
|
||||||
public static void register(CommandDispatcher<CommandSource> dispatcher) {
|
public static ArgumentBuilder<CommandSource ,?> register() {
|
||||||
dispatcher.register(Commands.literal(Lang.translate("command.killTPSCommand"))
|
return Commands.literal("killtps")
|
||||||
.requires(cs -> cs.hasPermissionLevel(2)).executes(ctx -> {
|
.requires(cs -> cs.hasPermissionLevel(2)).executes(ctx -> {
|
||||||
// killtps no arguments
|
// killtps no arguments
|
||||||
ctx.getSource().sendFeedback(
|
ctx.getSource().sendFeedback(
|
||||||
|
@ -63,6 +63,6 @@ public class KillTPSCommand {
|
||||||
Lang.createTranslationTextComponent("command.killTPSCommand.status.slowed_by.2"), false);
|
Lang.createTranslationTextComponent("command.killTPSCommand.status.slowed_by.2"), false);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
})));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.mojang.brigadier.arguments.BoolArgumentType;
|
||||||
import com.mojang.brigadier.builder.ArgumentBuilder;
|
import com.mojang.brigadier.builder.ArgumentBuilder;
|
||||||
import com.simibubi.create.AllPackets;
|
import com.simibubi.create.AllPackets;
|
||||||
import com.simibubi.create.config.AllConfigs;
|
import com.simibubi.create.config.AllConfigs;
|
||||||
|
|
||||||
import net.minecraft.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
import net.minecraft.command.Commands;
|
import net.minecraft.command.Commands;
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
|
|
|
@ -1,5 +1,26 @@
|
||||||
package com.simibubi.create.foundation.item;
|
package com.simibubi.create.foundation.item;
|
||||||
|
|
||||||
|
import static com.simibubi.create.foundation.item.TooltipHelper.cutString;
|
||||||
|
import static net.minecraft.util.text.TextFormatting.AQUA;
|
||||||
|
import static net.minecraft.util.text.TextFormatting.BLUE;
|
||||||
|
import static net.minecraft.util.text.TextFormatting.DARK_GRAY;
|
||||||
|
import static net.minecraft.util.text.TextFormatting.DARK_GREEN;
|
||||||
|
import static net.minecraft.util.text.TextFormatting.DARK_PURPLE;
|
||||||
|
import static net.minecraft.util.text.TextFormatting.DARK_RED;
|
||||||
|
import static net.minecraft.util.text.TextFormatting.GOLD;
|
||||||
|
import static net.minecraft.util.text.TextFormatting.GRAY;
|
||||||
|
import static net.minecraft.util.text.TextFormatting.GREEN;
|
||||||
|
import static net.minecraft.util.text.TextFormatting.LIGHT_PURPLE;
|
||||||
|
import static net.minecraft.util.text.TextFormatting.RED;
|
||||||
|
import static net.minecraft.util.text.TextFormatting.STRIKETHROUGH;
|
||||||
|
import static net.minecraft.util.text.TextFormatting.WHITE;
|
||||||
|
import static net.minecraft.util.text.TextFormatting.YELLOW;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.config.AllConfigs;
|
import com.simibubi.create.config.AllConfigs;
|
||||||
import com.simibubi.create.config.CKinetics;
|
import com.simibubi.create.config.CKinetics;
|
||||||
|
@ -11,6 +32,7 @@ import com.simibubi.create.modules.contraptions.components.fan.EncasedFanBlock;
|
||||||
import com.simibubi.create.modules.contraptions.components.flywheel.engine.EngineBlock;
|
import com.simibubi.create.modules.contraptions.components.flywheel.engine.EngineBlock;
|
||||||
import com.simibubi.create.modules.contraptions.components.flywheel.engine.FurnaceEngineBlock;
|
import com.simibubi.create.modules.contraptions.components.flywheel.engine.FurnaceEngineBlock;
|
||||||
import com.simibubi.create.modules.contraptions.components.waterwheel.WaterWheelBlock;
|
import com.simibubi.create.modules.contraptions.components.waterwheel.WaterWheelBlock;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
@ -21,14 +43,6 @@ import net.minecraft.util.text.StringTextComponent;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
|
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static com.simibubi.create.foundation.item.TooltipHelper.cutString;
|
|
||||||
import static net.minecraft.util.text.TextFormatting.*;
|
|
||||||
|
|
||||||
public class ItemDescription {
|
public class ItemDescription {
|
||||||
|
|
||||||
public static final ItemDescription MISSING = new ItemDescription(null);
|
public static final ItemDescription MISSING = new ItemDescription(null);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import com.simibubi.create.modules.contraptions.base.IRotate;
|
||||||
import com.simibubi.create.modules.contraptions.components.flywheel.engine.EngineBlock;
|
import com.simibubi.create.modules.contraptions.components.flywheel.engine.EngineBlock;
|
||||||
import com.simibubi.create.modules.curiosities.tools.AllToolTiers;
|
import com.simibubi.create.modules.curiosities.tools.AllToolTiers;
|
||||||
|
|
||||||
|
import com.simibubi.create.modules.curiosities.tools.SandPaperItem;
|
||||||
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.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
|
@ -177,6 +178,9 @@ public class TooltipHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stack.getItem() instanceof SandPaperItem)
|
||||||
|
return "tool.create.sand_paper.tooltip";
|
||||||
|
|
||||||
return stack.getItem().getTranslationKey(stack) + ".tooltip";
|
return stack.getItem().getTranslationKey(stack) + ".tooltip";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,10 @@ public class AllShapes {
|
||||||
SIX_VOXEL_POLE = shape(5, 0, 5, 11, 16, 11).forAxis(),
|
SIX_VOXEL_POLE = shape(5, 0, 5, 11, 16, 11).forAxis(),
|
||||||
BELT_FUNNEL = shape(3, -4, 11, 13, 8, 17).forHorizontal(SOUTH),
|
BELT_FUNNEL = shape(3, -4, 11, 13, 8, 17).forHorizontal(SOUTH),
|
||||||
FUNNEL = shape(1, 1, 13, 15, 15, 17).forDirectional(SOUTH),
|
FUNNEL = shape(1, 1, 13, 15, 15, 17).forDirectional(SOUTH),
|
||||||
EXTRACTOR = shape(4, 2, 11, 12, 10, 17).forDirectional(SOUTH)
|
EXTRACTOR =
|
||||||
.withVerticalShapes(cuboid(4, 11, 4, 12, 17, 12)),
|
shape(4, 2, 11, 12, 10, 17).forDirectional(SOUTH).withVerticalShapes(cuboid(4, 11, 4, 12, 17, 12)),
|
||||||
TRANSPOSER = shape(4, 4, -1, 12, 12, 1).add(5, 5, 0, 11, 11, 16).add(4, 4, 11, 12, 12, 17)
|
TRANSPOSER =
|
||||||
.forDirectional(SOUTH),
|
shape(4, 4, -1, 12, 12, 1).add(5, 5, 0, 11, 11, 16).add(4, 4, 11, 12, 12, 17).forDirectional(SOUTH),
|
||||||
FURNACE_ENGINE = shape(1, 1, 0, 15, 15, 16).add(0, 0, 9, 16, 16, 14).forHorizontal(Direction.SOUTH),
|
FURNACE_ENGINE = shape(1, 1, 0, 15, 15, 16).add(0, 0, 9, 16, 16, 14).forHorizontal(Direction.SOUTH),
|
||||||
PORTABLE_STORAGE_INTERFACE = shape(0, 0, 0, 16, 12, 16).add(3, 12, 3, 13, 16, 13).forDirectional(),
|
PORTABLE_STORAGE_INTERFACE = shape(0, 0, 0, 16, 12, 16).add(3, 12, 3, 13, 16, 13).forDirectional(),
|
||||||
PULLEY = shape(0, 0, 0, 16, 16, 2).add(1, 1, 2, 15, 15, 14).add(0, 0, 14, 16, 16, 16).forHorizontalAxis(),
|
PULLEY = shape(0, 0, 0, 16, 16, 2).add(1, 1, 2, 15, 15, 14).add(0, 0, 14, 16, 16, 16).forHorizontalAxis(),
|
||||||
|
@ -57,6 +57,7 @@ public class AllShapes {
|
||||||
BELT_COLLISION_MASK = cuboid(0, 0, 0, 16, 19, 16),
|
BELT_COLLISION_MASK = cuboid(0, 0, 0, 16, 19, 16),
|
||||||
SCHEMATICANNON_SHAPE = shape(1, 0, 1, 15, 8, 15).add(0.5, 8, 0.5, 15.5, 11, 15.5).build(),
|
SCHEMATICANNON_SHAPE = shape(1, 0, 1, 15, 8, 15).add(0.5, 8, 0.5, 15.5, 11, 15.5).build(),
|
||||||
PULLEY_MAGNET = shape(3, 0, 3, 13, 2, 13).add(FOUR_VOXEL_POLE.get(UP)).build(),
|
PULLEY_MAGNET = shape(3, 0, 3, 13, 2, 13).add(FOUR_VOXEL_POLE.get(UP)).build(),
|
||||||
|
MILLSTONE = shape(0, 0, 0, 16, 6, 16).add(2, 6, 2, 14, 13, 14).add(3, 13, 3, 13, 16, 13).build(),
|
||||||
GAUGE_SHAPE_UP = shape(1, 0, 0, 15, 2, 16).add(2, 2, 1, 14, 14, 15).build()
|
GAUGE_SHAPE_UP = shape(1, 0, 0, 15, 2, 16).add(2, 2, 1, 14, 14, 15).build()
|
||||||
|
|
||||||
;
|
;
|
||||||
|
@ -64,15 +65,16 @@ public class AllShapes {
|
||||||
// Internally Shared Shapes
|
// Internally Shared Shapes
|
||||||
private static final VoxelShape
|
private static final VoxelShape
|
||||||
|
|
||||||
PISTON_HEAD = Blocks.PISTON_HEAD.getDefaultState().with(DirectionalBlock.FACING, UP)
|
PISTON_HEAD =
|
||||||
.with(PistonHeadBlock.SHORT, true).getShape(null, null),
|
Blocks.PISTON_HEAD.getDefaultState().with(DirectionalBlock.FACING, UP).with(PistonHeadBlock.SHORT, true)
|
||||||
|
.getShape(null, null),
|
||||||
PISTON_EXTENDED = shape(CASING_12PX.get(UP)).add(FOUR_VOXEL_POLE.get(Axis.Y)).build(),
|
PISTON_EXTENDED = shape(CASING_12PX.get(UP)).add(FOUR_VOXEL_POLE.get(Axis.Y)).build(),
|
||||||
SMALL_GEAR_SHAPE = cuboid(2, 6, 2, 14, 10, 14), LARGE_GEAR_SHAPE = cuboid(0, 6, 0, 16, 10, 16),
|
SMALL_GEAR_SHAPE = cuboid(2, 6, 2, 14, 10, 14), LARGE_GEAR_SHAPE = cuboid(0, 6, 0, 16, 10, 16),
|
||||||
VERTICAL_TABLET_SHAPE = cuboid(3, 1, -1, 13, 15, 3), SQUARE_TABLET_SHAPE = cuboid(2, 2, -1, 14, 14, 3),
|
VERTICAL_TABLET_SHAPE = cuboid(3, 1, -1, 13, 15, 3), SQUARE_TABLET_SHAPE = cuboid(2, 2, -1, 14, 14, 3),
|
||||||
LOGISTICS_TABLE_SLOPE = shape(0, 10, 15, 16, 14, 10.667).add(0, 12, 10.667, 16, 16, 6.333)
|
LOGISTICS_TABLE_SLOPE =
|
||||||
.add(0, 14, 6.333, 16, 18, 2).build(),
|
shape(0, 10, 15, 16, 14, 10.667).add(0, 12, 10.667, 16, 16, 6.333).add(0, 14, 6.333, 16, 18, 2).build(),
|
||||||
SCHEMATICS_TABLE_SLOPE = shape(0, 10, 16, 16, 14, 11).add(0, 12, 11, 16, 16, 6).add(0, 14, 6, 16, 18, 1)
|
SCHEMATICS_TABLE_SLOPE =
|
||||||
.build()
|
shape(0, 10, 16, 16, 14, 11).add(0, 12, 11, 16, 16, 6).add(0, 14, 6, 16, 18, 1).build()
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -84,8 +86,8 @@ public class AllShapes {
|
||||||
SMALL_GEAR = shape(SMALL_GEAR_SHAPE).add(SIX_VOXEL_POLE.get(Axis.Y)).forAxis(),
|
SMALL_GEAR = shape(SMALL_GEAR_SHAPE).add(SIX_VOXEL_POLE.get(Axis.Y)).forAxis(),
|
||||||
LARGE_GEAR = shape(LARGE_GEAR_SHAPE).add(SIX_VOXEL_POLE.get(Axis.Y)).forAxis(),
|
LARGE_GEAR = shape(LARGE_GEAR_SHAPE).add(SIX_VOXEL_POLE.get(Axis.Y)).forAxis(),
|
||||||
LOGISTICAL_CONTROLLER = shape(SQUARE_TABLET_SHAPE).forDirectional(SOUTH),
|
LOGISTICAL_CONTROLLER = shape(SQUARE_TABLET_SHAPE).forDirectional(SOUTH),
|
||||||
REDSTONE_BRIDGE = shape(VERTICAL_TABLET_SHAPE).forDirectional(SOUTH)
|
REDSTONE_BRIDGE =
|
||||||
.withVerticalShapes(LOGISTICAL_CONTROLLER.get(UP)),
|
shape(VERTICAL_TABLET_SHAPE).forDirectional(SOUTH).withVerticalShapes(LOGISTICAL_CONTROLLER.get(UP)),
|
||||||
LOGISTICS_TABLE = shape(TABLE_POLE_SHAPE).add(LOGISTICS_TABLE_SLOPE).forHorizontal(SOUTH),
|
LOGISTICS_TABLE = shape(TABLE_POLE_SHAPE).add(LOGISTICS_TABLE_SLOPE).forHorizontal(SOUTH),
|
||||||
SCHEMATICS_TABLE = shape(TABLE_POLE_SHAPE).add(SCHEMATICS_TABLE_SLOPE).forDirectional(SOUTH)
|
SCHEMATICS_TABLE = shape(TABLE_POLE_SHAPE).add(SCHEMATICS_TABLE_SLOPE).forDirectional(SOUTH)
|
||||||
|
|
||||||
|
@ -120,8 +122,8 @@ public class AllShapes {
|
||||||
}
|
}
|
||||||
|
|
||||||
Builder erase(double x1, double y1, double z1, double x2, double y2, double z2) {
|
Builder erase(double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||||
this.shape = VoxelShapes.combineAndSimplify(shape, cuboid(x1, y1, z1, x2, y2, z2),
|
this.shape =
|
||||||
IBooleanFunction.ONLY_FIRST);
|
VoxelShapes.combineAndSimplify(shape, cuboid(x1, y1, z1, x2, y2, z2), IBooleanFunction.ONLY_FIRST);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.simibubi.create.foundation.utility.data;
|
||||||
|
|
||||||
|
import com.simibubi.create.AllBlocks;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.data.BlockTagsProvider;
|
||||||
|
import net.minecraft.data.DataGenerator;
|
||||||
|
import net.minecraft.tags.BlockTags;
|
||||||
|
import net.minecraft.tags.Tag;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class AllBlocksTagProvider extends BlockTagsProvider {
|
||||||
|
|
||||||
|
static Map<ResourceLocation, BlockTags.Wrapper> createdTags;
|
||||||
|
|
||||||
|
protected AllBlocksTagProvider(DataGenerator generatorIn) {
|
||||||
|
super(generatorIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void registerTags() {
|
||||||
|
createdTags = new HashMap<>();
|
||||||
|
|
||||||
|
for (AllBlocks entry :
|
||||||
|
AllBlocks.values()) {
|
||||||
|
entry.getTaggable().getTagSet(ITaggable.TagType.BLOCK).forEach(resLoc -> {
|
||||||
|
if (resLoc.getNamespace().equals("forge") && resLoc.getPath().contains("/"))
|
||||||
|
builder(new ResourceLocation(resLoc.getNamespace(), resLoc.getPath().split("/")[0])).add(new Tag<>(resLoc));
|
||||||
|
builder(resLoc).add(entry.get());
|
||||||
|
});
|
||||||
|
if (entry.alsoRegistered == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Arrays.stream(entry.alsoRegistered).forEach(
|
||||||
|
taggedBlock -> taggedBlock.getTagSet(ITaggable.TagType.BLOCK).forEach(
|
||||||
|
resLoc -> builder(resLoc).add(taggedBlock.getBlock())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tag.Builder<Block> builder(ResourceLocation resLoc) {
|
||||||
|
return this.getBuilder(createdTags.computeIfAbsent(resLoc, BlockTags.Wrapper::new));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Create Block Tags";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.simibubi.create.foundation.utility.data;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.simibubi.create.AllBlocks;
|
||||||
|
import com.simibubi.create.AllItems;
|
||||||
|
|
||||||
|
import net.minecraft.data.DataGenerator;
|
||||||
|
import net.minecraft.data.ItemTagsProvider;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.tags.ItemTags;
|
||||||
|
import net.minecraft.tags.Tag;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class AllItemsTagProvider extends ItemTagsProvider {
|
||||||
|
|
||||||
|
static Map<ResourceLocation, ItemTags.Wrapper> createdTags;
|
||||||
|
|
||||||
|
protected AllItemsTagProvider(DataGenerator generatorIn) {
|
||||||
|
super(generatorIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void registerTags() {
|
||||||
|
createdTags = new HashMap<>();
|
||||||
|
|
||||||
|
//first create all tags for AllBlocks as ItemBlocks
|
||||||
|
for (AllBlocks entry :
|
||||||
|
AllBlocks.values()) {
|
||||||
|
entry.getTaggable().getTagSet(ITaggable.TagType.ITEM).forEach(resLoc -> {
|
||||||
|
if (resLoc.getNamespace().equals("forge") && resLoc.getPath().contains("/"))
|
||||||
|
builder(new ResourceLocation(resLoc.getNamespace(), resLoc.getPath().split("/")[0])).add(new Tag<>(resLoc));
|
||||||
|
builder(resLoc).add(entry.get().asItem());
|
||||||
|
});
|
||||||
|
if (entry.alsoRegistered == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Arrays.stream(entry.alsoRegistered).forEach(
|
||||||
|
taggedBlock -> taggedBlock.getTagSet(ITaggable.TagType.ITEM).forEach(
|
||||||
|
resLoc -> builder(resLoc).add(taggedBlock.getBlock().asItem())));
|
||||||
|
}
|
||||||
|
//now do the same for AllItems
|
||||||
|
for (AllItems entry :
|
||||||
|
AllItems.values()){
|
||||||
|
entry.getTaggable().getTagSet(ITaggable.TagType.ITEM).forEach(resLoc -> {
|
||||||
|
if (resLoc.getNamespace().equals("forge") && resLoc.getPath().contains("/"))
|
||||||
|
builder(new ResourceLocation(resLoc.getNamespace(), resLoc.getPath().split("/")[0])).add(new Tag<>(resLoc));
|
||||||
|
builder(resLoc).add(entry.get().asItem());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tag.Builder<Item> builder(ResourceLocation resLoc) {
|
||||||
|
return this.getBuilder(createdTags.computeIfAbsent(resLoc, ItemTags.Wrapper::new));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Create Item Tags";
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,35 +1,19 @@
|
||||||
package com.simibubi.create.foundation.utility.data;
|
package com.simibubi.create.foundation.utility.data;
|
||||||
|
|
||||||
import com.simibubi.create.AllSoundEvents;
|
import net.minecraft.data.DataGenerator;
|
||||||
import net.minecraft.data.DirectoryCache;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import java.io.IOException;
|
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
|
|
||||||
|
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||||
public class Generator {
|
public class Generator {
|
||||||
|
|
||||||
/*
|
@SubscribeEvent
|
||||||
* this can probably be called by some gradle task or so but im not know how, so for now i just added a main below and execute from there when we need to generate jsons
|
public static void gatherData(GatherDataEvent event){
|
||||||
**/
|
DataGenerator gen = event.getGenerator();
|
||||||
public static void generateJsonFiles(){
|
//gen.addProvider(AllSoundEvents.CUCKOO_PIG);
|
||||||
Path base = Paths.get("src/main/resources");
|
gen.addProvider(new AllBlocksTagProvider(gen));
|
||||||
DirectoryCache cache;
|
gen.addProvider(new AllItemsTagProvider(gen));
|
||||||
try {
|
|
||||||
|
|
||||||
cache = new DirectoryCache(base, "cache");
|
|
||||||
|
|
||||||
for (ICanGenerateJson gen:
|
|
||||||
new ICanGenerateJson[]{AllSoundEvents.CUCKOO_CREEPER}) {
|
|
||||||
gen.generate(base, cache);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
generateJsonFiles();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
package com.simibubi.create.foundation.utility.data;
|
|
||||||
|
|
||||||
import net.minecraft.data.DirectoryCache;
|
|
||||||
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
public interface ICanGenerateJson {
|
|
||||||
|
|
||||||
//path points to the resource1s base folder
|
|
||||||
void generate(Path path, DirectoryCache cache);
|
|
||||||
}
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.simibubi.create.foundation.utility.data;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public interface ITaggable<T extends ITaggable<T>> {
|
||||||
|
|
||||||
|
enum TagType {
|
||||||
|
BLOCK, ITEM
|
||||||
|
}
|
||||||
|
|
||||||
|
default T withTags(ResourceLocation... tagsIn) {
|
||||||
|
return this.withTags(TagType.BLOCK, tagsIn).withTags(TagType.ITEM, tagsIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
default T withTags(TagType type, ResourceLocation... tagsIn) {
|
||||||
|
Collections.addAll(getTagSet(type), tagsIn);
|
||||||
|
return (T) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
default T withTagsInNamespace(String namespace, String... tagsIn) {
|
||||||
|
return withTags(Arrays.stream(tagsIn).map(s -> new ResourceLocation(namespace, s)).toArray(ResourceLocation[]::new));
|
||||||
|
}
|
||||||
|
|
||||||
|
default T withTagsInNamespace(TagType type, String namespace, String... tagsIn) {
|
||||||
|
return withTags(type, Arrays.stream(tagsIn).map(s -> new ResourceLocation(namespace, s)).toArray(ResourceLocation[]::new));
|
||||||
|
}
|
||||||
|
|
||||||
|
default T withCreateTags(String... tagsIn) {
|
||||||
|
return withTagsInNamespace("create", tagsIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
default T withForgeTags(String... tagsIn) {
|
||||||
|
return withTagsInNamespace("forge", tagsIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
default T withVanillaTags(String... tagsIn) {
|
||||||
|
return withTagsInNamespace("minecraft", tagsIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
default T withVanillaTags(TagType type, String... tagsIn) {
|
||||||
|
return withTagsInNamespace(type, "minecraft", tagsIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
//take a look at AllBlocks.TaggedBlock for more info
|
||||||
|
Set<ResourceLocation> getTagSet(TagType type);
|
||||||
|
}
|
|
@ -19,9 +19,9 @@ public enum AllWorldFeatures {
|
||||||
COPPER_ORE_OCEAN(
|
COPPER_ORE_OCEAN(
|
||||||
new CountedOreFeature(AllBlocks.COPPER_ORE.get(), 15, 4).between(20, 55).inBiomes(Biome.Category.OCEAN)),
|
new CountedOreFeature(AllBlocks.COPPER_ORE.get(), 15, 4).between(20, 55).inBiomes(Biome.Category.OCEAN)),
|
||||||
|
|
||||||
ZINC_ORE(new CountedOreFeature(AllBlocks.ZINC_ORE.get(), 17, 1).between(55, 80)),
|
ZINC_ORE(new CountedOreFeature(AllBlocks.ZINC_ORE.get(), 8, 1).between(55, 80)),
|
||||||
ZINC_ORE_DESERT(
|
ZINC_ORE_DESERT(
|
||||||
new CountedOreFeature(AllBlocks.ZINC_ORE.get(), 17, 5).between(50, 85).inBiomes(Biome.Category.DESERT)),
|
new CountedOreFeature(AllBlocks.ZINC_ORE.get(), 10, 5).between(50, 85).inBiomes(Biome.Category.DESERT)),
|
||||||
|
|
||||||
LIMESTONE(new ChanceOreFeature(AllBlocks.LIMESTONE.get(), 128, 1 / 32f).between(30, 70)),
|
LIMESTONE(new ChanceOreFeature(AllBlocks.LIMESTONE.get(), 128, 1 / 32f).between(30, 70)),
|
||||||
WEATHERED_LIMESTONE(new ChanceOreFeature(AllBlocks.WEATHERED_LIMESTONE.get(), 128, 1 / 32f).between(10, 30)),
|
WEATHERED_LIMESTONE(new ChanceOreFeature(AllBlocks.WEATHERED_LIMESTONE.get(), 128, 1 / 32f).between(10, 30)),
|
||||||
|
@ -55,6 +55,24 @@ public enum AllWorldFeatures {
|
||||||
biome.addFeature(entry.feature.getGenerationStage(), createFeature.get());
|
biome.addFeature(entry.feature.getGenerationStage(), createFeature.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// // Debug contained ore features
|
||||||
|
// for (Biome biome : ForgeRegistries.BIOMES) {
|
||||||
|
// Debug.markTemporary();
|
||||||
|
// System.out.println(biome.getRegistryName().getPath() + " has the following features:");
|
||||||
|
// for (ConfiguredFeature<?> configuredFeature : biome.getFeatures(Decoration.UNDERGROUND_ORES)) {
|
||||||
|
// IFeatureConfig config = configuredFeature.config;
|
||||||
|
// if (!(config instanceof DecoratedFeatureConfig))
|
||||||
|
// continue;
|
||||||
|
// DecoratedFeatureConfig decoConf = (DecoratedFeatureConfig) config;
|
||||||
|
// if (!(decoConf.feature.config instanceof OreFeatureConfig))
|
||||||
|
// continue;
|
||||||
|
// OreFeatureConfig oreConf = (OreFeatureConfig) decoConf.feature.config;
|
||||||
|
// System.out.println(configuredFeature.feature.getRegistryName().getPath());
|
||||||
|
// System.out.println(oreConf.state.getBlock().getRegistryName().getPath());
|
||||||
|
// System.out.println("--");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void fillConfig(ForgeConfigSpec.Builder builder) {
|
public static void fillConfig(ForgeConfigSpec.Builder builder) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ public abstract class OreFeature<T extends IPlacementConfig> extends ConfigBase
|
||||||
protected ConfigInt maxHeight;
|
protected ConfigInt maxHeight;
|
||||||
|
|
||||||
private Block block;
|
private Block block;
|
||||||
private Biome.Category biomeWhitelist;
|
private Biome.Category specificCategory;
|
||||||
|
|
||||||
public OreFeature(Block block, int clusterSize) {
|
public OreFeature(Block block, int clusterSize) {
|
||||||
this.block = block;
|
this.block = block;
|
||||||
|
@ -47,7 +47,7 @@ public abstract class OreFeature<T extends IPlacementConfig> extends ConfigBase
|
||||||
}
|
}
|
||||||
|
|
||||||
public OreFeature<T> inBiomes(Biome.Category category) {
|
public OreFeature<T> inBiomes(Biome.Category category) {
|
||||||
biomeWhitelist = category;
|
specificCategory = category;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public abstract class OreFeature<T extends IPlacementConfig> extends ConfigBase
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<ConfiguredFeature<?, ?>> createFeature(Biome biome) {
|
public Optional<ConfiguredFeature<?, ?>> createFeature(Biome biome) {
|
||||||
if (biomeWhitelist != null && biome.getCategory() == biomeWhitelist)
|
if (specificCategory != null && biome.getCategory() != specificCategory)
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
if (!canGenerate())
|
if (!canGenerate())
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class KineticNetwork {
|
||||||
if (te.isSource())
|
if (te.isSource())
|
||||||
sources.put(te, te.getAddedStressCapacity());
|
sources.put(te, te.getAddedStressCapacity());
|
||||||
members.put(te, te.getStressApplied());
|
members.put(te, te.getStressApplied());
|
||||||
te.updateStressFromNetwork(currentCapacity, currentStress);
|
te.updateFromNetwork(currentCapacity, currentStress, getSize());
|
||||||
te.networkDirty = true;
|
te.networkDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public class KineticNetwork {
|
||||||
if (te.isSource())
|
if (te.isSource())
|
||||||
sources.remove(te);
|
sources.remove(te);
|
||||||
members.remove(te);
|
members.remove(te);
|
||||||
te.updateStressFromNetwork(0, 0);
|
te.updateFromNetwork(0, 0, 0);
|
||||||
|
|
||||||
if (members.isEmpty()) {
|
if (members.isEmpty()) {
|
||||||
TorquePropagator.networks.get(te.getWorld()).remove(this.id);
|
TorquePropagator.networks.get(te.getWorld()).remove(this.id);
|
||||||
|
@ -93,7 +93,7 @@ public class KineticNetwork {
|
||||||
|
|
||||||
public void sync() {
|
public void sync() {
|
||||||
for (KineticTileEntity te : members.keySet())
|
for (KineticTileEntity te : members.keySet())
|
||||||
te.updateStressFromNetwork(currentCapacity, currentStress);
|
te.updateFromNetwork(currentCapacity, currentStress, getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateCapacity() {
|
public void updateCapacity() {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.simibubi.create.modules.contraptions;
|
package com.simibubi.create.modules.contraptions;
|
||||||
|
|
||||||
import static com.simibubi.create.AllBlocks.BELT;
|
import static com.simibubi.create.AllBlocks.BELT;
|
||||||
import static com.simibubi.create.AllBlocks.COGWHEEL;
|
|
||||||
import static com.simibubi.create.AllBlocks.LARGE_COGWHEEL;
|
import static com.simibubi.create.AllBlocks.LARGE_COGWHEEL;
|
||||||
import static net.minecraft.state.properties.BlockStateProperties.AXIS;
|
import static net.minecraft.state.properties.BlockStateProperties.AXIS;
|
||||||
|
|
||||||
|
@ -20,6 +19,7 @@ import com.simibubi.create.modules.contraptions.relays.encased.SplitShaftTileEnt
|
||||||
import com.simibubi.create.modules.contraptions.relays.gearbox.GearboxTileEntity;
|
import com.simibubi.create.modules.contraptions.relays.gearbox.GearboxTileEntity;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -57,8 +57,8 @@ public class RotationPropagator {
|
||||||
alignedAxes && definitionFrom.hasShaftTowards(world, from.getPos(), stateFrom, direction)
|
alignedAxes && definitionFrom.hasShaftTowards(world, from.getPos(), stateFrom, direction)
|
||||||
&& definitionTo.hasShaftTowards(world, to.getPos(), stateTo, direction.getOpposite());
|
&& definitionTo.hasShaftTowards(world, to.getPos(), stateTo, direction.getOpposite());
|
||||||
|
|
||||||
boolean connectedByGears = definitionFrom.hasCogsTowards(world, from.getPos(), stateFrom, direction)
|
boolean connectedByGears = definitionFrom.hasIntegratedCogwheel(world, from.getPos(), stateFrom)
|
||||||
&& definitionTo.hasCogsTowards(world, to.getPos(), stateTo, direction.getOpposite());
|
&& definitionTo.hasIntegratedCogwheel(world, to.getPos(), stateTo);
|
||||||
|
|
||||||
// Belt <-> Belt
|
// Belt <-> Belt
|
||||||
if (from instanceof BeltTileEntity && to instanceof BeltTileEntity && !connectedByAxis) {
|
if (from instanceof BeltTileEntity && to instanceof BeltTileEntity && !connectedByAxis) {
|
||||||
|
@ -90,16 +90,12 @@ public class RotationPropagator {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gear <-> Large Gear
|
// Gear <-> Large Gear
|
||||||
if (isLargeToSmallGear(stateFrom, stateTo, diff))
|
if (LARGE_COGWHEEL.typeOf(stateFrom) && definitionTo.hasIntegratedCogwheel(world, to.getPos(), stateTo))
|
||||||
return -2f;
|
if (isLargeToSmallGear(stateFrom, stateTo, definitionTo, diff))
|
||||||
if (isLargeToSmallGear(stateTo, stateFrom, diff))
|
return -2f;
|
||||||
return -.5f;
|
if (LARGE_COGWHEEL.typeOf(stateTo) && definitionFrom.hasIntegratedCogwheel(world, from.getPos(), stateFrom))
|
||||||
|
if (isLargeToSmallGear(stateTo, stateFrom, definitionFrom, diff))
|
||||||
// Rotation Speed Controller <-> Large Gear
|
return -.5f;
|
||||||
if (isLargeGearToSpeedController(stateFrom, stateTo, diff))
|
|
||||||
return SpeedControllerTileEntity.getSpeedModifier(from, to, true);
|
|
||||||
if (isLargeGearToSpeedController(stateTo, stateFrom, diff))
|
|
||||||
return SpeedControllerTileEntity.getSpeedModifier(to, from, false);
|
|
||||||
|
|
||||||
// Gear <-> Gear
|
// Gear <-> Gear
|
||||||
if (connectedByGears) {
|
if (connectedByGears) {
|
||||||
|
@ -107,6 +103,8 @@ public class RotationPropagator {
|
||||||
return 0;
|
return 0;
|
||||||
if (LARGE_COGWHEEL.typeOf(stateTo))
|
if (LARGE_COGWHEEL.typeOf(stateTo))
|
||||||
return 0;
|
return 0;
|
||||||
|
if (direction.getAxis() == definitionFrom.getRotationAxis(stateFrom))
|
||||||
|
return 0;
|
||||||
if (definitionFrom.getRotationAxis(stateFrom) == definitionTo.getRotationAxis(stateTo))
|
if (definitionFrom.getRotationAxis(stateFrom) == definitionTo.getRotationAxis(stateTo))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -114,6 +112,21 @@ public class RotationPropagator {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static float getConveyedSpeed(KineticTileEntity from, KineticTileEntity to) {
|
||||||
|
final BlockState stateFrom = from.getBlockState();
|
||||||
|
final BlockState stateTo = to.getBlockState();
|
||||||
|
final BlockPos diff = to.getPos().subtract(from.getPos());
|
||||||
|
|
||||||
|
// Rotation Speed Controller <-> Large Gear
|
||||||
|
if (isLargeGearToSpeedController(stateFrom, stateTo, diff))
|
||||||
|
return SpeedControllerTileEntity.getConveyedSpeed(from, to, true);
|
||||||
|
if (isLargeGearToSpeedController(stateTo, stateFrom, diff))
|
||||||
|
return SpeedControllerTileEntity.getConveyedSpeed(to, from, false);
|
||||||
|
|
||||||
|
float rotationSpeedModifier = getRotationSpeedModifier(from, to);
|
||||||
|
return from.getTheoreticalSpeed() * rotationSpeedModifier;
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean isLargeToLargeGear(BlockState from, BlockState to, BlockPos diff) {
|
private static boolean isLargeToLargeGear(BlockState from, BlockState to, BlockPos diff) {
|
||||||
if (!LARGE_COGWHEEL.typeOf(from) || !LARGE_COGWHEEL.typeOf(to))
|
if (!LARGE_COGWHEEL.typeOf(from) || !LARGE_COGWHEEL.typeOf(to))
|
||||||
return false;
|
return false;
|
||||||
|
@ -148,11 +161,9 @@ public class RotationPropagator {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isLargeToSmallGear(BlockState from, BlockState to, BlockPos diff) {
|
private static boolean isLargeToSmallGear(BlockState from, BlockState to, IRotate defTo, BlockPos diff) {
|
||||||
if (!LARGE_COGWHEEL.typeOf(from) || !COGWHEEL.typeOf(to))
|
|
||||||
return false;
|
|
||||||
Axis axisFrom = from.get(AXIS);
|
Axis axisFrom = from.get(AXIS);
|
||||||
if (axisFrom != to.get(AXIS))
|
if (axisFrom != defTo.getRotationAxis(to))
|
||||||
return false;
|
return false;
|
||||||
if (axisFrom.getCoordinate(diff.getX(), diff.getY(), diff.getZ()) != 0)
|
if (axisFrom.getCoordinate(diff.getX(), diff.getY(), diff.getZ()) != 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -184,31 +195,7 @@ public class RotationPropagator {
|
||||||
return;
|
return;
|
||||||
if (!worldIn.isBlockPresent(pos))
|
if (!worldIn.isBlockPresent(pos))
|
||||||
return;
|
return;
|
||||||
if (addedTE.getTheoreticalSpeed() != 0) {
|
propagateNewSource(addedTE);
|
||||||
propagateNewSource(addedTE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (KineticTileEntity neighbourTE : getConnectedNeighbours(addedTE)) {
|
|
||||||
final float speedModifier = getRotationSpeedModifier(neighbourTE, addedTE);
|
|
||||||
|
|
||||||
float neighbourSpeed = neighbourTE.getTheoreticalSpeed();
|
|
||||||
if (neighbourSpeed == 0)
|
|
||||||
continue;
|
|
||||||
if (neighbourTE.hasSource() && neighbourTE.source.equals(addedTE.getPos())) {
|
|
||||||
addedTE.setSpeed(neighbourSpeed * speedModifier);
|
|
||||||
addedTE.onSpeedChanged(0);
|
|
||||||
addedTE.sendData();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
addedTE.setSpeed(neighbourSpeed * speedModifier);
|
|
||||||
addedTE.setSource(neighbourTE.getPos());
|
|
||||||
addedTE.onSpeedChanged(0);
|
|
||||||
addedTE.sendData();
|
|
||||||
propagateNewSource(addedTE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -221,12 +208,10 @@ public class RotationPropagator {
|
||||||
World world = currentTE.getWorld();
|
World world = currentTE.getWorld();
|
||||||
|
|
||||||
for (KineticTileEntity neighbourTE : getConnectedNeighbours(currentTE)) {
|
for (KineticTileEntity neighbourTE : getConnectedNeighbours(currentTE)) {
|
||||||
float modFromTo = getRotationSpeedModifier(currentTE, neighbourTE);
|
|
||||||
float modToFrom = getRotationSpeedModifier(neighbourTE, currentTE);
|
|
||||||
float speedOfCurrent = currentTE.getTheoreticalSpeed();
|
float speedOfCurrent = currentTE.getTheoreticalSpeed();
|
||||||
float speedOfNeighbour = neighbourTE.getTheoreticalSpeed();
|
float speedOfNeighbour = neighbourTE.getTheoreticalSpeed();
|
||||||
float newSpeed = speedOfCurrent * modFromTo;
|
float newSpeed = getConveyedSpeed(currentTE, neighbourTE);
|
||||||
float oppositeSpeed = speedOfNeighbour * modToFrom;
|
float oppositeSpeed = getConveyedSpeed(neighbourTE, currentTE);
|
||||||
|
|
||||||
boolean incompatible =
|
boolean incompatible =
|
||||||
Math.signum(newSpeed) != Math.signum(speedOfNeighbour) && (newSpeed != 0 && speedOfNeighbour != 0);
|
Math.signum(newSpeed) != Math.signum(speedOfNeighbour) && (newSpeed != 0 && speedOfNeighbour != 0);
|
||||||
|
@ -249,8 +234,8 @@ public class RotationPropagator {
|
||||||
// Neighbour faster, overpower the incoming tree
|
// Neighbour faster, overpower the incoming tree
|
||||||
if (Math.abs(oppositeSpeed) > Math.abs(speedOfCurrent)) {
|
if (Math.abs(oppositeSpeed) > Math.abs(speedOfCurrent)) {
|
||||||
float prevSpeed = currentTE.getSpeed();
|
float prevSpeed = currentTE.getSpeed();
|
||||||
currentTE.setSpeed(speedOfNeighbour * getRotationSpeedModifier(neighbourTE, currentTE));
|
|
||||||
currentTE.setSource(neighbourTE.getPos());
|
currentTE.setSource(neighbourTE.getPos());
|
||||||
|
currentTE.setSpeed(getConveyedSpeed(neighbourTE, currentTE));
|
||||||
currentTE.onSpeedChanged(prevSpeed);
|
currentTE.onSpeedChanged(prevSpeed);
|
||||||
currentTE.sendData();
|
currentTE.sendData();
|
||||||
|
|
||||||
|
@ -272,8 +257,8 @@ public class RotationPropagator {
|
||||||
currentTE.removeSource();
|
currentTE.removeSource();
|
||||||
|
|
||||||
float prevSpeed = neighbourTE.getSpeed();
|
float prevSpeed = neighbourTE.getSpeed();
|
||||||
neighbourTE.setSpeed(speedOfCurrent * getRotationSpeedModifier(currentTE, neighbourTE));
|
|
||||||
neighbourTE.setSource(currentTE.getPos());
|
neighbourTE.setSource(currentTE.getPos());
|
||||||
|
neighbourTE.setSpeed(getConveyedSpeed(currentTE, neighbourTE));
|
||||||
neighbourTE.onSpeedChanged(prevSpeed);
|
neighbourTE.onSpeedChanged(prevSpeed);
|
||||||
neighbourTE.sendData();
|
neighbourTE.sendData();
|
||||||
propagateNewSource(neighbourTE);
|
propagateNewSource(neighbourTE);
|
||||||
|
@ -313,8 +298,11 @@ public class RotationPropagator {
|
||||||
BlockState neighbourState = worldIn.getBlockState(neighbourPos);
|
BlockState neighbourState = worldIn.getBlockState(neighbourPos);
|
||||||
if (!(neighbourState.getBlock() instanceof IRotate))
|
if (!(neighbourState.getBlock() instanceof IRotate))
|
||||||
continue;
|
continue;
|
||||||
|
TileEntity tileEntity = worldIn.getTileEntity(neighbourPos);
|
||||||
final KineticTileEntity neighbourTE = (KineticTileEntity) worldIn.getTileEntity(neighbourPos);
|
if (!(tileEntity instanceof KineticTileEntity))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
final KineticTileEntity neighbourTE = (KineticTileEntity) tileEntity;
|
||||||
if (!neighbourTE.hasSource() || !neighbourTE.source.equals(pos))
|
if (!neighbourTE.hasSource() || !neighbourTE.source.equals(pos))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -370,17 +358,33 @@ public class RotationPropagator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static KineticTileEntity findConnectedNeighbour(KineticTileEntity te, BlockPos neighbourPos) {
|
private static KineticTileEntity findConnectedNeighbour(KineticTileEntity currentTE, BlockPos neighbourPos) {
|
||||||
BlockState neighbourState = te.getWorld().getBlockState(neighbourPos);
|
BlockState neighbourState = currentTE.getWorld().getBlockState(neighbourPos);
|
||||||
if (!(neighbourState.getBlock() instanceof IRotate))
|
if (!(neighbourState.getBlock() instanceof IRotate))
|
||||||
return null;
|
return null;
|
||||||
if (!neighbourState.hasTileEntity())
|
if (!neighbourState.hasTileEntity())
|
||||||
return null;
|
return null;
|
||||||
|
TileEntity neighbourTE = currentTE.getWorld().getTileEntity(neighbourPos);
|
||||||
KineticTileEntity neighbour = (KineticTileEntity) te.getWorld().getTileEntity(neighbourPos);
|
if (!(neighbourTE instanceof KineticTileEntity))
|
||||||
if (getRotationSpeedModifier(te, neighbour) == 0)
|
|
||||||
return null;
|
return null;
|
||||||
return neighbour;
|
KineticTileEntity neighbourKTE = (KineticTileEntity) neighbourTE;
|
||||||
|
if (!(neighbourKTE.getBlockState().getBlock() instanceof IRotate))
|
||||||
|
return null;
|
||||||
|
if (!isConnected(currentTE, neighbourKTE))
|
||||||
|
return null;
|
||||||
|
return neighbourKTE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isConnected(KineticTileEntity from, KineticTileEntity to) {
|
||||||
|
final BlockState stateFrom = from.getBlockState();
|
||||||
|
final BlockState stateTo = to.getBlockState();
|
||||||
|
final BlockPos diff = to.getPos().subtract(from.getPos());
|
||||||
|
|
||||||
|
if (isLargeGearToSpeedController(stateFrom, stateTo, diff))
|
||||||
|
return true;
|
||||||
|
if (isLargeGearToSpeedController(stateTo, stateFrom, diff))
|
||||||
|
return true;
|
||||||
|
return getRotationSpeedModifier(from, to) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<KineticTileEntity> getConnectedNeighbours(KineticTileEntity te) {
|
private static List<KineticTileEntity> getConnectedNeighbours(KineticTileEntity te) {
|
||||||
|
@ -408,8 +412,13 @@ public class RotationPropagator {
|
||||||
BlockState blockState = te.getBlockState();
|
BlockState blockState = te.getBlockState();
|
||||||
boolean isLargeWheel = LARGE_COGWHEEL.typeOf(blockState);
|
boolean isLargeWheel = LARGE_COGWHEEL.typeOf(blockState);
|
||||||
|
|
||||||
if (COGWHEEL.typeOf(blockState) || isLargeWheel || BELT.typeOf(blockState)) {
|
if (!(blockState.getBlock() instanceof IRotate))
|
||||||
Axis axis = ((IRotate) blockState.getBlock()).getRotationAxis(blockState);
|
return neighbours;
|
||||||
|
IRotate block = (IRotate) blockState.getBlock();
|
||||||
|
|
||||||
|
if (block.hasIntegratedCogwheel(te.getWorld(), te.getPos(), blockState) || isLargeWheel
|
||||||
|
|| BELT.typeOf(blockState)) {
|
||||||
|
Axis axis = block.getRotationAxis(blockState);
|
||||||
|
|
||||||
BlockPos.getAllInBox(new BlockPos(-1, -1, -1), new BlockPos(1, 1, 1)).forEach(offset -> {
|
BlockPos.getAllInBox(new BlockPos(-1, -1, -1), new BlockPos(1, 1, 1)).forEach(offset -> {
|
||||||
if (!isLargeWheel && axis.getCoordinate(offset.getX(), offset.getY(), offset.getZ()) != 0)
|
if (!isLargeWheel && axis.getCoordinate(offset.getX(), offset.getY(), offset.getZ()) != 0)
|
||||||
|
|
|
@ -39,9 +39,10 @@ public class WrenchItem extends Item implements IHaveCustomItemModel {
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
if (world instanceof ServerWorld) {
|
if (world instanceof ServerWorld) {
|
||||||
if (!player.isCreative())
|
if (!player.isCreative())
|
||||||
Block.getDrops(state, (ServerWorld) world, pos, world.getTileEntity(pos)).forEach(itemStack -> {
|
Block.getDrops(state, (ServerWorld) world, pos, world.getTileEntity(pos), player, context.getItem())
|
||||||
player.inventory.placeItemBackInInventory(world, itemStack);
|
.forEach(itemStack -> {
|
||||||
});
|
player.inventory.placeItemBackInInventory(world, itemStack);
|
||||||
|
});
|
||||||
state.spawnAdditionalDrops(world, pos, ItemStack.EMPTY);
|
state.spawnAdditionalDrops(world, pos, ItemStack.EMPTY);
|
||||||
world.destroyBlock(pos, false);
|
world.destroyBlock(pos, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@ import net.minecraft.state.BooleanProperty;
|
||||||
import net.minecraft.state.StateContainer.Builder;
|
import net.minecraft.state.StateContainer.Builder;
|
||||||
import net.minecraft.util.ActionResultType;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Rotation;
|
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IWorldReader;
|
import net.minecraft.world.IWorldReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package com.simibubi.create.modules.contraptions.base;
|
package com.simibubi.create.modules.contraptions.base;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.modules.contraptions.KineticNetwork;
|
import com.simibubi.create.modules.contraptions.KineticNetwork;
|
||||||
import com.simibubi.create.modules.contraptions.base.IRotate.SpeedLevel;
|
import com.simibubi.create.modules.contraptions.base.IRotate.SpeedLevel;
|
||||||
|
|
||||||
import com.simibubi.create.modules.contraptions.goggle.IHaveGoggleInformation;
|
import com.simibubi.create.modules.contraptions.goggle.IHaveGoggleInformation;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
|
public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
|
||||||
|
|
||||||
public boolean reActivateSource;
|
public boolean reActivateSource;
|
||||||
|
|
|
@ -4,8 +4,8 @@ import com.simibubi.create.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.item.ItemDescription;
|
import com.simibubi.create.foundation.item.ItemDescription;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.modules.contraptions.IWrenchable;
|
import com.simibubi.create.modules.contraptions.IWrenchable;
|
||||||
|
|
||||||
import com.simibubi.create.modules.contraptions.goggle.IHaveGoggleInformation;
|
import com.simibubi.create.modules.contraptions.goggle.IHaveGoggleInformation;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
@ -68,9 +68,9 @@ public interface IRotate extends IWrenchable {
|
||||||
String level = color + ItemDescription.makeProgressBar(3, speedLevel.ordinal());
|
String level = color + ItemDescription.makeProgressBar(3, speedLevel.ordinal());
|
||||||
|
|
||||||
if (speedLevel == SpeedLevel.MEDIUM)
|
if (speedLevel == SpeedLevel.MEDIUM)
|
||||||
level += Lang.translate("tooltip.speedRequirements.medium");
|
level += Lang.translate("tooltip.speedRequirement.medium");
|
||||||
if (speedLevel == SpeedLevel.FAST)
|
if (speedLevel == SpeedLevel.FAST)
|
||||||
level += Lang.translate("tooltip.speedRequirements.high");
|
level += Lang.translate("tooltip.speedRequirement.high");
|
||||||
|
|
||||||
level += String.format(" (%s%s) ", IHaveGoggleInformation.format(Math.abs(speed)), Lang.translate("generic.unit.rpm"));
|
level += String.format(" (%s%s) ", IHaveGoggleInformation.format(Math.abs(speed)), Lang.translate("generic.unit.rpm"));
|
||||||
|
|
||||||
|
@ -118,8 +118,8 @@ public interface IRotate extends IWrenchable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face);
|
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face);
|
||||||
|
|
||||||
public boolean hasCogsTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face);
|
public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state);
|
||||||
|
|
||||||
public Axis getRotationAxis(BlockState state);
|
public Axis getRotationAxis(BlockState state);
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public abstract class KineticBlock extends Block implements IRotate {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCogsTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
|
public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package com.simibubi.create.modules.contraptions.base;
|
package com.simibubi.create.modules.contraptions.base;
|
||||||
|
|
||||||
|
import static net.minecraft.util.text.TextFormatting.GOLD;
|
||||||
|
import static net.minecraft.util.text.TextFormatting.GRAY;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -16,8 +19,9 @@ import com.simibubi.create.modules.contraptions.KineticNetwork;
|
||||||
import com.simibubi.create.modules.contraptions.RotationPropagator;
|
import com.simibubi.create.modules.contraptions.RotationPropagator;
|
||||||
import com.simibubi.create.modules.contraptions.base.IRotate.SpeedLevel;
|
import com.simibubi.create.modules.contraptions.base.IRotate.SpeedLevel;
|
||||||
import com.simibubi.create.modules.contraptions.base.IRotate.StressImpact;
|
import com.simibubi.create.modules.contraptions.base.IRotate.StressImpact;
|
||||||
|
|
||||||
import com.simibubi.create.modules.contraptions.goggle.IHaveGoggleInformation;
|
import com.simibubi.create.modules.contraptions.goggle.IHaveGoggleInformation;
|
||||||
|
import com.simibubi.create.modules.contraptions.goggle.IHaveHoveringInformation;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
@ -31,9 +35,8 @@ import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
|
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
|
||||||
|
|
||||||
import static net.minecraft.util.text.TextFormatting.GRAY;
|
public abstract class KineticTileEntity extends SmartTileEntity
|
||||||
|
implements ITickableTileEntity, IHaveGoggleInformation, IHaveHoveringInformation {
|
||||||
public abstract class KineticTileEntity extends SmartTileEntity implements ITickableTileEntity, IHaveGoggleInformation {
|
|
||||||
|
|
||||||
public @Nullable Long network;
|
public @Nullable Long network;
|
||||||
public @Nullable BlockPos source;
|
public @Nullable BlockPos source;
|
||||||
|
@ -117,10 +120,11 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateStressFromNetwork(float maxStress, float currentStress) {
|
public void updateFromNetwork(float maxStress, float currentStress, int networkSize) {
|
||||||
networkDirty = false;
|
networkDirty = false;
|
||||||
this.capacity = maxStress;
|
this.capacity = maxStress;
|
||||||
this.stress = currentStress;
|
this.stress = currentStress;
|
||||||
|
this.networkSize = networkSize;
|
||||||
boolean overStressed = maxStress < currentStress && StressImpact.isEnabled();
|
boolean overStressed = maxStress < currentStress && StressImpact.isEnabled();
|
||||||
|
|
||||||
if (overStressed != this.overStressed) {
|
if (overStressed != this.overStressed) {
|
||||||
|
@ -179,7 +183,7 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
|
||||||
networkTag.putLong("Id", this.network);
|
networkTag.putLong("Id", this.network);
|
||||||
networkTag.putFloat("Stress", stress);
|
networkTag.putFloat("Stress", stress);
|
||||||
networkTag.putFloat("Capacity", capacity);
|
networkTag.putFloat("Capacity", capacity);
|
||||||
networkTag.putInt("Size", getOrCreateNetwork().getSize());
|
networkTag.putInt("Size", networkSize);
|
||||||
|
|
||||||
float stressApplied = getStressApplied();
|
float stressApplied = getStressApplied();
|
||||||
float addedStressCapacity = getAddedStressCapacity();
|
float addedStressCapacity = getAddedStressCapacity();
|
||||||
|
@ -353,28 +357,51 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addToTooltip(List<String> tooltip, boolean isPlayerSneaking) {
|
||||||
|
boolean notFastEnough = !isSpeedRequirementFulfilled() && getSpeed() != 0;
|
||||||
|
|
||||||
|
if (overStressed && AllConfigs.CLIENT.enableOverstressedTooltip.get()) {
|
||||||
|
tooltip.add(spacing + GOLD + Lang.translate("gui.stress_gauge.overstressed"));
|
||||||
|
String hint = Lang.translate("gui.contraptions.network_overstressed",
|
||||||
|
I18n.format(getBlockState().getBlock().getTranslationKey()));
|
||||||
|
List<String> cutString = TooltipHelper.cutString(spacing + hint, GRAY, TextFormatting.WHITE);
|
||||||
|
for (int i = 0; i < cutString.size(); i++)
|
||||||
|
tooltip.add((i == 0 ? "" : spacing) + cutString.get(i));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notFastEnough) {
|
||||||
|
tooltip.add(spacing + GOLD + Lang.translate("tooltip.speedRequirement"));
|
||||||
|
String hint = Lang.translate("gui.contraptions.not_fast_enough",
|
||||||
|
I18n.format(getBlockState().getBlock().getTranslationKey()));
|
||||||
|
List<String> cutString = TooltipHelper.cutString(spacing + hint, GRAY, TextFormatting.WHITE);
|
||||||
|
for (int i = 0; i < cutString.size(); i++)
|
||||||
|
tooltip.add((i == 0 ? "" : spacing) + cutString.get(i));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addToGoggleTooltip(List<String> tooltip, boolean isPlayerSneaking) {
|
public boolean addToGoggleTooltip(List<String> tooltip, boolean isPlayerSneaking) {
|
||||||
boolean added = false;
|
boolean added = false;
|
||||||
float stressAtBase = getStressApplied();
|
float stressAtBase = getStressApplied();
|
||||||
|
|
||||||
boolean notFastEnough = !isSpeedRequirementFulfilled() && getSpeed() != 0;
|
if (getStressApplied() != 0 && StressImpact.isEnabled()) {
|
||||||
|
|
||||||
if (notFastEnough) {
|
|
||||||
tooltip.addAll(TooltipHelper.cutString(spacing + Lang.translate("gui.contraptions.not_fast_enough", I18n.format(getBlockState().getBlock().getTranslationKey())), GRAY, TextFormatting.WHITE));
|
|
||||||
added = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getStressApplied() != 0 && StressImpact.isEnabled()){
|
|
||||||
tooltip.add(spacing + Lang.translate("gui.goggles.kinetic_stats"));
|
tooltip.add(spacing + Lang.translate("gui.goggles.kinetic_stats"));
|
||||||
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("tooltip.stressImpact"));
|
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("tooltip.stressImpact"));
|
||||||
|
|
||||||
float stressTotal = stressAtBase * Math.abs(getSpeed());
|
float stressTotal = stressAtBase * Math.abs(getSpeed());
|
||||||
|
|
||||||
String stressString = spacing + "%s%s" + Lang.translate("generic.unit.stress") + " " + TextFormatting.DARK_GRAY + "%s";
|
String stressString =
|
||||||
|
spacing + "%s%s" + Lang.translate("generic.unit.stress") + " " + TextFormatting.DARK_GRAY + "%s";
|
||||||
|
|
||||||
tooltip.add(String.format(stressString, TextFormatting.AQUA, IHaveGoggleInformation.format(stressAtBase), Lang.translate("gui.goggles.base_value")));
|
tooltip.add(String.format(stressString, TextFormatting.AQUA, IHaveGoggleInformation.format(stressAtBase),
|
||||||
tooltip.add(String.format(stressString, TextFormatting.GRAY, IHaveGoggleInformation.format(stressTotal), Lang.translate("gui.goggles.at_current_speed")));
|
Lang.translate("gui.goggles.base_value")));
|
||||||
|
tooltip.add(String.format(stressString, TextFormatting.GRAY, IHaveGoggleInformation.format(stressTotal),
|
||||||
|
Lang.translate("gui.goggles.at_current_speed")));
|
||||||
|
|
||||||
added = true;
|
added = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import com.simibubi.create.modules.contraptions.components.contraptions.Movement
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.CropsBlock;
|
import net.minecraft.block.CropsBlock;
|
||||||
|
import net.minecraft.block.KelpBlock;
|
||||||
import net.minecraft.block.SugarCaneBlock;
|
import net.minecraft.block.SugarCaneBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.state.IProperty;
|
import net.minecraft.state.IProperty;
|
||||||
|
@ -111,6 +112,8 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state.getBlock() instanceof KelpBlock)
|
||||||
|
return true;
|
||||||
if (state.getBlock() instanceof IPlantable)
|
if (state.getBlock() instanceof IPlantable)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +127,9 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
|
||||||
return crop.withAge(0);
|
return crop.withAge(0);
|
||||||
}
|
}
|
||||||
if (state.getBlock() == Blocks.SUGAR_CANE) {
|
if (state.getBlock() == Blocks.SUGAR_CANE) {
|
||||||
return Blocks.AIR.getDefaultState();
|
if (state.getFluidState().isEmpty())
|
||||||
|
return Blocks.AIR.getDefaultState();
|
||||||
|
return state.getFluidState().getBlockState();
|
||||||
}
|
}
|
||||||
if (state.getCollisionShape(world, pos).isEmpty()) {
|
if (state.getCollisionShape(world, pos).isEmpty()) {
|
||||||
for (IProperty<?> property : state.getProperties()) {
|
for (IProperty<?> property : state.getProperties()) {
|
||||||
|
@ -136,7 +141,9 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Blocks.AIR.getDefaultState();
|
if (state.getFluidState().isEmpty())
|
||||||
|
return Blocks.AIR.getDefaultState();
|
||||||
|
return state.getFluidState().getBlockState();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,10 @@ import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.modules.contraptions.components.actors.HarvesterBlock;
|
import com.simibubi.create.modules.contraptions.components.actors.HarvesterBlock;
|
||||||
import com.simibubi.create.modules.contraptions.components.actors.PortableStorageInterfaceBlock;
|
import com.simibubi.create.modules.contraptions.components.actors.PortableStorageInterfaceBlock;
|
||||||
import com.simibubi.create.modules.contraptions.components.contraptions.chassis.AbstractChassisBlock;
|
import com.simibubi.create.modules.contraptions.components.contraptions.chassis.AbstractChassisBlock;
|
||||||
|
import com.simibubi.create.modules.logistics.block.belts.AttachedLogisticalBlock;
|
||||||
|
import com.simibubi.create.modules.logistics.block.belts.FunnelBlock;
|
||||||
|
import com.simibubi.create.modules.logistics.block.extractor.ExtractorBlock;
|
||||||
|
import com.simibubi.create.modules.logistics.block.transposer.TransposerBlock;
|
||||||
|
|
||||||
import net.minecraft.block.AbstractPressurePlateBlock;
|
import net.minecraft.block.AbstractPressurePlateBlock;
|
||||||
import net.minecraft.block.AbstractRailBlock;
|
import net.minecraft.block.AbstractRailBlock;
|
||||||
|
@ -11,6 +15,7 @@ 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;
|
||||||
import net.minecraft.block.DoorBlock;
|
import net.minecraft.block.DoorBlock;
|
||||||
|
import net.minecraft.block.FenceGateBlock;
|
||||||
import net.minecraft.block.FlowerPotBlock;
|
import net.minecraft.block.FlowerPotBlock;
|
||||||
import net.minecraft.block.HorizontalFaceBlock;
|
import net.minecraft.block.HorizontalFaceBlock;
|
||||||
import net.minecraft.block.LadderBlock;
|
import net.minecraft.block.LadderBlock;
|
||||||
|
@ -32,6 +37,8 @@ public class BlockMovementTraits {
|
||||||
BlockState state = world.getBlockState(pos);
|
BlockState state = world.getBlockState(pos);
|
||||||
if (isBrittle(state))
|
if (isBrittle(state))
|
||||||
return true;
|
return true;
|
||||||
|
if (state.getBlock() instanceof FenceGateBlock)
|
||||||
|
return true;
|
||||||
if (state.getMaterial().isReplaceable())
|
if (state.getMaterial().isReplaceable())
|
||||||
return false;
|
return false;
|
||||||
if (state.getCollisionShape(world, pos).isEmpty())
|
if (state.getCollisionShape(world, pos).isEmpty())
|
||||||
|
@ -41,14 +48,19 @@ public class BlockMovementTraits {
|
||||||
|
|
||||||
public static boolean movementAllowed(World world, BlockPos pos) {
|
public static boolean movementAllowed(World world, BlockPos pos) {
|
||||||
BlockState blockState = world.getBlockState(pos);
|
BlockState blockState = world.getBlockState(pos);
|
||||||
if (blockState.getBlock() instanceof AbstractChassisBlock)
|
Block block = blockState.getBlock();
|
||||||
|
if (block instanceof AbstractChassisBlock)
|
||||||
return true;
|
return true;
|
||||||
if (blockState.getBlockHardness(world, pos) == -1)
|
if (blockState.getBlockHardness(world, pos) == -1)
|
||||||
return false;
|
return false;
|
||||||
if (blockState.getBlock() == Blocks.OBSIDIAN)
|
if (block == Blocks.OBSIDIAN)
|
||||||
return false;
|
return false;
|
||||||
if (AllBlocks.BELT.typeOf(blockState))
|
if (AllBlocks.BELT.typeOf(blockState))
|
||||||
return true;
|
return true;
|
||||||
|
if (block instanceof ExtractorBlock)
|
||||||
|
return true;
|
||||||
|
if (block instanceof FunnelBlock)
|
||||||
|
return true;
|
||||||
return blockState.getPushReaction() != PushReaction.BLOCK;
|
return blockState.getPushReaction() != PushReaction.BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +74,10 @@ public class BlockMovementTraits {
|
||||||
return true;
|
return true;
|
||||||
if (block instanceof LadderBlock)
|
if (block instanceof LadderBlock)
|
||||||
return true;
|
return true;
|
||||||
|
if (block instanceof ExtractorBlock)
|
||||||
|
return true;
|
||||||
|
if (block instanceof FunnelBlock)
|
||||||
|
return true;
|
||||||
if (block instanceof TorchBlock)
|
if (block instanceof TorchBlock)
|
||||||
return true;
|
return true;
|
||||||
if (block instanceof FlowerPotBlock)
|
if (block instanceof FlowerPotBlock)
|
||||||
|
@ -94,6 +110,8 @@ public class BlockMovementTraits {
|
||||||
return direction == Direction.DOWN;
|
return direction == Direction.DOWN;
|
||||||
if (block instanceof DoorBlock)
|
if (block instanceof DoorBlock)
|
||||||
return direction == Direction.DOWN;
|
return direction == Direction.DOWN;
|
||||||
|
if (block instanceof AttachedLogisticalBlock && !(block instanceof TransposerBlock))
|
||||||
|
return direction == AttachedLogisticalBlock.getBlockFacing(state);
|
||||||
if (block instanceof FlowerPotBlock)
|
if (block instanceof FlowerPotBlock)
|
||||||
return direction == Direction.DOWN;
|
return direction == Direction.DOWN;
|
||||||
if (block instanceof RedstoneDiodeBlock)
|
if (block instanceof RedstoneDiodeBlock)
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class ChassisRangeDisplay {
|
||||||
|
|
||||||
boolean ctrl = AllKeys.ctrlDown();
|
boolean ctrl = AllKeys.ctrlDown();
|
||||||
ChassisTileEntity chassisTileEntity = (ChassisTileEntity) tileEntity;
|
ChassisTileEntity chassisTileEntity = (ChassisTileEntity) tileEntity;
|
||||||
|
|
||||||
if (ctrl) {
|
if (ctrl) {
|
||||||
GroupEntry existingGroupForPos = getExistingGroupForPos(pos);
|
GroupEntry existingGroupForPos = getExistingGroupForPos(pos);
|
||||||
if (existingGroupForPos != null) {
|
if (existingGroupForPos != null) {
|
||||||
|
@ -119,7 +119,7 @@ public class ChassisRangeDisplay {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entries.containsKey(pos) || ctrl)
|
if (!entries.containsKey(pos) || ctrl)
|
||||||
display(chassisTileEntity);
|
display(chassisTileEntity);
|
||||||
else {
|
else {
|
||||||
|
@ -196,9 +196,11 @@ public class ChassisRangeDisplay {
|
||||||
float alpha = timer > 20 ? .5f : timer / 40f;
|
float alpha = timer > 20 ? .5f : timer / 40f;
|
||||||
RenderSystem.color4f(1, .7f, 0, alpha);
|
RenderSystem.color4f(1, .7f, 0, alpha);
|
||||||
Set<BlockPos> includedPositions = entry.includedPositions;
|
Set<BlockPos> includedPositions = entry.includedPositions;
|
||||||
|
GlStateManager.depthMask(false);
|
||||||
for (BlockPos pos : includedPositions)
|
for (BlockPos pos : includedPositions)
|
||||||
TessellatorHelper.cube(Tessellator.getInstance().getBuffer(), pos, size, 1 / 1024f, true, false);
|
TessellatorHelper.cube(Tessellator.getInstance().getBuffer(), pos, size, 1 / 16f - 1 / 64f, true, false);
|
||||||
TessellatorHelper.draw();
|
TessellatorHelper.draw();
|
||||||
|
GlStateManager.depthMask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static GroupEntry getExistingGroupForPos(BlockPos pos) {
|
private static GroupEntry getExistingGroupForPos(BlockPos pos) {
|
||||||
|
|
|
@ -114,9 +114,7 @@ public abstract class Contraption {
|
||||||
frontier.add(pos);
|
frontier.add(pos);
|
||||||
if (!addToInitialFrontier(world, pos, forcedDirection, frontier))
|
if (!addToInitialFrontier(world, pos, forcedDirection, frontier))
|
||||||
return false;
|
return false;
|
||||||
|
for (int limit = 100000; limit > 0; limit--) {
|
||||||
Integer blockLimit = AllConfigs.SERVER.kinetics.maxBlocksMoved.get();
|
|
||||||
for (int limit = blockLimit; limit > 0; limit--) {
|
|
||||||
if (frontier.isEmpty())
|
if (frontier.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
if (!moveBlock(world, frontier.remove(0), forcedDirection, frontier, visited))
|
if (!moveBlock(world, frontier.remove(0), forcedDirection, frontier, visited))
|
||||||
|
@ -183,6 +181,8 @@ public abstract class Contraption {
|
||||||
}
|
}
|
||||||
|
|
||||||
add(pos, capture(world, pos));
|
add(pos, capture(world, pos));
|
||||||
|
if (blocks.size() > AllConfigs.SERVER.kinetics.maxBlocksMoved.get())
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.block.material.PushReaction;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.IProjectile;
|
||||||
import net.minecraft.entity.MoverType;
|
import net.minecraft.entity.MoverType;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
@ -52,7 +53,7 @@ public class ContraptionCollider {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Entity entity : world.getEntitiesWithinAABB((EntityType<?>) null, bounds.grow(1),
|
for (Entity entity : world.getEntitiesWithinAABB((EntityType<?>) null, bounds.grow(1),
|
||||||
e -> e.getPushReaction() == PushReaction.NORMAL)) {
|
e -> canBeCollidedWith(e))) {
|
||||||
|
|
||||||
ReuseableStream<VoxelShape> potentialHits =
|
ReuseableStream<VoxelShape> potentialHits =
|
||||||
getPotentiallyCollidedShapes(world, contraption, contraptionPosition, entity);
|
getPotentiallyCollidedShapes(world, contraption, contraptionPosition, entity);
|
||||||
|
@ -88,6 +89,16 @@ public class ContraptionCollider {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean canBeCollidedWith(Entity e) {
|
||||||
|
if (e instanceof PlayerEntity && e.isSpectator())
|
||||||
|
return false;
|
||||||
|
if (e.noClip)
|
||||||
|
return false;
|
||||||
|
if (e instanceof IProjectile)
|
||||||
|
return false;
|
||||||
|
return e.getPushReaction() == PushReaction.NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
private static void checkForClientPlayerCollision(Entity entity) {
|
private static void checkForClientPlayerCollision(Entity entity) {
|
||||||
if (entity != Minecraft.getInstance().player)
|
if (entity != Minecraft.getInstance().player)
|
||||||
|
|
|
@ -54,7 +54,6 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
||||||
protected Contraption contraption;
|
protected Contraption contraption;
|
||||||
protected float initialAngle;
|
protected float initialAngle;
|
||||||
protected BlockPos controllerPos;
|
protected BlockPos controllerPos;
|
||||||
protected IControlContraption controllerTE;
|
|
||||||
protected Vec3d motionBeforeStall;
|
protected Vec3d motionBeforeStall;
|
||||||
protected boolean stationary;
|
protected boolean stationary;
|
||||||
|
|
||||||
|
@ -103,12 +102,22 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
||||||
|
|
||||||
public <T extends TileEntity & IControlContraption> ContraptionEntity controlledBy(T controller) {
|
public <T extends TileEntity & IControlContraption> ContraptionEntity controlledBy(T controller) {
|
||||||
this.controllerPos = controller.getPos();
|
this.controllerPos = controller.getPos();
|
||||||
this.controllerTE = controller;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IControlContraption getController() {
|
||||||
|
if (controllerPos == null)
|
||||||
|
return null;
|
||||||
|
if (!world.isBlockPresent(controllerPos))
|
||||||
|
return null;
|
||||||
|
TileEntity te = world.getTileEntity(controllerPos);
|
||||||
|
if (!(te instanceof IControlContraption))
|
||||||
|
return null;
|
||||||
|
return (IControlContraption) te;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean collisionEnabled() {
|
public boolean collisionEnabled() {
|
||||||
return stationary && controllerTE instanceof LinearActuatorTileEntity;
|
return getController() instanceof LinearActuatorTileEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -118,7 +127,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
attachToController();
|
checkController();
|
||||||
|
|
||||||
Entity mountedEntity = getRidingEntity();
|
Entity mountedEntity = getRidingEntity();
|
||||||
if (mountedEntity != null) {
|
if (mountedEntity != null) {
|
||||||
|
@ -131,7 +140,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
||||||
|
|
||||||
move(getMotion().x, getMotion().y, getMotion().z);
|
move(getMotion().x, getMotion().y, getMotion().z);
|
||||||
if (ContraptionCollider.collideBlocks(this))
|
if (ContraptionCollider.collideBlocks(this))
|
||||||
controllerTE.collided();
|
getController().collided();
|
||||||
|
|
||||||
tickActors(getPositionVec().subtract(prevPosX, prevPosY, prevPosZ));
|
tickActors(getPositionVec().subtract(prevPosX, prevPosY, prevPosZ));
|
||||||
|
|
||||||
|
@ -256,8 +265,8 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
if (!stalledPreviously && contraption.stalled) {
|
if (!stalledPreviously && contraption.stalled) {
|
||||||
setMotion(Vec3d.ZERO);
|
setMotion(Vec3d.ZERO);
|
||||||
if (controllerTE != null)
|
if (getController() != null)
|
||||||
controllerTE.onStall();
|
getController().onStall();
|
||||||
AllPackets.channel.send(PacketDistributor.TRACKING_ENTITY.with(() -> this),
|
AllPackets.channel.send(PacketDistributor.TRACKING_ENTITY.with(() -> this),
|
||||||
new ContraptionStallPacket(getEntityId(), getX(), getY(), getZ(), yaw, pitch, roll));
|
new ContraptionStallPacket(getEntityId(), getX(), getY(), getZ(), yaw, pitch, roll));
|
||||||
}
|
}
|
||||||
|
@ -366,22 +375,21 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
||||||
controllerPos = NBTUtil.readBlockPos(compound.getCompound("Controller"));
|
controllerPos = NBTUtil.readBlockPos(compound.getCompound("Controller"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void attachToController() {
|
public void checkController() {
|
||||||
if (controllerPos != null && (controllerTE == null || !controllerTE.isValid())) {
|
if (controllerPos == null)
|
||||||
if (!world.isBlockPresent(controllerPos))
|
return;
|
||||||
return;
|
if (!world.isBlockPresent(controllerPos))
|
||||||
TileEntity te = world.getTileEntity(controllerPos);
|
return;
|
||||||
if (te == null || !(te instanceof IControlContraption)) {
|
IControlContraption controller = getController();
|
||||||
remove();
|
if (controller == null) {
|
||||||
return;
|
remove();
|
||||||
}
|
return;
|
||||||
IControlContraption controllerTE = (IControlContraption) te;
|
|
||||||
this.controllerTE = controllerTE;
|
|
||||||
controllerTE.attach(this);
|
|
||||||
|
|
||||||
if (world.isRemote)
|
|
||||||
setPosition(getX(), getY(), getZ());
|
|
||||||
}
|
}
|
||||||
|
if (controller.isAttachedTo(this))
|
||||||
|
return;
|
||||||
|
controller.attach(this);
|
||||||
|
if (world.isRemote)
|
||||||
|
setPosition(getX(), getY(), getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -422,6 +430,10 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
||||||
}
|
}
|
||||||
remove();
|
remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doWaterSplashEffect() {
|
||||||
|
}
|
||||||
|
|
||||||
public void preventMovedEntitiesFromGettingStuck() {
|
public void preventMovedEntitiesFromGettingStuck() {
|
||||||
Vec3d stuckTest = new Vec3d(0, -2, 0);
|
Vec3d stuckTest = new Vec3d(0, -2, 0);
|
||||||
|
|
|
@ -6,6 +6,8 @@ import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
|
||||||
public interface IControlContraption {
|
public interface IControlContraption {
|
||||||
|
|
||||||
|
public boolean isAttachedTo(ContraptionEntity contraption);
|
||||||
|
|
||||||
public void attach(ContraptionEntity contraption);
|
public void attach(ContraptionEntity contraption);
|
||||||
|
|
||||||
public void onStall();
|
public void onStall();
|
||||||
|
|
|
@ -7,6 +7,8 @@ import net.minecraft.block.ChestBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.state.properties.ChestType;
|
import net.minecraft.state.properties.ChestType;
|
||||||
|
import net.minecraft.tileentity.BarrelTileEntity;
|
||||||
|
import net.minecraft.tileentity.ChestTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
|
@ -105,9 +107,9 @@ public class MountedStorage {
|
||||||
TileEntityType<?> type = te.getType();
|
TileEntityType<?> type = te.getType();
|
||||||
if (type == AllTileEntities.FLEXCRATE.type)
|
if (type == AllTileEntities.FLEXCRATE.type)
|
||||||
return true;
|
return true;
|
||||||
if (type == TileEntityType.BARREL)
|
if (te instanceof ChestTileEntity)
|
||||||
return true;
|
return true;
|
||||||
if (type == TileEntityType.CHEST || type == TileEntityType.TRAPPED_CHEST)
|
if (te instanceof BarrelTileEntity)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,21 +203,22 @@ public class ClockworkBearingTileEntity extends KineticTileEntity implements IBe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void attach(ContraptionEntity contraption) {
|
public void attach(ContraptionEntity contraption) {
|
||||||
if (contraption.getContraption() instanceof ClockworkContraption) {
|
if (!(contraption.getContraption() instanceof ClockworkContraption))
|
||||||
ClockworkContraption cc = (ClockworkContraption) contraption.getContraption();
|
return;
|
||||||
markDirty();
|
|
||||||
Direction facing = getBlockState().get(BlockStateProperties.FACING);
|
ClockworkContraption cc = (ClockworkContraption) contraption.getContraption();
|
||||||
BlockPos anchor = pos.offset(facing, cc.offset + 1);
|
markDirty();
|
||||||
if (cc.handType == HandType.HOUR) {
|
Direction facing = getBlockState().get(BlockStateProperties.FACING);
|
||||||
this.hourHand = contraption;
|
BlockPos anchor = pos.offset(facing, cc.offset + 1);
|
||||||
hourHand.setPosition(anchor.getX(), anchor.getY(), anchor.getZ());
|
if (cc.handType == HandType.HOUR) {
|
||||||
} else {
|
this.hourHand = contraption;
|
||||||
this.minuteHand = contraption;
|
hourHand.setPosition(anchor.getX(), anchor.getY(), anchor.getZ());
|
||||||
minuteHand.setPosition(anchor.getX(), anchor.getY(), anchor.getZ());
|
} else {
|
||||||
}
|
this.minuteHand = contraption;
|
||||||
if (!world.isRemote)
|
minuteHand.setPosition(anchor.getX(), anchor.getY(), anchor.getZ());
|
||||||
sendData();
|
|
||||||
}
|
}
|
||||||
|
if (!world.isRemote)
|
||||||
|
sendData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -287,4 +288,15 @@ public class ClockworkBearingTileEntity extends KineticTileEntity implements IBe
|
||||||
public void collided() {
|
public void collided() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAttachedTo(ContraptionEntity contraption) {
|
||||||
|
if (!(contraption.getContraption() instanceof ClockworkContraption))
|
||||||
|
return false;
|
||||||
|
ClockworkContraption cc = (ClockworkContraption) contraption.getContraption();
|
||||||
|
if (cc.handType == HandType.HOUR)
|
||||||
|
return this.hourHand == contraption;
|
||||||
|
else
|
||||||
|
return this.minuteHand == contraption;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.simibubi.create.modules.contraptions.components.contraptions.bearing;
|
package com.simibubi.create.modules.contraptions.components.contraptions.bearing;
|
||||||
|
|
||||||
|
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.simibubi.create.AllTileEntities;
|
import com.simibubi.create.AllTileEntities;
|
||||||
|
@ -14,8 +16,8 @@ import com.simibubi.create.modules.contraptions.components.contraptions.Contrapt
|
||||||
import com.simibubi.create.modules.contraptions.components.contraptions.ContraptionEntity;
|
import com.simibubi.create.modules.contraptions.components.contraptions.ContraptionEntity;
|
||||||
import com.simibubi.create.modules.contraptions.components.contraptions.DirectionalExtenderScrollOptionSlot;
|
import com.simibubi.create.modules.contraptions.components.contraptions.DirectionalExtenderScrollOptionSlot;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.Direction.AxisDirection;
|
import net.minecraft.util.Direction.AxisDirection;
|
||||||
|
@ -32,6 +34,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
protected boolean assembleNextTick;
|
protected boolean assembleNextTick;
|
||||||
protected float clientAngleDiff;
|
protected float clientAngleDiff;
|
||||||
protected ScrollOptionBehaviour<RotationMode> movementMode;
|
protected ScrollOptionBehaviour<RotationMode> movementMode;
|
||||||
|
protected float lastGeneratedSpeed;
|
||||||
|
|
||||||
public MechanicalBearingTileEntity() {
|
public MechanicalBearingTileEntity() {
|
||||||
super(AllTileEntities.MECHANICAL_BEARING.type);
|
super(AllTileEntities.MECHANICAL_BEARING.type);
|
||||||
|
@ -90,7 +93,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
if (!running || !isWindmill)
|
if (!running || !isWindmill)
|
||||||
return 0;
|
return 0;
|
||||||
if (movedContraption == null)
|
if (movedContraption == null)
|
||||||
return 0;
|
return lastGeneratedSpeed;
|
||||||
int sails = ((BearingContraption) movedContraption.getContraption()).getSailBlocks() / 8;
|
int sails = ((BearingContraption) movedContraption.getContraption()).getSailBlocks() / 8;
|
||||||
return MathHelper.clamp(sails, 1, 16);
|
return MathHelper.clamp(sails, 1, 16);
|
||||||
}
|
}
|
||||||
|
@ -100,6 +103,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
tag.putBoolean("Running", running);
|
tag.putBoolean("Running", running);
|
||||||
tag.putBoolean("Windmill", isWindmill);
|
tag.putBoolean("Windmill", isWindmill);
|
||||||
tag.putFloat("Angle", angle);
|
tag.putFloat("Angle", angle);
|
||||||
|
tag.putFloat("LastGenerated", lastGeneratedSpeed);
|
||||||
return super.write(tag);
|
return super.write(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +112,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
running = tag.getBoolean("Running");
|
running = tag.getBoolean("Running");
|
||||||
isWindmill = tag.getBoolean("Windmill");
|
isWindmill = tag.getBoolean("Windmill");
|
||||||
angle = tag.getFloat("Angle");
|
angle = tag.getFloat("Angle");
|
||||||
|
lastGeneratedSpeed = tag.getFloat("LastGenerated");
|
||||||
super.read(tag);
|
super.read(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +129,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getInterpolatedAngle(float partialTicks) {
|
public float getInterpolatedAngle(float partialTicks) {
|
||||||
if (movedContraption == null || movedContraption.isStalled())
|
if (movedContraption == null || movedContraption.isStalled() || !running)
|
||||||
partialTicks = 0;
|
partialTicks = 0;
|
||||||
return MathHelper.lerp(partialTicks, angle, angle + getAngularSpeed());
|
return MathHelper.lerp(partialTicks, angle, angle + getAngularSpeed());
|
||||||
}
|
}
|
||||||
|
@ -145,7 +150,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assemble() {
|
public void assemble() {
|
||||||
Direction direction = getBlockState().get(BlockStateProperties.FACING);
|
Direction direction = getBlockState().get(FACING);
|
||||||
|
|
||||||
// Collect Construct
|
// Collect Construct
|
||||||
BearingContraption contraption = BearingContraption.assembleBearingAt(world, pos, direction);
|
BearingContraption contraption = BearingContraption.assembleBearingAt(world, pos, direction);
|
||||||
|
@ -167,6 +172,12 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
sendData();
|
sendData();
|
||||||
updateGeneratedRotation();
|
updateGeneratedRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateGeneratedRotation() {
|
||||||
|
super.updateGeneratedRotation();
|
||||||
|
lastGeneratedSpeed = getGeneratedSpeed();
|
||||||
|
}
|
||||||
|
|
||||||
public void disassemble() {
|
public void disassemble() {
|
||||||
if (!running)
|
if (!running)
|
||||||
|
@ -237,7 +248,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
|
|
||||||
protected void applyRotation() {
|
protected void applyRotation() {
|
||||||
if (movedContraption != null) {
|
if (movedContraption != null) {
|
||||||
Axis axis = getBlockState().get(BlockStateProperties.FACING).getAxis();
|
Axis axis = getBlockState().get(FACING).getAxis();
|
||||||
Direction direction = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis);
|
Direction direction = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis);
|
||||||
Vec3d vec = new Vec3d(1, 1, 1).scale(angle).mul(new Vec3d(direction.getDirectionVec()));
|
Vec3d vec = new Vec3d(1, 1, 1).scale(angle).mul(new Vec3d(direction.getDirectionVec()));
|
||||||
movedContraption.rotateTo(vec.x, vec.y, vec.z);
|
movedContraption.rotateTo(vec.x, vec.y, vec.z);
|
||||||
|
@ -246,14 +257,18 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void attach(ContraptionEntity contraption) {
|
public void attach(ContraptionEntity contraption) {
|
||||||
if (contraption.getContraption() instanceof BearingContraption) {
|
BlockState blockState = getBlockState();
|
||||||
this.movedContraption = contraption;
|
if (!(contraption.getContraption() instanceof BearingContraption))
|
||||||
markDirty();
|
return;
|
||||||
BlockPos anchor = pos.offset(getBlockState().get(BlockStateProperties.FACING));
|
if (!blockState.has(FACING))
|
||||||
movedContraption.setPosition(anchor.getX(), anchor.getY(), anchor.getZ());
|
return;
|
||||||
if (!world.isRemote)
|
|
||||||
sendData();
|
this.movedContraption = contraption;
|
||||||
}
|
markDirty();
|
||||||
|
BlockPos anchor = pos.offset(blockState.get(FACING));
|
||||||
|
movedContraption.setPosition(anchor.getX(), anchor.getY(), anchor.getZ());
|
||||||
|
if (!world.isRemote)
|
||||||
|
sendData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -279,4 +294,9 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
|
||||||
public void collided() {
|
public void collided() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAttachedTo(ContraptionEntity contraption) {
|
||||||
|
return movedContraption == contraption;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class MountedContraption extends Contraption {
|
||||||
|
|
||||||
Axis axis = state.get(RAIL_SHAPE) == RailShape.EAST_WEST ? Axis.X : Axis.Z;
|
Axis axis = state.get(RAIL_SHAPE) == RailShape.EAST_WEST ? Axis.X : Axis.Z;
|
||||||
contraption.add(pos, Pair.of(new BlockInfo(pos,
|
contraption.add(pos, Pair.of(new BlockInfo(pos,
|
||||||
AllBlocks.MINECART_ANCHOR.block.getDefaultState().with(BlockStateProperties.HORIZONTAL_AXIS, axis),
|
AllBlocks.MINECART_ANCHOR.get().getDefaultState().with(BlockStateProperties.HORIZONTAL_AXIS, axis),
|
||||||
null), null));
|
null), null));
|
||||||
contraption.removeBlocksFromWorld(world, BlockPos.ZERO);
|
contraption.removeBlocksFromWorld(world, BlockPos.ZERO);
|
||||||
contraption.initActors(world);
|
contraption.initActors(world);
|
||||||
|
|
|
@ -297,4 +297,9 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity impleme
|
||||||
sendData();
|
sendData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAttachedTo(ContraptionEntity contraption) {
|
||||||
|
return movedContraption == contraption;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -18,7 +18,7 @@ public class MechanicalPistonTileEntityRenderer extends KineticTileEntityRendere
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockState getRenderedBlockState(KineticTileEntity te) {
|
protected BlockState getRenderedBlockState(KineticTileEntity te) {
|
||||||
return AllBlocks.SHAFT.block.getDefaultState().with(BlockStateProperties.AXIS,
|
return AllBlocks.SHAFT.get().getDefaultState().with(BlockStateProperties.AXIS,
|
||||||
((IRotate) te.getBlockState().getBlock()).getRotationAxis(te.getBlockState()));
|
((IRotate) te.getBlockState().getBlock()).getRotationAxis(te.getBlockState()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ import net.minecraft.state.EnumProperty;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Hand;
|
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.BlockRayTraceResult;
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||||
|
|
|
@ -67,8 +67,8 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCogsTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
|
public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) {
|
||||||
return state.get(HORIZONTAL_FACING).getAxis() != face.getAxis();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.simibubi.create.modules.contraptions.components.crafter;
|
||||||
|
|
||||||
import static com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock.HORIZONTAL_FACING;
|
import static com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock.HORIZONTAL_FACING;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -207,7 +208,19 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
||||||
}
|
}
|
||||||
ItemStack result = RecipeGridHandler.tryToApplyRecipe(world, groupedItems);
|
ItemStack result = RecipeGridHandler.tryToApplyRecipe(world, groupedItems);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|
||||||
|
List<ItemStack> containers = new ArrayList<>();
|
||||||
|
groupedItems.grid.values().forEach(stack -> {
|
||||||
|
if (stack.hasContainerItem())
|
||||||
|
containers.add(stack.getContainerItem().copy());
|
||||||
|
});
|
||||||
|
|
||||||
groupedItems = new GroupedItems(result);
|
groupedItems = new GroupedItems(result);
|
||||||
|
containers.forEach(stack -> {
|
||||||
|
GroupedItems container = new GroupedItems(stack);
|
||||||
|
container.mergeOnto(groupedItems, Pointing.LEFT);
|
||||||
|
});
|
||||||
|
|
||||||
phase = Phase.CRAFTING;
|
phase = Phase.CRAFTING;
|
||||||
countDown = 2000;
|
countDown = 2000;
|
||||||
sendData();
|
sendData();
|
||||||
|
@ -381,8 +394,8 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
||||||
return;
|
return;
|
||||||
if (world.isRemote)
|
if (world.isRemote)
|
||||||
return;
|
return;
|
||||||
List<MechanicalCrafterTileEntity> chain = RecipeGridHandler.getAllCraftersOfChainIf(this,
|
List<MechanicalCrafterTileEntity> chain =
|
||||||
MechanicalCrafterTileEntity::craftingItemPresent);
|
RecipeGridHandler.getAllCraftersOfChainIf(this, MechanicalCrafterTileEntity::craftingItemPresent);
|
||||||
if (chain == null)
|
if (chain == null)
|
||||||
return;
|
return;
|
||||||
chain.forEach(MechanicalCrafterTileEntity::begin);
|
chain.forEach(MechanicalCrafterTileEntity::begin);
|
||||||
|
|
|
@ -35,8 +35,8 @@ import net.minecraft.util.math.Vec3d;
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<MechanicalCrafterTileEntity> {
|
public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<MechanicalCrafterTileEntity> {
|
||||||
|
|
||||||
public static SpriteShiftEntry animatedTexture = SpriteShifter.get("block/crafter_thingies",
|
public static SpriteShiftEntry animatedTexture =
|
||||||
"block/crafter_thingies");
|
SpriteShifter.get("block/crafter_thingies", "block/crafter_thingies");
|
||||||
|
|
||||||
public MechanicalCrafterTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
public MechanicalCrafterTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||||
super(dispatcher);
|
super(dispatcher);
|
||||||
|
@ -51,8 +51,8 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
|
||||||
|
|
||||||
if (te.phase == Phase.EXPORTING) {
|
if (te.phase == Phase.EXPORTING) {
|
||||||
Direction targetDirection = MechanicalCrafterBlock.getTargetDirection(te.getBlockState());
|
Direction targetDirection = MechanicalCrafterBlock.getTargetDirection(te.getBlockState());
|
||||||
float progress = MathHelper.clamp((1000 - te.countDown + te.getCountDownSpeed() * partialTicks) / 1000f, 0,
|
float progress =
|
||||||
1);
|
MathHelper.clamp((1000 - te.countDown + te.getCountDownSpeed() * partialTicks) / 1000f, 0, 1);
|
||||||
vec = vec.add(new Vec3d(targetDirection.getDirectionVec()).scale(progress * .75f));
|
vec = vec.add(new Vec3d(targetDirection.getDirectionVec()).scale(progress * .75f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,27 +88,29 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
|
||||||
if (te.phase == Phase.CRAFTING) {
|
if (te.phase == Phase.CRAFTING) {
|
||||||
items = te.groupedItemsBeforeCraft;
|
items = te.groupedItemsBeforeCraft;
|
||||||
items.calcStats();
|
items.calcStats();
|
||||||
float progress = MathHelper.clamp((2000 - te.countDown + te.getCountDownSpeed() * partialTicks) / 1000f,
|
float progress =
|
||||||
0, 1);
|
MathHelper.clamp((2000 - te.countDown + te.getCountDownSpeed() * partialTicks) / 1000f, 0, 1);
|
||||||
float earlyProgress = MathHelper.clamp(progress * 2, 0, 1);
|
float earlyProgress = MathHelper.clamp(progress * 2, 0, 1);
|
||||||
float lateProgress = MathHelper.clamp(progress * 2 - 1, 0, 1);
|
float lateProgress = MathHelper.clamp(progress * 2 - 1, 0, 1);
|
||||||
|
|
||||||
// RenderSystem.rotatef(lateProgress * 360, 0, 0, 1);
|
|
||||||
ms.scale(1 - lateProgress, 1 - lateProgress, 1 - lateProgress);
|
ms.scale(1 - lateProgress, 1 - lateProgress, 1 - lateProgress);
|
||||||
|
Vec3d centering =
|
||||||
Vec3d centering = new Vec3d(-items.minX + (-items.width + 1) / 2f,
|
new Vec3d(-items.minX + (-items.width + 1) / 2f, -items.minY + (-items.height + 1) / 2f, 0)
|
||||||
-items.minY + (-items.height + 1) / 2f, 0).scale(earlyProgress);
|
.scale(earlyProgress);
|
||||||
ms.translate(centering.x * .5f, centering.y * .5f, 0);
|
ms.translate(centering.x * .5f, centering.y * .5f, 0);
|
||||||
|
|
||||||
distance += (-4 * (progress - .5f) * (progress - .5f) + 1) * .25f;
|
distance += (-4 * (progress - .5f) * (progress - .5f) + 1) * .25f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean onlyRenderFirst = te.phase == Phase.INSERTING || te.phase == Phase.CRAFTING && te.countDown < 1000;
|
||||||
final float spacing = distance;
|
final float spacing = distance;
|
||||||
items.grid.forEach((pair, stack) -> {
|
items.grid.forEach((pair, stack) -> {
|
||||||
|
if (onlyRenderFirst && (pair.getLeft().intValue() != 0 || pair.getRight().intValue() != 0))
|
||||||
|
return;
|
||||||
|
|
||||||
ms.push();
|
ms.push();
|
||||||
ms.translate(pair.getKey() * spacing, pair.getValue() * spacing, 0);
|
ms.translate(pair.getKey() * spacing, pair.getValue() * spacing, 0);
|
||||||
TessellatorHelper.fightZFighting(pair.hashCode() + te.getPos().hashCode()); // FIXME 1.15
|
TessellatorHelper.fightZFighting(pair.hashCode() + te.getPos().hashCode());
|
||||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.FIXED, light, overlay, ms, buffer);
|
Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.FIXED);
|
||||||
ms.pop();
|
ms.pop();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -116,8 +118,8 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
|
||||||
|
|
||||||
if (te.phase == Phase.CRAFTING) {
|
if (te.phase == Phase.CRAFTING) {
|
||||||
items = te.groupedItems;
|
items = te.groupedItems;
|
||||||
float progress = MathHelper.clamp((1000 - te.countDown + te.getCountDownSpeed() * partialTicks) / 1000f,
|
float progress =
|
||||||
0, 1);
|
MathHelper.clamp((1000 - te.countDown + te.getCountDownSpeed() * partialTicks) / 1000f, 0, 1);
|
||||||
float earlyProgress = MathHelper.clamp(progress * 2, 0, 1);
|
float earlyProgress = MathHelper.clamp(progress * 2, 0, 1);
|
||||||
float lateProgress = MathHelper.clamp(progress * 2 - 1, 0, 1);
|
float lateProgress = MathHelper.clamp(progress * 2 - 1, 0, 1);
|
||||||
|
|
||||||
|
@ -128,6 +130,8 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
|
||||||
ms.scale(downScaling, downScaling, downScaling);
|
ms.scale(downScaling, downScaling, downScaling);
|
||||||
|
|
||||||
items.grid.forEach((pair, stack) -> {
|
items.grid.forEach((pair, stack) -> {
|
||||||
|
if (pair.getLeft().intValue() != 0 || pair.getRight().intValue() != 0)
|
||||||
|
return;
|
||||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.FIXED, light, overlay, ms, buffer);
|
Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.FIXED, light, overlay, ms, buffer);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -158,8 +162,8 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
|
||||||
|
|
||||||
if (MechanicalCrafterBlock.isValidTarget(te.getWorld(), pos.offset(targetDirection), blockState)) {
|
if (MechanicalCrafterBlock.isValidTarget(te.getWorld(), pos.offset(targetDirection), blockState)) {
|
||||||
SuperByteBuffer beltBuffer = renderAndTransform(te, AllBlockPartials.MECHANICAL_CRAFTER_BELT, blockState, pos);
|
SuperByteBuffer beltBuffer = renderAndTransform(te, AllBlockPartials.MECHANICAL_CRAFTER_BELT, blockState, pos);
|
||||||
SuperByteBuffer beltFrameBuffer = renderAndTransform(te, AllBlockPartials.MECHANICAL_CRAFTER_BELT_FRAME, blockState,
|
SuperByteBuffer beltFrameBuffer =
|
||||||
pos);
|
renderAndTransform(te, AllBlockPartials.MECHANICAL_CRAFTER_BELT_FRAME, blockState, pos);
|
||||||
|
|
||||||
if (te.phase == Phase.EXPORTING) {
|
if (te.phase == Phase.EXPORTING) {
|
||||||
int textureIndex = (int) ((te.getCountDownSpeed() / 128f * AnimationTickHolder.ticks));
|
int textureIndex = (int) ((te.getCountDownSpeed() / 128f * AnimationTickHolder.ticks));
|
||||||
|
@ -173,7 +177,8 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
|
||||||
beltFrameBuffer.renderInto(ms, vb);
|
beltFrameBuffer.renderInto(ms, vb);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SuperByteBuffer arrowBuffer = renderAndTransform(te, AllBlockPartials.MECHANICAL_CRAFTER_ARROW, blockState, pos);
|
SuperByteBuffer arrowBuffer =
|
||||||
|
renderAndTransform(te, AllBlockPartials.MECHANICAL_CRAFTER_ARROW, blockState, pos);
|
||||||
arrowBuffer.renderInto(ms, vb);
|
arrowBuffer.renderInto(ms, vb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.simibubi.create.modules.contraptions.components.crusher;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.simibubi.create.AllRecipes;
|
||||||
|
import com.simibubi.create.modules.contraptions.processing.ProcessingIngredient;
|
||||||
|
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
|
||||||
|
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipe;
|
||||||
|
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||||
|
|
||||||
|
public abstract class AbstractCrushingRecipe extends ProcessingRecipe<RecipeWrapper> {
|
||||||
|
|
||||||
|
public AbstractCrushingRecipe(AllRecipes recipeType, ResourceLocation id, String group,
|
||||||
|
List<ProcessingIngredient> ingredients, List<ProcessingOutput> results, int processingDuration) {
|
||||||
|
super(recipeType, id, group, ingredients, results, processingDuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,13 +5,12 @@ import java.util.List;
|
||||||
import com.simibubi.create.AllRecipes;
|
import com.simibubi.create.AllRecipes;
|
||||||
import com.simibubi.create.modules.contraptions.processing.ProcessingIngredient;
|
import com.simibubi.create.modules.contraptions.processing.ProcessingIngredient;
|
||||||
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
|
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
|
||||||
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipe;
|
|
||||||
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||||
|
|
||||||
public class CrushingRecipe extends ProcessingRecipe<RecipeWrapper> {
|
public class CrushingRecipe extends AbstractCrushingRecipe {
|
||||||
|
|
||||||
public CrushingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
public CrushingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
||||||
List<ProcessingOutput> results, int processingDuration) {
|
List<ProcessingOutput> results, int processingDuration) {
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock {
|
||||||
world.setBlockState(controllerPos, world.getBlockState(controllerPos).with(VALID, controllerShouldBeValid));
|
world.setBlockState(controllerPos, world.getBlockState(controllerPos).with(VALID, controllerShouldBeValid));
|
||||||
}
|
}
|
||||||
|
|
||||||
((CrushingWheelControllerBlock) AllBlocks.CRUSHING_WHEEL_CONTROLLER.block)
|
((CrushingWheelControllerBlock) AllBlocks.CRUSHING_WHEEL_CONTROLLER.get())
|
||||||
.updateSpeed(world.getBlockState(controllerPos), world, controllerPos);
|
.updateSpeed(world.getBlockState(controllerPos), world, controllerPos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import com.simibubi.create.foundation.block.SyncedTileEntity;
|
||||||
import com.simibubi.create.foundation.item.ItemHelper;
|
import com.simibubi.create.foundation.item.ItemHelper;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
import com.simibubi.create.modules.contraptions.processing.ProcessingInventory;
|
import com.simibubi.create.modules.contraptions.processing.ProcessingInventory;
|
||||||
|
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipe;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.item.ItemEntity;
|
import net.minecraft.entity.item.ItemEntity;
|
||||||
|
@ -172,8 +173,7 @@ public class CrushingWheelControllerTileEntity extends SyncedTileEntity implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyRecipe() {
|
private void applyRecipe() {
|
||||||
Optional<CrushingRecipe> recipe =
|
Optional<ProcessingRecipe<RecipeWrapper>> recipe = findRecipe();
|
||||||
world.getRecipeManager().getRecipe(AllRecipes.CRUSHING.getType(), wrapper, world);
|
|
||||||
|
|
||||||
List<ItemStack> list = new ArrayList<>();
|
List<ItemStack> list = new ArrayList<>();
|
||||||
if (recipe.isPresent()) {
|
if (recipe.isPresent()) {
|
||||||
|
@ -194,6 +194,14 @@ public class CrushingWheelControllerTileEntity extends SyncedTileEntity implemen
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Optional<ProcessingRecipe<RecipeWrapper>> findRecipe() {
|
||||||
|
Optional<ProcessingRecipe<RecipeWrapper>> crushingRecipe =
|
||||||
|
world.getRecipeManager().getRecipe(AllRecipes.CRUSHING.getType(), wrapper, world);
|
||||||
|
if (!crushingRecipe.isPresent())
|
||||||
|
crushingRecipe = world.getRecipeManager().getRecipe(AllRecipes.MILLING.getType(), wrapper, world);
|
||||||
|
return crushingRecipe;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundNBT write(CompoundNBT compound) {
|
public CompoundNBT write(CompoundNBT compound) {
|
||||||
if (hasEntity() && !isFrozen())
|
if (hasEntity() && !isFrozen())
|
||||||
|
@ -222,8 +230,7 @@ public class CrushingWheelControllerTileEntity extends SyncedTileEntity implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
private void itemInserted(ItemStack stack) {
|
private void itemInserted(ItemStack stack) {
|
||||||
Optional<CrushingRecipe> recipe =
|
Optional<ProcessingRecipe<RecipeWrapper>> recipe = findRecipe();
|
||||||
world.getRecipeManager().getRecipe(AllRecipes.CRUSHING.getType(), wrapper, world);
|
|
||||||
inventory.remainingTime = recipe.isPresent() ? recipe.get().getProcessingDuration() : 100;
|
inventory.remainingTime = recipe.isPresent() ? recipe.get().getProcessingDuration() : 100;
|
||||||
inventory.appliedRecipe = false;
|
inventory.appliedRecipe = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,8 +104,9 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
||||||
if (player == null)
|
if (player == null)
|
||||||
return;
|
return;
|
||||||
if (player.getHeldItemMainhand().isEmpty()) {
|
if (player.getHeldItemMainhand().isEmpty()) {
|
||||||
|
ItemStack filter = getFilter(context);
|
||||||
ItemStack held = ItemHelper.extract(context.contraption.inventory,
|
ItemStack held = ItemHelper.extract(context.contraption.inventory,
|
||||||
stack -> FilterItem.test(stack, getFilter(context)), 1, false);
|
stack -> FilterItem.test(context.world, stack, filter), 1, false);
|
||||||
player.setHeldItem(Hand.MAIN_HAND, held);
|
player.setHeldItem(Hand.MAIN_HAND, held);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +124,8 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
||||||
if (itemstack.isEmpty())
|
if (itemstack.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (list == inv.mainInventory && i == inv.currentItem && FilterItem.test(itemstack, filter))
|
if (list == inv.mainInventory && i == inv.currentItem
|
||||||
|
&& FilterItem.test(context.world, itemstack, filter))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
dropItem(context, itemstack);
|
dropItem(context, itemstack);
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerT
|
||||||
BlockState state = te.getBlockState();
|
BlockState state = te.getBlockState();
|
||||||
if (!AllBlocks.DEPLOYER.typeOf(state))
|
if (!AllBlocks.DEPLOYER.typeOf(state))
|
||||||
return Blocks.AIR.getDefaultState();
|
return Blocks.AIR.getDefaultState();
|
||||||
return AllBlocks.SHAFT.block.getDefaultState().with(AXIS, ((IRotate) state.getBlock()).getRotationAxis(state));
|
return AllBlocks.SHAFT.get().getDefaultState().with(AXIS, ((IRotate) state.getBlock()).getRotationAxis(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SuperByteBuffer renderAndTransform(World world, AllBlockPartials renderBlock,
|
private static SuperByteBuffer renderAndTransform(World world, AllBlockPartials renderBlock,
|
||||||
|
|
|
@ -18,8 +18,8 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.Direction.AxisDirection;
|
import net.minecraft.util.Direction.AxisDirection;
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
import net.minecraft.util.Rotation;
|
import net.minecraft.util.Rotation;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
public class FlywheelRenderer extends KineticTileEntityRenderer {
|
public class FlywheelRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.simibubi.create.modules.contraptions.components.millstone;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.simibubi.create.AllRecipes;
|
||||||
|
import com.simibubi.create.modules.contraptions.components.crusher.AbstractCrushingRecipe;
|
||||||
|
import com.simibubi.create.modules.contraptions.processing.ProcessingIngredient;
|
||||||
|
import com.simibubi.create.modules.contraptions.processing.ProcessingOutput;
|
||||||
|
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||||
|
|
||||||
|
public class MillingRecipe extends AbstractCrushingRecipe {
|
||||||
|
|
||||||
|
public MillingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
||||||
|
List<ProcessingOutput> results, int processingDuration) {
|
||||||
|
super(AllRecipes.MILLING, id, group, ingredients, results, processingDuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean matches(RecipeWrapper inv, World worldIn) {
|
||||||
|
if (inv.isEmpty())
|
||||||
|
return false;
|
||||||
|
return ingredients.get(0).test(inv.getStackInSlot(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getMaxOutputCount() {
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,141 @@
|
||||||
|
package com.simibubi.create.modules.contraptions.components.millstone;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.utility.AllShapes;
|
||||||
|
import com.simibubi.create.modules.contraptions.base.KineticBlock;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.item.ItemEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.inventory.InventoryHelper;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
|
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||||
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
|
import net.minecraft.world.IBlockReader;
|
||||||
|
import net.minecraft.world.IWorldReader;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||||
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
|
|
||||||
|
public class MillstoneBlock extends KineticBlock {
|
||||||
|
|
||||||
|
public MillstoneBlock() {
|
||||||
|
super(Properties.from(Blocks.ANDESITE));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
|
return new MillstoneTileEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean hasStaticPart() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||||
|
return AllShapes.MILLSTONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
|
||||||
|
return face == Direction.DOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn,
|
||||||
|
BlockRayTraceResult hit) {
|
||||||
|
if (!player.getHeldItem(handIn).isEmpty())
|
||||||
|
return false;
|
||||||
|
if (worldIn.getTileEntity(pos) == null)
|
||||||
|
return false;
|
||||||
|
if (worldIn.isRemote)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
TileEntity tileEntity = worldIn.getTileEntity(pos);
|
||||||
|
if (!(tileEntity instanceof MillstoneTileEntity))
|
||||||
|
return false;
|
||||||
|
MillstoneTileEntity millstone = (MillstoneTileEntity) tileEntity;
|
||||||
|
|
||||||
|
IItemHandlerModifiable inv = millstone.outputInv;
|
||||||
|
for (int slot = 0; slot < inv.getSlots(); slot++) {
|
||||||
|
player.inventory.placeItemBackInInventory(worldIn, inv.getStackInSlot(slot));
|
||||||
|
inv.setStackInSlot(slot, ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
millstone.markDirty();
|
||||||
|
millstone.sendData();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLanded(IBlockReader worldIn, Entity entityIn) {
|
||||||
|
super.onLanded(worldIn, entityIn);
|
||||||
|
|
||||||
|
if (entityIn.world.isRemote)
|
||||||
|
return;
|
||||||
|
if (!(entityIn instanceof ItemEntity))
|
||||||
|
return;
|
||||||
|
|
||||||
|
BlockPos pos = entityIn.getPosition();
|
||||||
|
TileEntity tileEntity = worldIn.getTileEntity(pos);
|
||||||
|
if (!(tileEntity instanceof MillstoneTileEntity)) {
|
||||||
|
tileEntity = worldIn.getTileEntity(pos.down());
|
||||||
|
if (!(tileEntity instanceof MillstoneTileEntity))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MillstoneTileEntity millstone = (MillstoneTileEntity) tileEntity;
|
||||||
|
ItemEntity itemEntity = (ItemEntity) entityIn;
|
||||||
|
LazyOptional<IItemHandler> capability = millstone.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY);
|
||||||
|
if (!capability.isPresent())
|
||||||
|
return;
|
||||||
|
|
||||||
|
ItemStack remainder = capability.orElse(new ItemStackHandler()).insertItem(0, itemEntity.getItem(), false);
|
||||||
|
if (remainder.isEmpty())
|
||||||
|
itemEntity.remove();
|
||||||
|
if (remainder.getCount() < itemEntity.getItem().getCount())
|
||||||
|
itemEntity.setItem(remainder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||||
|
if (state.hasTileEntity() && state.getBlock() != newState.getBlock()) {
|
||||||
|
TileEntity tileEntity = worldIn.getTileEntity(pos);
|
||||||
|
if (!(tileEntity instanceof MillstoneTileEntity))
|
||||||
|
return;
|
||||||
|
MillstoneTileEntity te = (MillstoneTileEntity) tileEntity;
|
||||||
|
for (int slot = 0; slot < te.inputInv.getSlots(); slot++) {
|
||||||
|
InventoryHelper.spawnItemStack(worldIn, pos.getX(), pos.getY(), pos.getZ(),
|
||||||
|
te.inputInv.getStackInSlot(slot));
|
||||||
|
}
|
||||||
|
for (int slot = 0; slot < te.outputInv.getSlots(); slot++) {
|
||||||
|
InventoryHelper.spawnItemStack(worldIn, pos.getX(), pos.getY(), pos.getZ(),
|
||||||
|
te.outputInv.getStackInSlot(slot));
|
||||||
|
}
|
||||||
|
|
||||||
|
worldIn.removeTileEntity(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Axis getRotationAxis(BlockState state) {
|
||||||
|
return Axis.Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.simibubi.create.modules.contraptions.components.millstone;
|
||||||
|
|
||||||
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
import com.simibubi.create.CreateClient;
|
||||||
|
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||||
|
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||||
|
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||||
|
|
||||||
|
public class MillstoneRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||||
|
return CreateClient.bufferCache.renderPartial(AllBlockPartials.MILLSTONE_COG, te.getBlockState());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,174 @@
|
||||||
|
package com.simibubi.create.modules.contraptions.components.millstone;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import com.simibubi.create.AllRecipes;
|
||||||
|
import com.simibubi.create.AllTileEntities;
|
||||||
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.particles.ItemParticleData;
|
||||||
|
import net.minecraft.particles.ParticleTypes;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
|
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
||||||
|
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||||
|
|
||||||
|
public class MillstoneTileEntity extends KineticTileEntity {
|
||||||
|
|
||||||
|
public ItemStackHandler inputInv;
|
||||||
|
public ItemStackHandler outputInv;
|
||||||
|
public int timer;
|
||||||
|
private MillingRecipe lastRecipe;
|
||||||
|
|
||||||
|
public MillstoneTileEntity() {
|
||||||
|
super(AllTileEntities.MILLSTONE.type);
|
||||||
|
inputInv = new ItemStackHandler(1);
|
||||||
|
outputInv = new ItemStackHandler(9);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
super.tick();
|
||||||
|
|
||||||
|
if (getSpeed() == 0)
|
||||||
|
return;
|
||||||
|
for (int i = 0; i < outputInv.getSlots(); i++)
|
||||||
|
if (outputInv.getStackInSlot(i).getCount() == outputInv.getSlotLimit(i))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (timer > 0) {
|
||||||
|
timer -= getProcessingSpeed();
|
||||||
|
|
||||||
|
if (world.isRemote) {
|
||||||
|
spawnParticles();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (timer <= 0)
|
||||||
|
process();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inputInv.getStackInSlot(0).isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
RecipeWrapper inventoryIn = new RecipeWrapper(inputInv);
|
||||||
|
if (lastRecipe == null || !lastRecipe.matches(inventoryIn, world)) {
|
||||||
|
Optional<MillingRecipe> recipe =
|
||||||
|
world.getRecipeManager().getRecipe(AllRecipes.MILLING.getType(), inventoryIn, world);
|
||||||
|
if (!recipe.isPresent()) {
|
||||||
|
timer = 100;
|
||||||
|
sendData();
|
||||||
|
} else {
|
||||||
|
lastRecipe = recipe.get();
|
||||||
|
timer = lastRecipe.getProcessingDuration();
|
||||||
|
sendData();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
timer = lastRecipe.getProcessingDuration();
|
||||||
|
sendData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void process() {
|
||||||
|
RecipeWrapper inventoryIn = new RecipeWrapper(inputInv);
|
||||||
|
|
||||||
|
if (lastRecipe == null || !lastRecipe.matches(inventoryIn, world)) {
|
||||||
|
Optional<MillingRecipe> recipe =
|
||||||
|
world.getRecipeManager().getRecipe(AllRecipes.MILLING.getType(), inventoryIn, world);
|
||||||
|
if (!recipe.isPresent())
|
||||||
|
return;
|
||||||
|
lastRecipe = recipe.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack stackInSlot = inputInv.getStackInSlot(0);
|
||||||
|
stackInSlot.shrink(1);
|
||||||
|
inputInv.setStackInSlot(0, stackInSlot);
|
||||||
|
lastRecipe.rollResults().forEach(stack -> ItemHandlerHelper.insertItemStacked(outputInv, stack, false));
|
||||||
|
sendData();
|
||||||
|
markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void spawnParticles() {
|
||||||
|
ItemStack stackInSlot = inputInv.getStackInSlot(0);
|
||||||
|
if (stackInSlot.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
ItemParticleData data = new ItemParticleData(ParticleTypes.ITEM, stackInSlot);
|
||||||
|
float angle = world.rand.nextFloat() * 360;
|
||||||
|
Vec3d offset = new Vec3d(0, 0, 0.5f);
|
||||||
|
offset = VecHelper.rotate(offset, angle, Axis.Y);
|
||||||
|
Vec3d target = VecHelper.rotate(offset, getSpeed() > 0 ? 25 : -25, Axis.Y);
|
||||||
|
|
||||||
|
Vec3d center = offset.add(VecHelper.getCenterOf(pos));
|
||||||
|
target = VecHelper.offsetRandomly(target.subtract(offset), world.rand, 1 / 128f);
|
||||||
|
world.addParticle(data, center.x, center.y, center.z, target.x, target.y, target.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompoundNBT write(CompoundNBT compound) {
|
||||||
|
compound.putInt("Timer", timer);
|
||||||
|
compound.put("InputInventory", inputInv.serializeNBT());
|
||||||
|
compound.put("OutputInventory", outputInv.serializeNBT());
|
||||||
|
return super.write(compound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(CompoundNBT compound) {
|
||||||
|
timer = compound.getInt("Timer");
|
||||||
|
inputInv.deserializeNBT(compound.getCompound("InputInventory"));
|
||||||
|
outputInv.deserializeNBT(compound.getCompound("OutputInventory"));
|
||||||
|
super.read(compound);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getProcessingSpeed() {
|
||||||
|
return MathHelper.clamp((int) Math.abs(getSpeed() / 16f), 1, 512);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
|
||||||
|
if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
||||||
|
return LazyOptional.of(MillstoneInventoryHandler::new).cast();
|
||||||
|
return super.getCapability(cap, side);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class MillstoneInventoryHandler extends CombinedInvWrapper {
|
||||||
|
|
||||||
|
public MillstoneInventoryHandler() {
|
||||||
|
super(inputInv, outputInv);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValid(int slot, ItemStack stack) {
|
||||||
|
if (outputInv == getHandlerFromIndex(getIndexForSlot(slot)))
|
||||||
|
return false;
|
||||||
|
return super.isItemValid(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
||||||
|
if (outputInv == getHandlerFromIndex(getIndexForSlot(slot)))
|
||||||
|
return stack;
|
||||||
|
return super.insertItem(slot, stack, simulate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||||
|
if (inputInv == getHandlerFromIndex(getIndexForSlot(slot)))
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
return super.extractItem(slot, amount, simulate);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -66,8 +66,8 @@ public class MechanicalMixerBlock extends KineticBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCogsTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
|
public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) {
|
||||||
return face.getAxis().isHorizontal();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -97,7 +97,12 @@ public class SawBlock extends DirectionalAxisKineticBlock implements IWithTileEn
|
||||||
super.onLanded(worldIn, entityIn);
|
super.onLanded(worldIn, entityIn);
|
||||||
if (!(entityIn instanceof ItemEntity))
|
if (!(entityIn instanceof ItemEntity))
|
||||||
return;
|
return;
|
||||||
withTileEntityDo(entityIn.world, entityIn.getPosition(), te -> {
|
BlockPos pos = entityIn.getPosition();
|
||||||
|
if (!(worldIn.getTileEntity(pos) instanceof SawTileEntity))
|
||||||
|
return;
|
||||||
|
if (entityIn.world.isRemote)
|
||||||
|
return;
|
||||||
|
withTileEntityDo(entityIn.world, pos, te -> {
|
||||||
te.insertItem((ItemEntity) entityIn);
|
te.insertItem((ItemEntity) entityIn);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class SawTileEntityRenderer extends SafeTileEntityRenderer<SawTileEntity>
|
||||||
|
|
||||||
protected BlockState getRenderedBlockState(KineticTileEntity te) {
|
protected BlockState getRenderedBlockState(KineticTileEntity te) {
|
||||||
BlockState state = te.getBlockState();
|
BlockState state = te.getBlockState();
|
||||||
return AllBlocks.SHAFT.block.getDefaultState().with(AXIS, ((IRotate) state.getBlock()).getRotationAxis(state));
|
return AllBlocks.SHAFT.get().getDefaultState().with(AXIS, ((IRotate) state.getBlock()).getRotationAxis(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,17 +41,34 @@ public class GoggleOverlayRenderer {
|
||||||
ItemStack goggles = mc.player.getItemStackFromSlot(EquipmentSlotType.HEAD);
|
ItemStack goggles = mc.player.getItemStackFromSlot(EquipmentSlotType.HEAD);
|
||||||
TileEntity te = world.getTileEntity(pos);
|
TileEntity te = world.getTileEntity(pos);
|
||||||
|
|
||||||
if (!AllItems.GOGGLES.typeOf(goggles))
|
boolean goggleInformation = te instanceof IHaveGoggleInformation;
|
||||||
return;
|
boolean hoveringInformation = te instanceof IHaveHoveringInformation;
|
||||||
|
|
||||||
if (!(te instanceof IHaveGoggleInformation))
|
if (!goggleInformation && !hoveringInformation)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IHaveGoggleInformation gte = (IHaveGoggleInformation) te;
|
|
||||||
|
|
||||||
List<String> tooltip = new ArrayList<>();
|
List<String> tooltip = new ArrayList<>();
|
||||||
|
|
||||||
if (!gte.addToGoggleTooltip(tooltip, mc.player.isSneaking()))
|
if (goggleInformation && AllItems.GOGGLES.typeOf(goggles)) {
|
||||||
|
IHaveGoggleInformation gte = (IHaveGoggleInformation) te;
|
||||||
|
if (!gte.addToGoggleTooltip(tooltip, mc.player.isSneaking()))
|
||||||
|
goggleInformation = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hoveringInformation) {
|
||||||
|
boolean goggleAddedInformation = !tooltip.isEmpty();
|
||||||
|
if (goggleAddedInformation)
|
||||||
|
tooltip.add("");
|
||||||
|
IHaveHoveringInformation hte = (IHaveHoveringInformation) te;
|
||||||
|
if (!hte.addToTooltip(tooltip, mc.player.isSneaking()))
|
||||||
|
hoveringInformation = false;
|
||||||
|
if (goggleAddedInformation && !hoveringInformation)
|
||||||
|
tooltip.remove(tooltip.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!goggleInformation && !hoveringInformation)
|
||||||
|
return;
|
||||||
|
if (tooltip.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
|
@ -70,7 +87,7 @@ public class GoggleOverlayRenderer {
|
||||||
|
|
||||||
tooltipScreen.init(mc, mc.getWindow().getScaledWidth(), mc.getWindow().getScaledHeight());
|
tooltipScreen.init(mc, mc.getWindow().getScaledWidth(), mc.getWindow().getScaledHeight());
|
||||||
tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2);
|
tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2);
|
||||||
ItemStack item = goggles;
|
ItemStack item = AllItems.GOGGLES.asStack();
|
||||||
ScreenElementRenderer.render3DItem(() -> {
|
ScreenElementRenderer.render3DItem(() -> {
|
||||||
GlStateManager.translated(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16, 0);
|
GlStateManager.translated(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16, 0);
|
||||||
return item;
|
return item;
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.simibubi.create.modules.contraptions.goggle;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implement this Interface in the TileEntity class that wants to add info to the screen
|
||||||
|
* */
|
||||||
|
public interface IHaveHoveringInformation {
|
||||||
|
|
||||||
|
default boolean addToTooltip(List<String> tooltip, boolean isPlayerSneaking){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -11,9 +11,7 @@ import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.modules.contraptions.processing.BasinTileEntity.BasinInventory;
|
import com.simibubi.create.modules.contraptions.processing.BasinTileEntity.BasinInventory;
|
||||||
|
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.BucketItem;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -53,6 +51,8 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void gatherInputs() {
|
public void gatherInputs() {
|
||||||
|
if (!basinInv.isPresent())
|
||||||
|
return;
|
||||||
BasinInventory inv = (BasinInventory) basinInv.orElse(null);
|
BasinInventory inv = (BasinInventory) basinInv.orElse(null);
|
||||||
inputs = new ArrayList<>();
|
inputs = new ArrayList<>();
|
||||||
IItemHandlerModifiable inputHandler = inv.getInputHandler();
|
IItemHandlerModifiable inputHandler = inv.getInputHandler();
|
||||||
|
@ -128,8 +128,8 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity {
|
||||||
IItemHandlerModifiable inputs = inv.getInputHandler();
|
IItemHandlerModifiable inputs = inv.getInputHandler();
|
||||||
IItemHandlerModifiable outputs = inv.getOutputHandler();
|
IItemHandlerModifiable outputs = inv.getOutputHandler();
|
||||||
List<ItemStack> catalysts = new ArrayList<>();
|
List<ItemStack> catalysts = new ArrayList<>();
|
||||||
|
List<ItemStack> containers = new ArrayList<>();
|
||||||
|
|
||||||
int buckets = 0;
|
|
||||||
NonNullList<Ingredient> ingredients = lastRecipe.getIngredients();
|
NonNullList<Ingredient> ingredients = lastRecipe.getIngredients();
|
||||||
Ingredients: for (int i = 0; i < ingredients.size(); i++) {
|
Ingredients: for (int i = 0; i < ingredients.size(); i++) {
|
||||||
Ingredient ingredient = ingredients.get(i);
|
Ingredient ingredient = ingredients.get(i);
|
||||||
|
@ -137,12 +137,11 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity {
|
||||||
if (!ingredient.test(inputs.extractItem(slot, 1, true)))
|
if (!ingredient.test(inputs.extractItem(slot, 1, true)))
|
||||||
continue;
|
continue;
|
||||||
ItemStack extracted = inputs.extractItem(slot, 1, false);
|
ItemStack extracted = inputs.extractItem(slot, 1, false);
|
||||||
if (extracted.getItem() instanceof BucketItem)
|
if ((lastRecipe instanceof ProcessingRecipe)
|
||||||
buckets++;
|
&& ((ProcessingRecipe<?>) lastRecipe).getRollableIngredients().get(i).remains()) {
|
||||||
|
catalysts.add(extracted.copy());
|
||||||
if ((lastRecipe instanceof ProcessingRecipe)) {
|
} else if (extracted.hasContainerItem()) {
|
||||||
if (((ProcessingRecipe<?>) lastRecipe).getRollableIngredients().get(i).remains())
|
containers.add(extracted.getContainerItem().copy());
|
||||||
catalysts.add(extracted.copy());
|
|
||||||
}
|
}
|
||||||
continue Ingredients;
|
continue Ingredients;
|
||||||
}
|
}
|
||||||
|
@ -151,8 +150,7 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemHandlerHelper.insertItemStacked(outputs, lastRecipe.getRecipeOutput().copy(), false);
|
ItemHandlerHelper.insertItemStacked(outputs, lastRecipe.getRecipeOutput().copy(), false);
|
||||||
if (buckets > 0)
|
containers.forEach(stack -> ItemHandlerHelper.insertItemStacked(outputs, stack, false));
|
||||||
ItemHandlerHelper.insertItemStacked(outputs, new ItemStack(Items.BUCKET, buckets), false);
|
|
||||||
catalysts.forEach(c -> ItemHandlerHelper.insertItemStacked(outputs, c, false));
|
catalysts.forEach(c -> ItemHandlerHelper.insertItemStacked(outputs, c, false));
|
||||||
|
|
||||||
// Continue mixing
|
// Continue mixing
|
||||||
|
|
|
@ -6,12 +6,10 @@ import com.simibubi.create.AllTileEntities;
|
||||||
import com.simibubi.create.foundation.behaviour.base.SmartTileEntity;
|
import com.simibubi.create.foundation.behaviour.base.SmartTileEntity;
|
||||||
import com.simibubi.create.foundation.behaviour.base.TileEntityBehaviour;
|
import com.simibubi.create.foundation.behaviour.base.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.modules.contraptions.goggle.IHaveGoggleInformation;
|
import com.simibubi.create.modules.contraptions.goggle.IHaveGoggleInformation;
|
||||||
import net.minecraft.block.BlockState;
|
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggleInformation {
|
public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggleInformation {
|
||||||
|
|
|
@ -31,8 +31,8 @@ public class SpeedControllerTileEntity extends KineticTileEntity {
|
||||||
super.addBehaviours(behaviours);
|
super.addBehaviours(behaviours);
|
||||||
Integer max = AllConfigs.SERVER.kinetics.maxRotationSpeed.get();
|
Integer max = AllConfigs.SERVER.kinetics.maxRotationSpeed.get();
|
||||||
|
|
||||||
targetSpeed = new ScrollValueBehaviour(Lang.translate("generic.speed"), this,
|
targetSpeed =
|
||||||
new ControllerValueBoxTransform());
|
new ScrollValueBehaviour(Lang.translate("generic.speed"), this, new ControllerValueBoxTransform());
|
||||||
targetSpeed.between(-max, max);
|
targetSpeed.between(-max, max);
|
||||||
targetSpeed.value = DEFAULT_SPEED;
|
targetSpeed.value = DEFAULT_SPEED;
|
||||||
targetSpeed.moveText(new Vec3d(9, 0, 10));
|
targetSpeed.moveText(new Vec3d(9, 0, 10));
|
||||||
|
@ -43,7 +43,7 @@ public class SpeedControllerTileEntity extends KineticTileEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTargetRotation() {
|
private void updateTargetRotation() {
|
||||||
if (hasNetwork())
|
if (hasNetwork())
|
||||||
getOrCreateNetwork().remove(this);
|
getOrCreateNetwork().remove(this);
|
||||||
RotationPropagator.handleRemoved(world, pos, this);
|
RotationPropagator.handleRemoved(world, pos, this);
|
||||||
removeSource();
|
removeSource();
|
||||||
|
@ -54,38 +54,38 @@ public class SpeedControllerTileEntity extends KineticTileEntity {
|
||||||
public boolean hasFastRenderer() {
|
public boolean hasFastRenderer() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getSpeedModifier(KineticTileEntity cogWheel, KineticTileEntity speedControllerIn,
|
public static float getConveyedSpeed(KineticTileEntity cogWheel, KineticTileEntity speedControllerIn,
|
||||||
boolean targetingController) {
|
boolean targetingController) {
|
||||||
if (!(speedControllerIn instanceof SpeedControllerTileEntity))
|
if (!(speedControllerIn instanceof SpeedControllerTileEntity))
|
||||||
return 1;
|
return 0;
|
||||||
SpeedControllerTileEntity speedController = (SpeedControllerTileEntity) speedControllerIn;
|
SpeedControllerTileEntity speedController = (SpeedControllerTileEntity) speedControllerIn;
|
||||||
|
|
||||||
float targetSpeed = speedController.targetSpeed.getValue();
|
float targetSpeed = speedController.targetSpeed.getValue();
|
||||||
float speed = speedControllerIn.getSpeed();
|
float speed = speedControllerIn.getSpeed();
|
||||||
|
float wheelSpeed = cogWheel.getTheoreticalSpeed();
|
||||||
|
|
||||||
if (targetSpeed == 0)
|
if (targetSpeed == 0)
|
||||||
return 0;
|
return 0;
|
||||||
float wheelSpeed = cogWheel.getTheoreticalSpeed();
|
|
||||||
if (targetingController && wheelSpeed == 0)
|
if (targetingController && wheelSpeed == 0)
|
||||||
return 1;
|
return 0;
|
||||||
|
|
||||||
if (!speedController.hasSource()) {
|
if (!speedController.hasSource()) {
|
||||||
if (targetingController)
|
if (targetingController)
|
||||||
return targetSpeed / wheelSpeed;
|
return targetSpeed;
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean wheelPowersController = speedController.source.equals(cogWheel.getPos());
|
boolean wheelPowersController = speedController.source.equals(cogWheel.getPos());
|
||||||
|
|
||||||
if (wheelPowersController) {
|
if (wheelPowersController) {
|
||||||
if (targetingController)
|
if (targetingController)
|
||||||
return targetSpeed / wheelSpeed;
|
return targetSpeed;
|
||||||
return wheelSpeed / targetSpeed;
|
return wheelSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetingController)
|
if (targetingController)
|
||||||
return speed / targetSpeed;
|
return speed;
|
||||||
return targetSpeed / speed;
|
return targetSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ControllerValueBoxTransform extends ValueBoxTransform.Sided {
|
private class ControllerValueBoxTransform extends ValueBoxTransform.Sided {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.simibubi.create.modules.contraptions.relays.belt;
|
package com.simibubi.create.modules.contraptions.relays.belt;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -101,11 +100,12 @@ public class BeltBlock extends HorizontalKineticBlock
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getDrops(BlockState state, net.minecraft.world.storage.loot.LootContext.Builder builder) {
|
public List<ItemStack> getDrops(BlockState state, net.minecraft.world.storage.loot.LootContext.Builder builder) {
|
||||||
List<ItemStack> drops = new ArrayList<>();
|
List<ItemStack> drops = super.getDrops(state, builder);
|
||||||
if (state.get(PART) == Part.START || builder.get(LootParameters.THIS_ENTITY) != null)
|
|
||||||
drops.addAll(super.getDrops(state, builder));
|
|
||||||
if (state.get(CASING))
|
if (state.get(CASING))
|
||||||
drops.addAll(AllBlocks.BRASS_CASING.getDefault().getDrops(builder));
|
drops.addAll(AllBlocks.BRASS_CASING.getDefault().getDrops(builder));
|
||||||
|
TileEntity tileEntity = builder.get(LootParameters.BLOCK_ENTITY);
|
||||||
|
if (tileEntity instanceof BeltTileEntity && ((BeltTileEntity) tileEntity).hasPulley())
|
||||||
|
drops.addAll(AllBlocks.SHAFT.getDefault().getDrops(builder));
|
||||||
return drops;
|
return drops;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,8 +114,6 @@ public class BeltBlock extends HorizontalKineticBlock
|
||||||
withTileEntityDo(worldIn, pos, te -> {
|
withTileEntityDo(worldIn, pos, te -> {
|
||||||
if (worldIn.isRemote)
|
if (worldIn.isRemote)
|
||||||
return;
|
return;
|
||||||
if (te.hasPulley())
|
|
||||||
Block.spawnDrops(AllBlocks.SHAFT.get().getDefaultState(), worldIn, pos);
|
|
||||||
if (te.isController()) {
|
if (te.isController()) {
|
||||||
BeltInventory inv = te.getInventory();
|
BeltInventory inv = te.getInventory();
|
||||||
for (TransportedItemStack s : inv.items)
|
for (TransportedItemStack s : inv.items)
|
||||||
|
@ -283,7 +281,7 @@ public class BeltBlock extends HorizontalKineticBlock
|
||||||
return ActionResultType.SUCCESS;
|
return ActionResultType.SUCCESS;
|
||||||
world.setBlockState(context.getPos(), state.with(CASING, false), 3);
|
world.setBlockState(context.getPos(), state.with(CASING, false), 3);
|
||||||
if (!player.isCreative())
|
if (!player.isCreative())
|
||||||
player.inventory.placeItemBackInInventory(world, new ItemStack(AllBlocks.BRASS_CASING.block));
|
player.inventory.placeItemBackInInventory(world, new ItemStack(AllBlocks.BRASS_CASING.get()));
|
||||||
return ActionResultType.SUCCESS;
|
return ActionResultType.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,7 +292,7 @@ public class BeltBlock extends HorizontalKineticBlock
|
||||||
belt.detachKinetics();
|
belt.detachKinetics();
|
||||||
belt.attachKinetics();
|
belt.attachKinetics();
|
||||||
if (!player.isCreative())
|
if (!player.isCreative())
|
||||||
player.inventory.placeItemBackInInventory(world, new ItemStack(AllBlocks.SHAFT.block));
|
player.inventory.placeItemBackInInventory(world, new ItemStack(AllBlocks.SHAFT.get()));
|
||||||
return ActionResultType.SUCCESS;
|
return ActionResultType.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ class BeltColor implements IBlockColor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getColor(BlockState state, ILightReader reader, BlockPos pos, int layer) {
|
public int getColor(BlockState state, ILightReader reader, BlockPos pos, int layer) {
|
||||||
|
if (reader == null)
|
||||||
|
return 0;
|
||||||
TileEntity tileEntity = reader.getTileEntity(pos);
|
TileEntity tileEntity = reader.getTileEntity(pos);
|
||||||
if (tileEntity instanceof BeltTileEntity) {
|
if (tileEntity instanceof BeltTileEntity) {
|
||||||
BeltTileEntity te = (BeltTileEntity) tileEntity;
|
BeltTileEntity te = (BeltTileEntity) tileEntity;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import net.minecraft.world.World;
|
||||||
public class BeltConnectorItem extends BlockItem implements IAddedByOther {
|
public class BeltConnectorItem extends BlockItem implements IAddedByOther {
|
||||||
|
|
||||||
public BeltConnectorItem(Properties properties) {
|
public BeltConnectorItem(Properties properties) {
|
||||||
super(AllBlocks.BELT.block, properties);
|
super(AllBlocks.BELT.get(), properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -37,12 +37,14 @@ public class BeltInventory {
|
||||||
|
|
||||||
final BeltTileEntity belt;
|
final BeltTileEntity belt;
|
||||||
final List<TransportedItemStack> items;
|
final List<TransportedItemStack> items;
|
||||||
|
final List<TransportedItemStack> toInsert;
|
||||||
boolean beltMovementPositive;
|
boolean beltMovementPositive;
|
||||||
final float SEGMENT_WINDOW = .75f;
|
final float SEGMENT_WINDOW = .75f;
|
||||||
|
|
||||||
public BeltInventory(BeltTileEntity te) {
|
public BeltInventory(BeltTileEntity te) {
|
||||||
this.belt = te;
|
this.belt = te;
|
||||||
items = new LinkedList<>();
|
items = new LinkedList<>();
|
||||||
|
toInsert = new LinkedList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick() {
|
public void tick() {
|
||||||
|
@ -54,6 +56,14 @@ public class BeltInventory {
|
||||||
belt.markDirty();
|
belt.markDirty();
|
||||||
belt.sendData();
|
belt.sendData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add items from previous cycle
|
||||||
|
if (!toInsert.isEmpty()) {
|
||||||
|
toInsert.forEach(this::insert);
|
||||||
|
toInsert.clear();
|
||||||
|
belt.markDirty();
|
||||||
|
belt.sendData();
|
||||||
|
}
|
||||||
|
|
||||||
// Assuming the first entry is furthest on the belt
|
// Assuming the first entry is furthest on the belt
|
||||||
TransportedItemStack stackInFront = null;
|
TransportedItemStack stackInFront = null;
|
||||||
|
@ -325,18 +335,29 @@ public class BeltInventory {
|
||||||
else if (!beltMovementPositive)
|
else if (!beltMovementPositive)
|
||||||
segmentPos += 1f;
|
segmentPos += 1f;
|
||||||
|
|
||||||
for (TransportedItemStack stack : items) {
|
for (TransportedItemStack stack : items)
|
||||||
float currentPos = stack.beltPosition;
|
if (isBlocking(segment, side, segmentPos, stack))
|
||||||
|
|
||||||
if (stack.insertedAt == segment && stack.insertedFrom == side
|
|
||||||
&& (beltMovementPositive ? currentPos <= segmentPos + 1 : currentPos >= segmentPos - 1))
|
|
||||||
return false;
|
return false;
|
||||||
|
for (TransportedItemStack stack : toInsert)
|
||||||
}
|
if (isBlocking(segment, side, segmentPos, stack))
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void insert(TransportedItemStack newStack) {
|
private boolean isBlocking(int segment, Direction side, float segmentPos, TransportedItemStack stack) {
|
||||||
|
float currentPos = stack.beltPosition;
|
||||||
|
if (stack.insertedAt == segment && stack.insertedFrom == side
|
||||||
|
&& (beltMovementPositive ? currentPos <= segmentPos + 1 : currentPos >= segmentPos - 1))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addItem(TransportedItemStack newStack) {
|
||||||
|
toInsert.add(newStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void insert(TransportedItemStack newStack) {
|
||||||
if (items.isEmpty())
|
if (items.isEmpty())
|
||||||
items.add(newStack);
|
items.add(newStack);
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -347,7 +347,7 @@ public class BeltTileEntity extends KineticTileEntity {
|
||||||
transportedStack.insertedAt = index;
|
transportedStack.insertedAt = index;
|
||||||
transportedStack.insertedFrom = side;
|
transportedStack.insertedFrom = side;
|
||||||
transportedStack.prevBeltPosition = transportedStack.beltPosition;
|
transportedStack.prevBeltPosition = transportedStack.beltPosition;
|
||||||
nextInventory.insert(transportedStack);
|
nextInventory.addItem(transportedStack);
|
||||||
nextBeltController.markDirty();
|
nextBeltController.markDirty();
|
||||||
nextBeltController.sendData();
|
nextBeltController.sendData();
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class ItemHandlerBeltSegment implements IItemHandler {
|
||||||
newStack.insertedAt = offset;
|
newStack.insertedAt = offset;
|
||||||
newStack.beltPosition = offset + .5f + (beltInventory.beltMovementPositive ? -1 : 1) / 16f;
|
newStack.beltPosition = offset + .5f + (beltInventory.beltMovementPositive ? -1 : 1) / 16f;
|
||||||
newStack.prevBeltPosition = newStack.beltPosition;
|
newStack.prevBeltPosition = newStack.beltPosition;
|
||||||
this.beltInventory.insert(newStack);
|
this.beltInventory.addItem(newStack);
|
||||||
this.beltInventory.belt.markDirty();
|
this.beltInventory.belt.markDirty();
|
||||||
this.beltInventory.belt.sendData();
|
this.beltInventory.belt.sendData();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@ import net.minecraft.item.BlockItemUseContext;
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.NonNullList;
|
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||||
import net.minecraft.util.math.shapes.VoxelShape;
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
|
@ -64,7 +64,7 @@ public class CogWheelBlock extends ShaftBlock implements IHaveCustomBlockItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(block instanceof IRotate)
|
if (!(block instanceof IRotate)
|
||||||
|| !(((IRotate) block).hasCogsTowards(world, placedOnPos, placedAgainst, context.getFace()))) {
|
|| !(((IRotate) block).hasIntegratedCogwheel(world, placedOnPos, placedAgainst))) {
|
||||||
Axis preferredAxis = getPreferredAxis(context);
|
Axis preferredAxis = getPreferredAxis(context);
|
||||||
if (preferredAxis != null)
|
if (preferredAxis != null)
|
||||||
return this.getDefaultState().with(AXIS, preferredAxis);
|
return this.getDefaultState().with(AXIS, preferredAxis);
|
||||||
|
@ -91,8 +91,8 @@ public class CogWheelBlock extends ShaftBlock implements IHaveCustomBlockItem {
|
||||||
// IRotate
|
// IRotate
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCogsTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
|
public boolean hasIntegratedCogwheel(IWorldReader world, BlockPos pos, BlockState state) {
|
||||||
return !isLarge && face.getAxis() != state.get(AXIS);
|
return !isLarge;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
import com.simibubi.create.modules.contraptions.base.DirectionalAxisKineticBlock;
|
import com.simibubi.create.modules.contraptions.base.DirectionalAxisKineticBlock;
|
||||||
|
import com.simibubi.create.modules.contraptions.base.IRotate;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -25,7 +26,6 @@ import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||||
import net.minecraft.util.math.shapes.VoxelShape;
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.IWorldReader;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class GaugeBlock extends DirectionalAxisKineticBlock {
|
public class GaugeBlock extends DirectionalAxisKineticBlock {
|
||||||
|
@ -65,34 +65,41 @@ public class GaugeBlock extends DirectionalAxisKineticBlock {
|
||||||
return Blocks.SPRUCE_PLANKS.getMaterialColor(state, worldIn, pos);
|
return Blocks.SPRUCE_PLANKS.getMaterialColor(state, worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||||
|
World world = context.getWorld();
|
||||||
|
Direction face = context.getFace();
|
||||||
|
BlockPos placedOnPos = context.getPos().offset(context.getFace().getOpposite());
|
||||||
|
BlockState placedOnState = world.getBlockState(placedOnPos);
|
||||||
|
Block block = placedOnState.getBlock();
|
||||||
|
|
||||||
|
if (block instanceof IRotate && ((IRotate) block).hasShaftTowards(world, placedOnPos, placedOnState, face)) {
|
||||||
|
BlockState toPlace = getDefaultState();
|
||||||
|
Direction horizontalFacing = context.getPlacementHorizontalFacing();
|
||||||
|
Direction nearestLookingDirection = context.getNearestLookingDirection();
|
||||||
|
boolean lookPositive = nearestLookingDirection.getAxisDirection() == AxisDirection.POSITIVE;
|
||||||
|
if (face.getAxis() == Axis.X) {
|
||||||
|
toPlace = toPlace.with(FACING, lookPositive ? Direction.NORTH : Direction.SOUTH)
|
||||||
|
.with(AXIS_ALONG_FIRST_COORDINATE, true);
|
||||||
|
} else if (face.getAxis() == Axis.Y) {
|
||||||
|
toPlace = toPlace.with(FACING, horizontalFacing.getOpposite()).with(AXIS_ALONG_FIRST_COORDINATE,
|
||||||
|
horizontalFacing.getAxis() == Axis.X);
|
||||||
|
} else {
|
||||||
|
toPlace = toPlace.with(FACING, lookPositive ? Direction.WEST : Direction.EAST)
|
||||||
|
.with(AXIS_ALONG_FIRST_COORDINATE, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return toPlace;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.getStateForPlacement(context);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasStaticPart() {
|
protected boolean hasStaticPart() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
|
|
||||||
Direction facing = state.get(FACING).getOpposite();
|
|
||||||
BlockPos neighbourPos = pos.offset(facing);
|
|
||||||
BlockState neighbour = worldIn.getBlockState(neighbourPos);
|
|
||||||
return Block.hasSolidSide(neighbour, worldIn, neighbourPos, facing.getOpposite());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
|
|
||||||
boolean isMoving) {
|
|
||||||
if (worldIn.isRemote)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Direction blockFacing = state.get(FACING);
|
|
||||||
if (fromPos.equals(pos.offset(blockFacing.getOpposite()))) {
|
|
||||||
if (!isValidPosition(state, worldIn, pos)) {
|
|
||||||
worldIn.destroyBlock(pos, true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Direction getFacingForPlacement(BlockItemUseContext context) {
|
protected Direction getFacingForPlacement(BlockItemUseContext context) {
|
||||||
return context.getFace();
|
return context.getFace();
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
package com.simibubi.create.modules.contraptions.relays.gauge;
|
package com.simibubi.create.modules.contraptions.relays.gauge;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||||
|
|
||||||
import com.simibubi.create.modules.contraptions.goggle.IHaveGoggleInformation;
|
import com.simibubi.create.modules.contraptions.goggle.IHaveGoggleInformation;
|
||||||
import net.minecraft.block.BlockState;
|
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
|
||||||
|
|
||||||
import java.util.List;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
|
|
||||||
public class GaugeTileEntity extends KineticTileEntity implements IHaveGoggleInformation {
|
public class GaugeTileEntity extends KineticTileEntity implements IHaveGoggleInformation {
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class GaugeTileEntityRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockState getRenderedBlockState(KineticTileEntity te) {
|
protected BlockState getRenderedBlockState(KineticTileEntity te) {
|
||||||
return AllBlocks.SHAFT.block.getDefaultState().with(BlockStateProperties.AXIS,
|
return AllBlocks.SHAFT.get().getDefaultState().with(BlockStateProperties.AXIS,
|
||||||
((IRotate) te.getBlockState().getBlock()).getRotationAxis(te.getBlockState()));
|
((IRotate) te.getBlockState().getBlock()).getRotationAxis(te.getBlockState()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.simibubi.create.modules.contraptions.relays.gauge;
|
package com.simibubi.create.modules.contraptions.relays.gauge;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.simibubi.create.AllTileEntities;
|
import com.simibubi.create.AllTileEntities;
|
||||||
import com.simibubi.create.config.AllConfigs;
|
import com.simibubi.create.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.advancement.AllTriggers;
|
import com.simibubi.create.foundation.advancement.AllTriggers;
|
||||||
|
@ -11,8 +13,6 @@ import com.simibubi.create.modules.contraptions.base.IRotate.SpeedLevel;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class SpeedGaugeTileEntity extends GaugeTileEntity{
|
public class SpeedGaugeTileEntity extends GaugeTileEntity{
|
||||||
|
|
||||||
public SpeedGaugeTileEntity() {
|
public SpeedGaugeTileEntity() {
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
package com.simibubi.create.modules.contraptions.relays.gauge;
|
package com.simibubi.create.modules.contraptions.relays.gauge;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.simibubi.create.AllTileEntities;
|
import com.simibubi.create.AllTileEntities;
|
||||||
import com.simibubi.create.foundation.item.ItemDescription;
|
import com.simibubi.create.foundation.item.ItemDescription;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.modules.contraptions.base.IRotate.StressImpact;
|
import com.simibubi.create.modules.contraptions.base.IRotate.StressImpact;
|
||||||
import com.simibubi.create.modules.contraptions.goggle.IHaveGoggleInformation;
|
import com.simibubi.create.modules.contraptions.goggle.IHaveGoggleInformation;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
|
|
||||||
import java.util.List;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
|
||||||
public class StressGaugeTileEntity extends GaugeTileEntity {
|
public class StressGaugeTileEntity extends GaugeTileEntity {
|
||||||
|
|
||||||
|
@ -17,8 +18,8 @@ public class StressGaugeTileEntity extends GaugeTileEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateStressFromNetwork(float maxStress, float currentStress) {
|
public void updateFromNetwork(float maxStress, float currentStress, int networkSize) {
|
||||||
super.updateStressFromNetwork(maxStress, currentStress);
|
super.updateFromNetwork(maxStress, currentStress, networkSize);
|
||||||
|
|
||||||
if (!StressImpact.isEnabled())
|
if (!StressImpact.isEnabled())
|
||||||
dialTarget = 0;
|
dialTarget = 0;
|
||||||
|
@ -50,7 +51,8 @@ public class StressGaugeTileEntity extends GaugeTileEntity {
|
||||||
markDirty();
|
markDirty();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
updateStressFromNetwork(capacity, stress);
|
|
||||||
|
updateFromNetwork(capacity, stress, getOrCreateNetwork().getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,7 +68,8 @@ public class StressGaugeTileEntity extends GaugeTileEntity {
|
||||||
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.stress_gauge.title"));
|
tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("gui.stress_gauge.title"));
|
||||||
|
|
||||||
if (getTheoreticalSpeed() == 0)
|
if (getTheoreticalSpeed() == 0)
|
||||||
tooltip.add(TextFormatting.DARK_GRAY + ItemDescription.makeProgressBar(3, -1) + Lang.translate("gui.stress_gauge.no_rotation"));
|
tooltip.add(TextFormatting.DARK_GRAY + ItemDescription.makeProgressBar(3, -1)
|
||||||
|
+ Lang.translate("gui.stress_gauge.no_rotation"));
|
||||||
else {
|
else {
|
||||||
tooltip.add(spacing + StressImpact.getFormattedStressText(stressFraction));
|
tooltip.add(spacing + StressImpact.getFormattedStressText(stressFraction));
|
||||||
|
|
||||||
|
@ -75,10 +78,13 @@ public class StressGaugeTileEntity extends GaugeTileEntity {
|
||||||
double remainingCapacity = capacity - getNetworkStress();
|
double remainingCapacity = capacity - getNetworkStress();
|
||||||
double remainingCapacityAtBase = remainingCapacity / Math.abs(getTheoreticalSpeed());
|
double remainingCapacityAtBase = remainingCapacity / Math.abs(getTheoreticalSpeed());
|
||||||
|
|
||||||
String capacityString = spacing + StressImpact.of(stressFraction).getRelativeColor() + "%s" + Lang.translate("generic.unit.stress") + " " + TextFormatting.DARK_GRAY + "%s";
|
String capacityString = spacing + StressImpact.of(stressFraction).getRelativeColor() + "%s"
|
||||||
|
+ Lang.translate("generic.unit.stress") + " " + TextFormatting.DARK_GRAY + "%s";
|
||||||
|
|
||||||
tooltip.add(String.format(capacityString, IHaveGoggleInformation.format(remainingCapacityAtBase), Lang.translate("gui.goggles.base_value")));
|
tooltip.add(String.format(capacityString, IHaveGoggleInformation.format(remainingCapacityAtBase),
|
||||||
tooltip.add(String.format(capacityString, IHaveGoggleInformation.format(remainingCapacity), Lang.translate("gui.goggles.at_current_speed")));
|
Lang.translate("gui.goggles.base_value")));
|
||||||
|
tooltip.add(String.format(capacityString, IHaveGoggleInformation.format(remainingCapacity),
|
||||||
|
Lang.translate("gui.goggles.at_current_speed")));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,14 @@ import net.minecraft.particles.ParticleTypes;
|
||||||
import net.minecraft.tileentity.BeaconTileEntity;
|
import net.minecraft.tileentity.BeaconTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.*;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.RayTraceContext;
|
||||||
import net.minecraft.util.math.RayTraceContext.BlockMode;
|
import net.minecraft.util.math.RayTraceContext.BlockMode;
|
||||||
import net.minecraft.util.math.RayTraceContext.FluidMode;
|
import net.minecraft.util.math.RayTraceContext.FluidMode;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
|
@ -32,7 +32,7 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||||
public class DeforesterItem extends AxeItem implements IHaveCustomItemModel {
|
public class DeforesterItem extends AxeItem implements IHaveCustomItemModel {
|
||||||
|
|
||||||
public DeforesterItem(Properties builder) {
|
public DeforesterItem(Properties builder) {
|
||||||
super(AllToolTiers.RADIANT, 10.0F, -3.1F, builder);
|
super(AllToolTiers.RADIANT, 5.0F, -3.1F, builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Moved away from Item#onBlockDestroyed as it does not get called in Creative
|
// Moved away from Item#onBlockDestroyed as it does not get called in Creative
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class CrossPlaneMirror extends SymmetryMirror {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getModel() {
|
public BlockState getModel() {
|
||||||
return AllBlocks.SYMMETRY_CROSSPLANE.block.getDefaultState().with(CrossPlaneSymmetryBlock.align,
|
return AllBlocks.SYMMETRY_CROSSPLANE.get().getDefaultState().with(CrossPlaneSymmetryBlock.align,
|
||||||
(Align) orientation);
|
(Align) orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class PlaneMirror extends SymmetryMirror {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getModel() {
|
public BlockState getModel() {
|
||||||
return AllBlocks.SYMMETRY_PLANE.block.getDefaultState().with(PlaneSymmetryBlock.align, (Align) orientation);
|
return AllBlocks.SYMMETRY_PLANE.get().getDefaultState().with(PlaneSymmetryBlock.align, (Align) orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class TriplePlaneMirror extends SymmetryMirror {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getModel() {
|
public BlockState getModel() {
|
||||||
return AllBlocks.SYMMETRY_TRIPLEPLANE.block.getDefaultState();
|
return AllBlocks.SYMMETRY_TRIPLEPLANE.get().getDefaultState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -67,12 +67,16 @@ public class BlazingToolItem extends AbstractToolItem {
|
||||||
public void modifyDrops(Collection<ItemStack> drops, IWorld world, BlockPos pos, ItemStack tool, BlockState state) {
|
public void modifyDrops(Collection<ItemStack> drops, IWorld world, BlockPos pos, ItemStack tool, BlockState state) {
|
||||||
super.modifyDrops(drops, world, pos, tool, state);
|
super.modifyDrops(drops, world, pos, tool, state);
|
||||||
World worldIn = world.getWorld();
|
World worldIn = world.getWorld();
|
||||||
helperFurnace.setWorld(worldIn);
|
|
||||||
|
|
||||||
RecipeManager recipeManager = worldIn.getRecipeManager();
|
|
||||||
int enchantmentLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, tool);
|
int enchantmentLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, tool);
|
||||||
if (state == null)
|
if (state == null)
|
||||||
enchantmentLevel = 0;
|
enchantmentLevel = 0;
|
||||||
|
List<ItemStack> smeltedStacks = smeltDrops(drops, worldIn, enchantmentLevel);
|
||||||
|
drops.addAll(smeltedStacks);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemStack> smeltDrops(Collection<ItemStack> drops, World worldIn, int enchantmentLevel) {
|
||||||
|
helperFurnace.setWorld(worldIn);
|
||||||
|
RecipeManager recipeManager = worldIn.getRecipeManager();
|
||||||
List<ItemStack> smeltedStacks = new ArrayList<>();
|
List<ItemStack> smeltedStacks = new ArrayList<>();
|
||||||
Iterator<ItemStack> dropper = drops.iterator();
|
Iterator<ItemStack> dropper = drops.iterator();
|
||||||
while (dropper.hasNext()) {
|
while (dropper.hasNext()) {
|
||||||
|
@ -87,13 +91,12 @@ public class BlazingToolItem extends AbstractToolItem {
|
||||||
|
|
||||||
float modifier = 1;
|
float modifier = 1;
|
||||||
if (stack.getItem() instanceof BlockItem && !(out.getItem() instanceof BlockItem))
|
if (stack.getItem() instanceof BlockItem && !(out.getItem() instanceof BlockItem))
|
||||||
modifier += world.getRandom().nextFloat() * enchantmentLevel;
|
modifier += worldIn.getRandom().nextFloat() * enchantmentLevel;
|
||||||
|
|
||||||
out.setCount((int) (out.getCount() * modifier + .4f));
|
out.setCount((int) (out.getCount() * modifier + .4f));
|
||||||
smeltedStacks.addAll(ItemHelper.multipliedOutput(stack, out));
|
smeltedStacks.addAll(ItemHelper.multipliedOutput(stack, out));
|
||||||
}
|
}
|
||||||
|
return smeltedStacks;
|
||||||
drops.addAll(smeltedStacks);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -113,7 +113,12 @@ public class SandPaperItem extends Item implements IHaveCustomItemModel {
|
||||||
public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) {
|
public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) {
|
||||||
return enchantment == Enchantments.FORTUNE || super.canApplyAtEnchantingTable(stack, enchantment);
|
return enchantment == Enchantments.FORTUNE || super.canApplyAtEnchantingTable(stack, enchantment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemEnchantability(ItemStack stack) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, LivingEntity entityLiving) {
|
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, LivingEntity entityLiving) {
|
||||||
if (!(entityLiving instanceof PlayerEntity))
|
if (!(entityLiving instanceof PlayerEntity))
|
||||||
|
@ -188,6 +193,11 @@ public class SandPaperItem extends Item implements IHaveCustomItemModel {
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemEnchantability() {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public CustomRenderedItemModel createModel(IBakedModel original) {
|
public CustomRenderedItemModel createModel(IBakedModel original) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class SandPaperPolishingRecipe extends ProcessingRecipe<SandPaperInv> {
|
||||||
return matchingRecipes.get(0).getCraftingResult(new SandPaperInv(stack)).copy();
|
return matchingRecipes.get(0).getCraftingResult(new SandPaperInv(stack)).copy();
|
||||||
if (stack.isDamageable() && isPolishingEnabled()) {
|
if (stack.isDamageable() && isPolishingEnabled()) {
|
||||||
|
|
||||||
stack.setDamage(stack.getDamage() - (stack.getMaxDamage() - stack.getDamage()) / 2);
|
stack.setDamage(stack.getDamage() / 2);
|
||||||
|
|
||||||
int fortuneLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, sandPaperStack);
|
int fortuneLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, sandPaperStack);
|
||||||
float chanceToPunish = (float) (1 / Math.pow(2, fortuneLevel + 1));
|
float chanceToPunish = (float) (1 / Math.pow(2, fortuneLevel + 1));
|
||||||
|
|
|
@ -16,8 +16,10 @@ import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.item.ItemEntity;
|
import net.minecraft.entity.item.ItemEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
|
import net.minecraft.item.IItemTier;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.TieredItem;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.util.EntityDamageSource;
|
import net.minecraft.util.EntityDamageSource;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -98,8 +100,11 @@ public class ToolEvents {
|
||||||
ItemStack heldItemMainhand = player.getHeldItemMainhand();
|
ItemStack heldItemMainhand = player.getHeldItemMainhand();
|
||||||
String marker = "create_roseQuartzRange";
|
String marker = "create_roseQuartzRange";
|
||||||
CompoundNBT persistentData = player.getPersistentData();
|
CompoundNBT persistentData = player.getPersistentData();
|
||||||
|
Item item = heldItemMainhand.getItem();
|
||||||
|
boolean holdingRoseQuartz =
|
||||||
|
item instanceof TieredItem && ((TieredItem) item).getTier() == AllToolTiers.ROSE_QUARTZ;
|
||||||
|
|
||||||
if (!(heldItemMainhand.getItem() instanceof RoseQuartzToolItem)) {
|
if (!holdingRoseQuartz) {
|
||||||
if (persistentData.contains(marker)) {
|
if (persistentData.contains(marker)) {
|
||||||
player.getAttributes().removeAttributeModifiers(RoseQuartzToolItem.rangeModifier);
|
player.getAttributes().removeAttributeModifiers(RoseQuartzToolItem.rangeModifier);
|
||||||
persistentData.remove(marker);
|
persistentData.remove(marker);
|
||||||
|
@ -127,18 +132,20 @@ public class ToolEvents {
|
||||||
PlayerEntity player = (PlayerEntity) trueSource;
|
PlayerEntity player = (PlayerEntity) trueSource;
|
||||||
ItemStack heldItemMainhand = player.getHeldItemMainhand();
|
ItemStack heldItemMainhand = player.getHeldItemMainhand();
|
||||||
Item item = heldItemMainhand.getItem();
|
Item item = heldItemMainhand.getItem();
|
||||||
|
IItemTier tier = item instanceof TieredItem ? ((TieredItem) item).getTier() : null;
|
||||||
|
|
||||||
if (item instanceof ShadowSteelToolItem)
|
if (tier == AllToolTiers.SHADOW_STEEL)
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
|
|
||||||
if (item instanceof BlazingToolItem) {
|
if (tier == AllToolTiers.BLAZING) {
|
||||||
BlazingToolItem blazingToolItem = (BlazingToolItem) item;
|
|
||||||
List<ItemStack> drops = event.getDrops().stream().map(entity -> {
|
List<ItemStack> drops = event.getDrops().stream().map(entity -> {
|
||||||
ItemStack stack = entity.getItem();
|
ItemStack stack = entity.getItem();
|
||||||
entity.remove();
|
entity.remove();
|
||||||
return stack;
|
return stack;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
blazingToolItem.modifyDrops(drops, world, player.getPosition(), heldItemMainhand, null);
|
|
||||||
|
drops = BlazingToolItem.smeltDrops(drops, world, 0);
|
||||||
|
|
||||||
event.getDrops().clear();
|
event.getDrops().clear();
|
||||||
drops.stream().map(stack -> {
|
drops.stream().map(stack -> {
|
||||||
ItemEntity entity = new ItemEntity(world, target.posX, target.posY, target.posZ, stack);
|
ItemEntity entity = new ItemEntity(world, target.posX, target.posY, target.posZ, stack);
|
||||||
|
@ -156,7 +163,10 @@ public class ToolEvents {
|
||||||
if (attackingPlayer == null)
|
if (attackingPlayer == null)
|
||||||
return;
|
return;
|
||||||
ItemStack heldItemMainhand = attackingPlayer.getHeldItemMainhand();
|
ItemStack heldItemMainhand = attackingPlayer.getHeldItemMainhand();
|
||||||
if (heldItemMainhand.getItem() instanceof ShadowSteelToolItem) {
|
Item item = heldItemMainhand.getItem();
|
||||||
|
IItemTier tier = item instanceof TieredItem ? ((TieredItem) item).getTier() : null;
|
||||||
|
|
||||||
|
if (tier == AllToolTiers.SHADOW_STEEL) {
|
||||||
int level = EnchantmentHelper.getEnchantmentLevel(Enchantments.LOOTING, heldItemMainhand);
|
int level = EnchantmentHelper.getEnchantmentLevel(Enchantments.LOOTING, heldItemMainhand);
|
||||||
float modifier = 1 + event.getEntity().world.getRandom().nextFloat() * level;
|
float modifier = 1 + event.getEntity().world.getRandom().nextFloat() * level;
|
||||||
event.setDroppedExperience((int) (event.getDroppedExperience() * modifier + .4f));
|
event.setDroppedExperience((int) (event.getDroppedExperience() * modifier + .4f));
|
||||||
|
|
|
@ -9,8 +9,8 @@ import static com.simibubi.create.modules.curiosities.zapper.blockzapper.Blockza
|
||||||
import com.mojang.blaze3d.platform.GLX;
|
import com.mojang.blaze3d.platform.GLX;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
import com.simibubi.create.modules.curiosities.zapper.ZapperRenderHandler;
|
|
||||||
import com.simibubi.create.modules.curiosities.zapper.ZapperItemRenderer;
|
import com.simibubi.create.modules.curiosities.zapper.ZapperItemRenderer;
|
||||||
|
import com.simibubi.create.modules.curiosities.zapper.ZapperRenderHandler;
|
||||||
import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.ComponentTier;
|
import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.ComponentTier;
|
||||||
import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.Components;
|
import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.Components;
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue