diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index e13a79fdf..f498b4ba5 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -115,7 +115,7 @@ public enum AllBlocks { ENCASED_BELT(new EncasedBeltBlock()), ADJUSTABLE_PULLEY(new AdjustablePulleyBlock()), BELT(new BeltBlock()), - MOTOR(new MotorBlock()), + CREATIVE_MOTOR(new MotorBlock()), WATER_WHEEL(new WaterWheelBlock()), ENCASED_FAN(new EncasedFanBlock()), NOZZLE(new NozzleBlock()), diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index f0bb39a1a..63ba780a5 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -98,7 +98,7 @@ public enum AllTileEntities { // Kinetics SHAFT(ShaftTileEntity::new, AllBlocks.SHAFT, AllBlocks.COGWHEEL, AllBlocks.LARGE_COGWHEEL, AllBlocks.ENCASED_SHAFT), - MOTOR(MotorTileEntity::new, AllBlocks.MOTOR), + MOTOR(MotorTileEntity::new, AllBlocks.CREATIVE_MOTOR), GEARBOX(GearboxTileEntity::new, AllBlocks.GEARBOX), TURNTABLE(TurntableTileEntity::new, AllBlocks.TURNTABLE), ENCASED_SHAFT(EncasedShaftTileEntity::new, AllBlocks.ENCASED_SHAFT, AllBlocks.ENCASED_BELT), diff --git a/src/main/java/com/simibubi/create/ScreenResources.java b/src/main/java/com/simibubi/create/ScreenResources.java index d62357424..62735a0d0 100644 --- a/src/main/java/com/simibubi/create/ScreenResources.java +++ b/src/main/java/com/simibubi/create/ScreenResources.java @@ -16,7 +16,8 @@ public enum ScreenResources { SCHEMATIC_TABLE_PROGRESS("schematic_table.png", 209, 0, 24, 17), SCHEMATIC("schematic.png", 207, 95), - SCHEMATICANNON("schematicannon.png", 247, 161), + SCHEMATICANNON_BG("schematicannon.png", 247, 161), + SCHEMATICANNON_BG_FUEL("schematicannon.png", 247, 161), SCHEMATICANNON_PROGRESS("schematicannon.png", 0, 161, 121, 16), SCHEMATICANNON_PROGRESS_2("schematicannon.png", 122, 161, 16, 15), SCHEMATICANNON_HIGHLIGHT("schematicannon.png", 0, 182, 28, 28), diff --git a/src/main/java/com/simibubi/create/config/CStress.java b/src/main/java/com/simibubi/create/config/CStress.java index 4fa303a02..d42a7cc10 100644 --- a/src/main/java/com/simibubi/create/config/CStress.java +++ b/src/main/java/com/simibubi/create/config/CStress.java @@ -6,6 +6,7 @@ import java.util.Map; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.modules.contraptions.base.KineticBlock; +import com.simibubi.create.modules.contraptions.components.flywheel.engine.EngineBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.ForgeConfigSpec; @@ -14,8 +15,8 @@ import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; public class CStress extends ConfigBase { - public Map> impacts = new HashMap<>(); public Map> capacities = new HashMap<>(); + public Map> impacts = new HashMap<>(); @Override protected void registerAll(Builder builder) { @@ -27,7 +28,7 @@ public class CStress extends ConfigBase { builder.comment("", Comments.su, Comments.capacity).push("capacity"); for (AllBlocks block : AllBlocks.values()) - if (block.get() instanceof KineticBlock) + if (block.get() instanceof KineticBlock || block.get() instanceof EngineBlock) initStressCapacityEntry(block, builder); builder.pop(); } @@ -35,7 +36,7 @@ public class CStress extends ConfigBase { private void initStressEntry(AllBlocks block, final ForgeConfigSpec.Builder builder) { String name = Lang.asId(block.name()); double defaultStressImpact = StressConfigDefaults.getDefaultStressImpact(block); - capacities.put(block.get().getRegistryName(), builder.define(name, defaultStressImpact)); + impacts.put(block.get().getRegistryName(), builder.define(name, defaultStressImpact)); } private void initStressCapacityEntry(AllBlocks block, final ForgeConfigSpec.Builder builder) { @@ -43,7 +44,7 @@ public class CStress extends ConfigBase { if (defaultStressCapacity == -1) return; String name = Lang.asId(block.name()); - impacts.put(block.get().getRegistryName(), builder.define(name, defaultStressCapacity)); + capacities.put(block.get().getRegistryName(), builder.define(name, defaultStressCapacity)); } @Override diff --git a/src/main/java/com/simibubi/create/config/StressConfigDefaults.java b/src/main/java/com/simibubi/create/config/StressConfigDefaults.java index f47eac99d..141b3694b 100644 --- a/src/main/java/com/simibubi/create/config/StressConfigDefaults.java +++ b/src/main/java/com/simibubi/create/config/StressConfigDefaults.java @@ -7,8 +7,10 @@ public class StressConfigDefaults { public static double getDefaultStressCapacity(AllBlocks block) { switch (block) { - case MOTOR: + case CREATIVE_MOTOR: return 1024; + case FURNACE_ENGINE: + return 512; case MECHANICAL_BEARING: return 128; case ENCASED_FAN: diff --git a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java index b321b5f36..5a1615c9a 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java @@ -28,6 +28,7 @@ import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.modules.contraptions.base.IRotate; import com.simibubi.create.modules.contraptions.base.IRotate.SpeedLevel; import com.simibubi.create.modules.contraptions.base.IRotate.StressImpact; +import com.simibubi.create.modules.contraptions.components.flywheel.engine.EngineBlock; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -82,13 +83,15 @@ public class ItemDescription { return this; } - public ItemDescription withKineticStats(IRotate block) { + public ItemDescription withKineticStats(Block block) { + + boolean isEngine = block instanceof EngineBlock; CKinetics config = AllConfigs.SERVER.kinetics; - SpeedLevel minimumRequiredSpeedLevel = block.getMinimumRequiredSpeedLevel(); + SpeedLevel minimumRequiredSpeedLevel = isEngine ? SpeedLevel.NONE : ((IRotate) block).getMinimumRequiredSpeedLevel(); boolean hasSpeedRequirement = minimumRequiredSpeedLevel != SpeedLevel.NONE; ResourceLocation id = ((Block) block).getRegistryName(); - Map> impacts = config.stressValues.capacities; - Map> capacities = config.stressValues.impacts; + Map> impacts = config.stressValues.impacts; + Map> capacities = config.stressValues.capacities; boolean hasStressImpact = impacts.containsKey(id) && impacts.get(id).get() > 0; boolean hasStressCapacity = capacities.containsKey(id); boolean hasGlasses = @@ -108,7 +111,7 @@ public class ItemDescription { add(linesOnShift, level); } String stressUnit = Lang.translate("generic.unit.stress"); - if (hasStressImpact && !block.hideStressImpact()) { + if (hasStressImpact && !(!isEngine && ((IRotate) block).hideStressImpact())) { List stressLevels = Lang.translatedOptions("tooltip.stressImpact", "low", "medium", "high"); double impact = impacts.get(id).get(); StressImpact impactId = impact >= config.highStressImpact.get() ? StressImpact.HIGH @@ -134,7 +137,7 @@ public class ItemDescription { if (hasGlasses) level += " (" + capacity + stressUnit + ")"; - if (block.showCapacityWithAnnotation()) + if (!isEngine && ((IRotate) block).showCapacityWithAnnotation()) level += " " + DARK_GRAY + TextFormatting.ITALIC + Lang.translate("tooltip.capacityProvided.asGenerator"); diff --git a/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java b/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java index dbdcc065e..14882f5ba 100644 --- a/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java +++ b/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java @@ -13,6 +13,7 @@ import com.simibubi.create.foundation.item.ItemDescription.Palette; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.modules.IModule; import com.simibubi.create.modules.contraptions.base.IRotate; +import com.simibubi.create.modules.contraptions.components.flywheel.engine.EngineBlock; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; @@ -133,8 +134,8 @@ public class TooltipHelper { // Requirements if (stack.getItem() instanceof BlockItem) { BlockItem item = (BlockItem) stack.getItem(); - if (item.getBlock() instanceof IRotate) { - tooltip = tooltip.withKineticStats((IRotate) item.getBlock()); + if (item.getBlock() instanceof IRotate || item.getBlock() instanceof EngineBlock) { + tooltip = tooltip.withKineticStats(item.getBlock()); } } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java index 2767db839..a683f470b 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java @@ -81,7 +81,7 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick } public float getAddedStressCapacity() { - Map> capacityMap = AllConfigs.SERVER.kinetics.stressValues.impacts; + Map> capacityMap = AllConfigs.SERVER.kinetics.stressValues.capacities; ResourceLocation path = getBlockState().getBlock().getRegistryName(); if (!capacityMap.containsKey(path)) return 0; @@ -89,7 +89,7 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick } public float getStressApplied() { - Map> stressEntries = AllConfigs.SERVER.kinetics.stressValues.capacities; + Map> stressEntries = AllConfigs.SERVER.kinetics.stressValues.impacts; ResourceLocation path = getBlockState().getBlock().getRegistryName(); if (!stressEntries.containsKey(path)) return 1; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/clock/CuckooClockBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/clock/CuckooClockBlock.java index 49e8f7d0f..02cc18810 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/clock/CuckooClockBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/clock/CuckooClockBlock.java @@ -1,5 +1,6 @@ package com.simibubi.create.modules.contraptions.components.clock; +import com.simibubi.create.AllBlocks; import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock; import net.minecraft.block.Block; @@ -41,6 +42,13 @@ public class CuckooClockBlock extends HorizontalKineticBlock { if (!mysterious) super.fillItemGroup(group, items); } + + @Override + public String getTranslationKey() { + if (this == AllBlocks.MYSTERIOUS_CUCKOO_CLOCK.get()) + return AllBlocks.CUCKOO_CLOCK.get().getTranslationKey(); + return super.getTranslationKey(); + } @Override public BlockState getStateForPlacement(BlockItemUseContext context) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java index 185361304..87f487dd0 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java @@ -1,10 +1,13 @@ package com.simibubi.create.modules.contraptions.components.flywheel.engine; +import com.simibubi.create.AllBlocks; import com.simibubi.create.AllTileEntities; +import com.simibubi.create.config.AllConfigs; import net.minecraft.block.AbstractFurnaceBlock; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.util.ResourceLocation; public class FurnaceEngineTileEntity extends EngineTileEntity { @@ -22,12 +25,14 @@ public class FurnaceEngineTileEntity extends EngineTileEntity { BlockState state = world.getBlockState(EngineBlock.getBaseBlockPos(getBlockState(), pos)); if (!(state.getBlock() instanceof AbstractFurnaceBlock)) return; - + float modifier = state.getBlock() == Blocks.BLAST_FURNACE ? 2 : 1; boolean active = state.has(AbstractFurnaceBlock.LIT) && state.get(AbstractFurnaceBlock.LIT); float speed = active ? 16 * modifier : 0; - float capacity = active ? 512 : 0; - + ResourceLocation registryName = AllBlocks.FURNACE_ENGINE.get().getRegistryName(); + float capacity = + active ? AllConfigs.SERVER.kinetics.stressValues.capacities.get(registryName).get().floatValue() : 0; + appliedCapacity = capacity; appliedSpeed = speed; refreshWheelSpeed(); diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/CreativeCrateBlock.java b/src/main/java/com/simibubi/create/modules/schematics/block/CreativeCrateBlock.java index b80c3307a..b8a328bfe 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/CreativeCrateBlock.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/CreativeCrateBlock.java @@ -5,6 +5,9 @@ import com.simibubi.create.foundation.utility.AllShapes; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.material.Material; +import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; @@ -21,6 +24,10 @@ public class CreativeCrateBlock extends Block { return false; } + @Override + public void fillItemGroup(ItemGroup group, NonNullList items) { + } + @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return AllShapes.CRATE_BLOCK_SHAPE; diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonScreen.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonScreen.java index 82904fb68..00f38641d 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonScreen.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonScreen.java @@ -67,7 +67,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen