diff --git a/README.md b/README.md index b56e05f04..bbec6e64f 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,23 @@ -# Create +

Logo

+

Create
+ Patreon + Supported Versions + License + Discord + Curseforge Downloads

+

+ Welcome to Create, a mod offering a variety of tools and blocks for Building, Decoration and Aesthetic Automation. The added elements of tech are designed to leave as many design choices to the player as possible, where item processing doesn't happen inside a single block with funny textures, it requires a set of actors working together in many possible arrangements. Check out the wiki and in-game Tool-tips for further info on how to use these features, and stay tuned for an ever-growing selection of possibilities for Creative and Survival Minecraft. -## Links -[](https://github.com/simibubi/Create/issues "Report Issues") -[](https://www.youtube.com/playlist?list=PLyADkcfPLU8ywCXZPaDbQ_JZJL0CGDN5Z "Watch Videos") -[](https://discord.gg/hmaD7Se "Feedback & Help") -[](https://www.patreon.com/simibubi "Support Us") +[](https://github.com/simibubi/Create/issues "Report Issues") +[](https://www.youtube.com/playlist?list=PLyADkcfPLU8ywCXZPaDbQ_JZJL0CGDN5Z "Watch Videos") +[](https://discord.gg/hmaD7Se "Feedback & Help") +[](https://www.patreon.com/simibubi "Support Us") -## Current Progress -- Create 0.2.2 is coming soon with more bug-fixes. Thank you for testing Create with us! - Support for Minecraft 1.12: Not planned - Support for Minecraft 1.15: Porting work is in Progress! - Support for Fabric: Not planned @@ -25,14 +30,4 @@ Check out the wiki and in-game Tool-tips for further info on how to use these fe - simibubi - Developer & Artist - tterrag - Developer & Port-Meister -## Localization - -| Code | Version | Language | Author | -|-------|---------|------------|--------------------------| -| en_us | 0.2.2 | English US | | -| de_de | 0.1 | German | Vexatos & Azratosh | -| nl_nl | 0.1 | Dutch | Prusias | -| fr_fr | 0.2.1 | French | Kiro | -| zh_cn | 0.2.1 | Chinese | noptia & spider_stranger | -| ru_ru | 0.1 | Russian | sirabein | -| pt_br | 0.1 | Brazilian | lucassabreu | +### For more information, check out our [Project Page](https://www.curseforge.com/minecraft/mc-mods/create) diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index d772890a8..056137c83 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -72,6 +72,7 @@ import com.simibubi.create.modules.logistics.block.diodes.ToggleLatchBlock; import com.simibubi.create.modules.logistics.block.extractor.ExtractorBlock; import com.simibubi.create.modules.logistics.block.extractor.LinkedExtractorBlock; import com.simibubi.create.modules.logistics.block.funnel.FunnelBlock; +import com.simibubi.create.modules.logistics.block.inventories.CreativeCrateBlock; import com.simibubi.create.modules.logistics.block.inventories.FlexcrateBlock; import com.simibubi.create.modules.logistics.block.transposer.LinkedTransposerBlock; import com.simibubi.create.modules.logistics.block.transposer.TransposerBlock; @@ -125,7 +126,7 @@ public enum AllBlocks implements NonNullSupplier { GEARBOX(GearboxBlock::new), CLUTCH(ClutchBlock::new), GEARSHIFT(GearshiftBlock::new), - + ENCASED_BELT(EncasedBeltBlock::new), ADJUSTABLE_PULLEY(AdjustablePulleyBlock::new), BELT(BeltBlock::new, ComesWith.NO_BLOCKITEM), @@ -180,11 +181,12 @@ public enum AllBlocks implements NonNullSupplier { ROTATION_SPEED_CONTROLLER(SpeedControllerBlock::new), _2_(Sections.LOGISTICS), - + CONTACT(ContactBlock::new), REDSTONE_BRIDGE(RedstoneLinkBlock::new), STOCKSWITCH(StockswitchBlock::new), FLEXCRATE(FlexcrateBlock::new), + CREATIVE_CRATE(() -> new CreativeCrateBlock(Properties.from(Blocks.CHEST))), EXTRACTOR(ExtractorBlock::new), VERTICAL_EXTRACTOR(ExtractorBlock.Vertical::new, ComesWith.NO_BLOCKITEM), LINKED_EXTRACTOR(LinkedExtractorBlock::new), @@ -202,9 +204,9 @@ public enum AllBlocks implements NonNullSupplier { FLEXPULSEPEATER(FlexpeaterBlock::new), REDSTONE_LATCH(LatchBlock::new), TOGGLE_LATCH(ToggleLatchBlock::new), - + _3_(Sections.MATERIALS), - + COPPER_ORE(() -> new OxidizingBlock(Properties.from(Blocks.IRON_ORE), 1), ITaggable.create().withForgeTags("ores/copper")), ZINC_ORE(() -> new Block(Properties.from(Blocks.GOLD_ORE).harvestLevel(2).harvestTool(ToolType.PICKAXE)), @@ -226,13 +228,13 @@ public enum AllBlocks implements NonNullSupplier { COCOA_LOG(CocoaLogBlock::new, ITaggable.create().withVanillaTags(ITaggable.BLOCK, "jungle_logs")), _5_(Sections.SCHEMATICS), - + // SCHEMATICANNON(SchematicannonBlock::new), // CREATIVE_CRATE(CreativeCrateBlock::new), // SCHEMATIC_TABLE(SchematicTableBlock::new), - + _6_(Sections.PALETTES), - + TILED_GLASS(() -> new GlassBlock(Properties.from(Blocks.GLASS)), ITaggable.create().withVanillaTags(ITaggable.BLOCK, "impermeable").withForgeTags("glass")), FRAMED_GLASS(() -> new CTGlassBlock(AllCTs.FRAMED_GLASS, false)), diff --git a/src/main/java/com/simibubi/create/AllEntities.java b/src/main/java/com/simibubi/create/AllEntities.java index 1fd227817..7a584786d 100644 --- a/src/main/java/com/simibubi/create/AllEntities.java +++ b/src/main/java/com/simibubi/create/AllEntities.java @@ -21,12 +21,10 @@ import net.minecraftforge.fml.client.registry.RenderingRegistry; public enum AllEntities { - CONTRAPTION(ContraptionEntity::new, EntityClassification.MISC, 30, 3, true, - ContraptionEntity::build), - STATIONARY_CONTRAPTION(ContraptionEntity::new, EntityClassification.MISC, 30, 40, - false, ContraptionEntity::build), - SUPER_GLUE(SuperGlueEntity::new, EntityClassification.MISC, 30, Integer.MAX_VALUE, false, SuperGlueEntity::build), - + CONTRAPTION(ContraptionEntity::new, EntityClassification.MISC, 5, 3, true, ContraptionEntity::build), + STATIONARY_CONTRAPTION(ContraptionEntity::new, EntityClassification.MISC, 20, 40, false, ContraptionEntity::build), + SUPER_GLUE(SuperGlueEntity::new, EntityClassification.MISC, 10, Integer.MAX_VALUE, false, SuperGlueEntity::build), + ; private IFactory factory; @@ -53,8 +51,10 @@ public enum AllEntities { for (AllEntities entity : values()) { String id = Lang.asId(entity.name()); ResourceLocation resourceLocation = new ResourceLocation(Create.ID, id); - Builder builder = EntityType.Builder.create(entity.factory, entity.group) - .setTrackingRange(entity.range).setUpdateInterval(entity.updateFrequency) + Builder builder = EntityType.Builder + .create(entity.factory, entity.group) + .setTrackingRange(entity.range) + .setUpdateInterval(entity.updateFrequency) .setShouldReceiveVelocityUpdates(entity.sendVelocity); if (entity.propertyBuilder != null) builder = entity.propertyBuilder.apply(builder); diff --git a/src/main/java/com/simibubi/create/AllItems.java b/src/main/java/com/simibubi/create/AllItems.java index ff97ef7ff..311716d36 100644 --- a/src/main/java/com/simibubi/create/AllItems.java +++ b/src/main/java/com/simibubi/create/AllItems.java @@ -27,6 +27,7 @@ import com.simibubi.create.modules.curiosities.TreeFertilizerItem; import com.simibubi.create.modules.curiosities.deforester.DeforesterItem; import com.simibubi.create.modules.curiosities.symmetry.SymmetryWandItem; import com.simibubi.create.modules.curiosities.tools.AllToolTiers; +import com.simibubi.create.modules.curiosities.tools.BlazingSwordItem; import com.simibubi.create.modules.curiosities.tools.BlazingToolItem; import com.simibubi.create.modules.curiosities.tools.RoseQuartzToolItem; import com.simibubi.create.modules.curiosities.tools.SandPaperItem; @@ -123,7 +124,7 @@ public enum AllItems { BLAZING_PICKAXE(p -> new BlazingToolItem(1, -2.8F, p, PICKAXE)), BLAZING_SHOVEL(p -> new BlazingToolItem(1.5F, -3.0F, p, SHOVEL)), BLAZING_AXE(p -> new BlazingToolItem(5.0F, -3.0F, p, AXE)), - BLAZING_SWORD(p -> new SwordItem(AllToolTiers.BLAZING, 3, -2.4F, p)), + BLAZING_SWORD(p -> new BlazingSwordItem(AllToolTiers.BLAZING, 3, -2.4F, p)), ROSE_QUARTZ_PICKAXE(p -> new RoseQuartzToolItem(1, -2.8F, p, PICKAXE)), ROSE_QUARTZ_SHOVEL(p -> new RoseQuartzToolItem(1.5F, -3.0F, p, SHOVEL)), diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index a280c36e8..d05be667b 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -83,6 +83,7 @@ import com.simibubi.create.modules.logistics.block.diodes.FlexpeaterTileEntityRe import com.simibubi.create.modules.logistics.block.extractor.ExtractorTileEntity; import com.simibubi.create.modules.logistics.block.extractor.LinkedExtractorTileEntity; import com.simibubi.create.modules.logistics.block.funnel.FunnelTileEntity; +import com.simibubi.create.modules.logistics.block.inventories.CreativeCrateTileEntity; import com.simibubi.create.modules.logistics.block.inventories.FlexcrateTileEntity; import com.simibubi.create.modules.logistics.block.transposer.LinkedTransposerTileEntity; import com.simibubi.create.modules.logistics.block.transposer.TransposerTileEntity; @@ -155,6 +156,7 @@ public enum AllTileEntities { REDSTONE_BRIDGE(RedstoneLinkTileEntity::new, AllBlocks.REDSTONE_BRIDGE), STOCKSWITCH(StockswitchTileEntity::new, AllBlocks.STOCKSWITCH), FLEXCRATE(FlexcrateTileEntity::new, AllBlocks.FLEXCRATE), + CREATIVE_CRATE(CreativeCrateTileEntity::new, AllBlocks.CREATIVE_CRATE), EXTRACTOR(ExtractorTileEntity::new, AllBlocks.EXTRACTOR, AllBlocks.VERTICAL_EXTRACTOR), LINKED_EXTRACTOR(LinkedExtractorTileEntity::new, AllBlocks.LINKED_EXTRACTOR, AllBlocks.VERTICAL_LINKED_EXTRACTOR), TRANSPOSER(TransposerTileEntity::new, AllBlocks.TRANSPOSER, AllBlocks.VERTICAL_TRANSPOSER), @@ -238,6 +240,7 @@ public enum AllTileEntities { bind(FURNACE_ENGINE, EngineRenderer::new); bind(ROTATION_SPEED_CONTROLLER, SpeedControllerRenderer::new); + bind(CREATIVE_CRATE, SmartTileEntityRenderer::new); bind(REDSTONE_BRIDGE, SmartTileEntityRenderer::new); bind(EXTRACTOR, SmartTileEntityRenderer::new); bind(LINKED_EXTRACTOR, SmartTileEntityRenderer::new); @@ -247,9 +250,6 @@ public enum AllTileEntities { bind(BELT_TUNNEL, BeltTunnelTileEntityRenderer::new); bind(ENTITY_DETECTOR, BeltObserverTileEntityRenderer::new); bind(FLEXPEATER, FlexpeaterTileEntityRenderer::new); - -// bind(LogisticalController, LogisticalControllerTileEntityRenderer::new); -// bind(LogisticiansTable, LogisticiansTableTileEntityRenderer::new); } @SuppressWarnings("unchecked") // TODO 1.15 this generic stuff is incompatible with the enum system - need strong types diff --git a/src/main/java/com/simibubi/create/ScreenResources.java b/src/main/java/com/simibubi/create/ScreenResources.java index 19f7f780a..98a4e1a6f 100644 --- a/src/main/java/com/simibubi/create/ScreenResources.java +++ b/src/main/java/com/simibubi/create/ScreenResources.java @@ -26,6 +26,7 @@ public enum ScreenResources { SCHEMATICANNON_PROGRESS_2("schematicannon.png", 122, 161, 16, 15), SCHEMATICANNON_HIGHLIGHT("schematicannon.png", 0, 182, 28, 28), SCHEMATICANNON_FUEL("schematicannon.png", 0, 215, 82, 4), + SCHEMATICANNON_FUEL_CREATIVE("schematicannon.png", 0, 219, 82, 4), FLEXCRATE("flex_crate_and_stockpile_switch.png", 125, 129), FLEXCRATE_DOUBLE("double_flexcrate.png", 197, 129), diff --git a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java index ff99bd785..118c775ed 100644 --- a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java +++ b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java @@ -24,7 +24,6 @@ import com.simibubi.create.compat.jei.category.SawingCategory; import com.simibubi.create.compat.jei.category.SmokingViaFanCategory; import com.simibubi.create.compat.jei.category.SplashingCategory; import com.simibubi.create.foundation.utility.Lang; -import com.simibubi.create.modules.contraptions.components.crafter.MechanicalCraftingRecipe; import com.simibubi.create.modules.contraptions.components.mixer.MixingRecipe; import com.simibubi.create.modules.contraptions.components.press.MechanicalPressTileEntity; import com.simibubi.create.modules.logistics.block.inventories.FlexcrateScreen; @@ -66,8 +65,7 @@ public class CreateJEI implements IModPlugin { private PackingCategory packingCategory; private PolishingCategory polishingCategory; private MysteriousItemConversionCategory mysteryConversionCategory; - private MechanicalCraftingCategory smallMechanicalCraftingCategory; - private MechanicalCraftingCategory largeMechanicalCraftingCategory; + private MechanicalCraftingCategory mechanicalCraftingCategory; @Override public ResourceLocation getPluginUid() { @@ -88,8 +86,7 @@ public class CreateJEI implements IModPlugin { packingCategory = new PackingCategory(); polishingCategory = new PolishingCategory(); mysteryConversionCategory = new MysteriousItemConversionCategory(); - smallMechanicalCraftingCategory = new MechanicalCraftingCategory(false); - largeMechanicalCraftingCategory = new MechanicalCraftingCategory(true); + mechanicalCraftingCategory = new MechanicalCraftingCategory(); } @Override @@ -99,10 +96,11 @@ public class CreateJEI implements IModPlugin { @Override public void registerCategories(IRecipeCategoryRegistration registration) { - registration.addRecipeCategories(millingCategory, crushingCategory, splashingCategory, pressingCategory, - smokingCategory, blastingCategory, blockzapperCategory, mixingCategory, sawingCategory, - blockCuttingCategory, packingCategory, polishingCategory, mysteryConversionCategory, - smallMechanicalCraftingCategory, largeMechanicalCraftingCategory); + registration + .addRecipeCategories(millingCategory, crushingCategory, splashingCategory, pressingCategory, + smokingCategory, blastingCategory, blockzapperCategory, mixingCategory, sawingCategory, + blockCuttingCategory, packingCategory, polishingCategory, mysteryConversionCategory, + mechanicalCraftingCategory); } @Override @@ -132,33 +130,28 @@ public class CreateJEI implements IModPlugin { packingCategory.getUid()); registration.addRecipes(findRecipes(AllRecipes.SANDPAPER_POLISHING), polishingCategory.getUid()); registration.addRecipes(MysteriousItemConversionCategory.getRecipes(), mysteryConversionCategory.getUid()); - - registration.addRecipes(findRecipes( - r -> (r instanceof MechanicalCraftingRecipe) && MechanicalCraftingCategory.isSmall((ShapedRecipe) r)), - smallMechanicalCraftingCategory.getUid()); - registration.addRecipes( - findRecipes( - r -> (r.getType() == IRecipeType.CRAFTING || r.getType() == AllRecipes.MECHANICAL_CRAFTING.type) - && (r instanceof ShapedRecipe) && !(r instanceof MechanicalCraftingRecipe) - && MechanicalCraftingCategory.isSmall((ShapedRecipe) r)), - smallMechanicalCraftingCategory.getUid()); - registration.addRecipes(findRecipes( - r -> (r.getType() == IRecipeType.CRAFTING || r.getType() == AllRecipes.MECHANICAL_CRAFTING.type) - && (r instanceof ShapedRecipe) && !MechanicalCraftingCategory.isSmall((ShapedRecipe) r)), - largeMechanicalCraftingCategory.getUid()); - + registration.addRecipes(findRecipes(r -> (r.getType() == AllRecipes.MECHANICAL_CRAFTING.type)), + mechanicalCraftingCategory.getUid()); + registration.addRecipes(findRecipes(r -> (r.getType() == IRecipeType.CRAFTING + && r.getType() != AllRecipes.MECHANICAL_CRAFTING.type) && (r instanceof ShapedRecipe)), + mechanicalCraftingCategory.getUid()); } @Override public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) { ItemStack fan = new ItemStack(AllBlocks.ENCASED_FAN.get()); - ItemStack splashingFan = fan.copy() + ItemStack splashingFan = fan + .copy() .setDisplayName(new StringTextComponent(TextFormatting.RESET + Lang.translate("recipe.splashing.fan"))); - ItemStack smokingFan = fan.copy().setDisplayName( - new StringTextComponent(TextFormatting.RESET + Lang.translate("recipe.smokingViaFan.fan"))); - ItemStack blastingFan = fan.copy().setDisplayName( - new StringTextComponent(TextFormatting.RESET + Lang.translate("recipe.blastingViaFan.fan"))); + ItemStack smokingFan = fan + .copy() + .setDisplayName( + new StringTextComponent(TextFormatting.RESET + Lang.translate("recipe.smokingViaFan.fan"))); + ItemStack blastingFan = fan + .copy() + .setDisplayName( + 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()); @@ -176,10 +169,9 @@ public class CreateJEI implements IModPlugin { registration.addRecipeCatalyst(new ItemStack(AllBlocks.BASIN.get()), packingCategory.getUid()); registration.addRecipeCatalyst(AllItems.SAND_PAPER.asStack(), polishingCategory.getUid()); registration.addRecipeCatalyst(AllItems.RED_SAND_PAPER.asStack(), polishingCategory.getUid()); - registration.addRecipeCatalyst(new ItemStack(AllBlocks.MECHANICAL_CRAFTER.get()), - smallMechanicalCraftingCategory.getUid()); - registration.addRecipeCatalyst(new ItemStack(AllBlocks.MECHANICAL_CRAFTER.get()), - largeMechanicalCraftingCategory.getUid()); + registration + .addRecipeCatalyst(new ItemStack(AllBlocks.MECHANICAL_CRAFTER.get()), + mechanicalCraftingCategory.getUid()); } @Override @@ -193,18 +185,30 @@ public class CreateJEI implements IModPlugin { } private static List> findRecipes(Predicate> pred) { - return Minecraft.getInstance().world.getRecipeManager().getRecipes().stream().filter(pred) + return Minecraft.getInstance().world + .getRecipeManager() + .getRecipes() + .stream() + .filter(pred) .collect(Collectors.toList()); } private static List> findRecipesByType(IRecipeType type) { - return Minecraft.getInstance().world.getRecipeManager().getRecipes().stream().filter(r -> r.getType() == type) + return Minecraft.getInstance().world + .getRecipeManager() + .getRecipes() + .stream() + .filter(r -> r.getType() == type) .collect(Collectors.toList()); } private static List> findRecipesById(ResourceLocation id) { - return Minecraft.getInstance().world.getRecipeManager().getRecipes().stream() - .filter(r -> r.getSerializer().getRegistryName().equals(id)).collect(Collectors.toList()); + return Minecraft.getInstance().world + .getRecipeManager() + .getRecipes() + .stream() + .filter(r -> r.getSerializer().getRegistryName().equals(id)) + .collect(Collectors.toList()); } private static List> findRecipesByTypeExcluding(IRecipeType type, IRecipeType excludingType) { diff --git a/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java index 9d6406833..7cc21a0ea 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java @@ -1,39 +1,103 @@ package com.simibubi.create.compat.jei.category; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import com.mojang.blaze3d.platform.GlStateManager; import com.simibubi.create.AllBlocks; import com.simibubi.create.ScreenResources; import com.simibubi.create.compat.jei.category.animations.AnimatedCrafter; -import com.simibubi.create.foundation.utility.Lang; import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; +import mezz.jei.api.ingredients.IIngredientRenderer; import mezz.jei.api.ingredients.IIngredients; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Rarity; import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.ShapedRecipe; import net.minecraft.util.NonNullList; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; public class MechanicalCraftingCategory extends CreateRecipeCategory { - private AnimatedCrafter crafter; - private boolean large; + private final class CrafterIngredientRenderer implements IIngredientRenderer { - public MechanicalCraftingCategory(boolean large) { - super("mechanical_crafting" + (large ? "_large" : ""), itemIcon(AllBlocks.MECHANICAL_CRAFTER.get()), - emptyBackground(large ? 177 : 177, large ? 235 : 81)); - this.large = large; - crafter = new AnimatedCrafter(large); + private ShapedRecipe recipe; + + public CrafterIngredientRenderer(ShapedRecipe recipe) { + this.recipe = recipe; + } + + @Override + public void render(int xPosition, int yPosition, ItemStack ingredient) { + GlStateManager.pushMatrix(); + GlStateManager.translated(xPosition, yPosition, 0); + float scale = getScale(recipe); + GlStateManager.scaled(scale, scale, scale); + + if (ingredient != null) { + GlStateManager.enableDepthTest(); + RenderHelper.enableGUIStandardItemLighting(); + Minecraft minecraft = Minecraft.getInstance(); + FontRenderer font = getFontRenderer(minecraft, ingredient); + ItemRenderer itemRenderer = minecraft.getItemRenderer(); + itemRenderer.renderItemAndEffectIntoGUI(null, ingredient, 0, 0); + itemRenderer.renderItemOverlayIntoGUI(font, ingredient, 0, 0, null); + GlStateManager.disableBlend(); + RenderHelper.disableStandardItemLighting(); + } + GlStateManager.popMatrix(); + } + + @Override + public List getTooltip(ItemStack ingredient, ITooltipFlag tooltipFlag) { + Minecraft minecraft = Minecraft.getInstance(); + PlayerEntity player = minecraft.player; + List list; + try { + list = ingredient + .getTooltip(player, tooltipFlag) + .stream() + .map(ITextComponent::getFormattedText) + .collect(Collectors.toList()); + } catch (RuntimeException | LinkageError e) { + return new ArrayList<>(); + } + + Rarity rarity; + try { + rarity = ingredient.getRarity(); + } catch (RuntimeException | LinkageError e) { + rarity = Rarity.COMMON; + } + + for (int k = 0; k < list.size(); ++k) { + if (k == 0) { + list.set(k, rarity.color + list.get(k)); + } else { + list.set(k, TextFormatting.GRAY + list.get(k)); + } + } + + return list; + } } - public static boolean isSmall(ShapedRecipe recipe) { - return Math.max((recipe).getWidth(), (recipe).getHeight()) <= 4; - } + private AnimatedCrafter crafter = new AnimatedCrafter(); - @Override - public String getTitle() { - return Lang.translate("recipe.mechanical_crafting"); + public MechanicalCraftingCategory() { + super("mechanical_crafting", itemIcon(AllBlocks.MECHANICAL_CRAFTER.get()), emptyBackground(177, 107)); } @Override @@ -47,45 +111,79 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory recipeIngredients = recipe.getIngredients(); - itemStacks.init(0, false, large ? 136 : 141, large ? 196 : 50); + itemStacks.init(0, false, 133, 80); itemStacks.set(0, recipe.getRecipeOutput().getStack()); - int x = getGridX(recipe); - int y = getGridY(recipe); + int x = getXPadding(recipe); + int y = getYPadding(recipe); + float scale = getScale(recipe); int size = recipeIngredients.size(); + IIngredientRenderer renderer = new CrafterIngredientRenderer(recipe); + for (int i = 0; i < size; i++) { - itemStacks.init(i + 1, true, x + (i % recipe.getWidth()) * 19, y + (i / recipe.getWidth()) * 19); + float f = 19 * scale; + int slotSize = (int) (16 * scale); + int xPosition = (int) (x + 1 + (i % recipe.getWidth()) * f); + int yPosition = (int) (y + 1 + (i / recipe.getWidth()) * f); + itemStacks.init(i + 1, true, renderer, xPosition, yPosition, slotSize, slotSize, 0, 0); itemStacks.set(i + 1, Arrays.asList(recipeIngredients.get(i).getMatchingStacks())); } } - public int getGridY(ShapedRecipe recipe) { - return 3 + (int) (((large ? 9 : 4) - recipe.getRecipeHeight()) * 19 / 2f); + static int maxSize = 100; + + public static float getScale(ShapedRecipe recipe) { + int w = recipe.getWidth(); + int h = recipe.getHeight(); + return Math.min(1, maxSize / (19f * Math.max(w, h))); } - public int getGridX(ShapedRecipe recipe) { - return 3 + (int) (((large ? 9 : 4) - recipe.getRecipeWidth()) * 19 / 2f); + public static int getYPadding(ShapedRecipe recipe) { + return 3 + 50 - (int) (getScale(recipe) * recipe.getHeight() * 19 * .5); + } + + public static int getXPadding(ShapedRecipe recipe) { + return 3 + 50 - (int) (getScale(recipe) * recipe.getWidth() * 19 * .5); } @Override public void draw(ShapedRecipe recipe, double mouseX, double mouseY) { - int x = getGridX(recipe); - int y = getGridY(recipe); + GlStateManager.pushMatrix(); + float scale = getScale(recipe); + GlStateManager.translated(getXPadding(recipe), getYPadding(recipe), 0); for (int row = 0; row < recipe.getHeight(); row++) for (int col = 0; col < recipe.getWidth(); col++) - if (!recipe.getIngredients().get(row * recipe.getWidth() + col).hasNoMatchingItems()) - ScreenResources.JEI_SLOT.draw(x + col * 19, y + row * 19); + if (!recipe.getIngredients().get(row * recipe.getWidth() + col).hasNoMatchingItems()) { + GlStateManager.pushMatrix(); + GlStateManager.translated((int) col * 19 * scale, (int) row * 19 * scale, 0); + GlStateManager.scaled(scale, scale, scale); + ScreenResources.JEI_SLOT.draw(0, 0); + GlStateManager.popMatrix(); + } - ScreenResources.JEI_SLOT.draw(large ? 136 : 141, large ? 196 : 50); - if (large) - ScreenResources.JEI_ARROW.draw(86, 200); - else - ScreenResources.JEI_DOWN_ARROW.draw(136, 32); + GlStateManager.popMatrix(); - ScreenResources.JEI_SHADOW.draw(large ? 20 : 84, large ? 223 : 68); - crafter.draw(large ? 105 : 185, large ? 189 : -1); + ScreenResources.JEI_SLOT.draw(133, 80); + ScreenResources.JEI_DOWN_ARROW.draw(128, 59); + ScreenResources.JEI_SHADOW.draw(116, 36); + crafter.draw(219, 8); + + GlStateManager.pushMatrix(); + GlStateManager.translated(0, 0, 200); + + RenderHelper.disableStandardItemLighting(); + int amount = 0; + for (Ingredient ingredient : recipe.getIngredients()) { + if (Ingredient.EMPTY == ingredient) + continue; + amount++; + } + Minecraft.getInstance().fontRenderer + .drawStringWithShadow(amount + "", 142, 39, 0xFFFFFF); + RenderHelper.enableStandardItemLighting(); + GlStateManager.popMatrix(); } @Override diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrafter.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrafter.java index 4e5250e06..2a0b5da6c 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrafter.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrafter.java @@ -12,12 +12,6 @@ import net.minecraft.util.Direction; public class AnimatedCrafter extends AnimatedKinetics { - boolean four; - - public AnimatedCrafter(boolean four) { - this.four = four; - } - @Override public int getWidth() { return 50; @@ -40,23 +34,6 @@ public class AnimatedCrafter extends AnimatedKinetics { ScreenElementRenderer.renderModel(() -> cogwheel(true)); ScreenElementRenderer.renderBlock(this::body); - RenderSystem.translatef(0, 50, 0); - ScreenElementRenderer.renderModel(() -> cogwheel(false)); - ScreenElementRenderer.renderBlock(this::body); - - if (four) { - RenderSystem.translatef(50, -50, 0); - ScreenElementRenderer.renderModel(() -> cogwheel(false)); - ScreenElementRenderer.renderBlock(this::body); - RenderSystem.translatef(0, 50, 0); - ScreenElementRenderer.renderModel(() -> cogwheel(true)); - ScreenElementRenderer.renderBlock(this::body); - - } else { - RenderSystem.translatef(0, 50, 0); - ScreenElementRenderer.renderModel(() -> cogwheel(true)); - ScreenElementRenderer.renderBlock(this::body); - } RenderSystem.popMatrix(); } @@ -71,8 +48,10 @@ public class AnimatedCrafter extends AnimatedKinetics { } private BlockState body() { - return AllBlocks.MECHANICAL_CRAFTER.get().getDefaultState().with(MechanicalCrafterBlock.HORIZONTAL_FACING, - Direction.WEST); + return AllBlocks.MECHANICAL_CRAFTER + .get() + .getDefaultState() + .with(MechanicalCrafterBlock.HORIZONTAL_FACING, Direction.WEST); } } diff --git a/src/main/java/com/simibubi/create/data/CreateAdvancements.java b/src/main/java/com/simibubi/create/data/CreateAdvancements.java new file mode 100644 index 000000000..41efa9741 --- /dev/null +++ b/src/main/java/com/simibubi/create/data/CreateAdvancements.java @@ -0,0 +1,359 @@ +package com.simibubi.create.data; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.Set; +import java.util.function.Consumer; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import com.google.common.collect.Sets; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllItems; +import com.simibubi.create.Create; +import com.simibubi.create.foundation.advancement.AllTriggers; +import com.simibubi.create.foundation.advancement.KineticBlockTrigger; +import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem; +import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.ComponentTier; +import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.Components; + +import net.minecraft.advancements.Advancement; +import net.minecraft.advancements.Advancement.Builder; +import net.minecraft.advancements.FrameType; +import net.minecraft.advancements.criterion.InventoryChangeTrigger; +import net.minecraft.advancements.criterion.PlacedBlockTrigger; +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.DirectoryCache; +import net.minecraft.data.IDataProvider; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.util.IItemProvider; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.TranslationTextComponent; + +@SuppressWarnings("unused") // dont warn about unused avancements +public class CreateAdvancements implements IDataProvider { + + static final String LANG = "advancement." + Create.ID + "."; + + public void register(Consumer t) { + String id = Create.ID; + + Advancement root = Advancement.Builder + .builder() + .withDisplay(AllItems.BRASS_HAND.asStack(), new TranslationTextComponent(LANG + "root"), + new TranslationTextComponent(LANG + "root.desc"), + new ResourceLocation(Create.ID, "textures/block/scoria_bricks.png"), FrameType.TASK, false, + false, false) + .withCriterion("0", InventoryChangeTrigger.Instance.forItems(new IItemProvider[] {})) + .register(t, id + ":root"); + + Advancement andesite_alloy = advancement("andesite_alloy", AllItems.ANDESITE_ALLOY.get(), TaskType.NORMAL) + .withParent(root) + .withCriterion("0", itemGathered(AllItems.ANDESITE_ALLOY.get())) + .register(t, id + ":andesite_alloy"); + + kineticsBranch(t, andesite_alloy); + + Advancement water_wheel = advancement("water_wheel", AllBlocks.WATER_WHEEL.get(), TaskType.NORMAL) + .withParent(andesite_alloy) + .withCriterion("0", placeBlock(AllBlocks.WATER_WHEEL.get())) + .withCriterion("1", AllTriggers.WATER_WHEEL.instance()) + .register(t, id + ":water_wheel"); + + Advancement lava_wheel = advancement("lava_wheel", Items.LAVA_BUCKET, TaskType.SECRET) + .withParent(water_wheel) + .withCriterion("0", AllTriggers.LAVA_WHEEL.instance()) + .register(t, id + ":lava_wheel"); + + Advancement millstone = kinecticAdvancement("millstone", AllBlocks.MILLSTONE, TaskType.NORMAL) + .withParent(andesite_alloy) + .register(t, id + ":millstone"); + + Advancement andesite_casing = advancement("andesite_casing", AllBlocks.ANDESITE_CASING.get(), TaskType.GOAL) + .withParent(andesite_alloy) + .withCriterion("0", itemGathered(AllBlocks.ANDESITE_CASING.get())) + .register(t, id + ":andesite_casing"); + + andesiteExpertLane(t, andesite_casing); + + Advancement drill = kinecticAdvancement("drill", AllBlocks.DRILL, TaskType.NORMAL) + .withParent(andesite_casing) + .register(t, id + ":drill"); + + Advancement press = advancement("press", AllBlocks.MECHANICAL_PRESS.get(), TaskType.MILESTONE) + .withParent(andesite_casing) + .withCriterion("0", AllTriggers.BONK.instance()) + .register(t, id + ":press"); + + Advancement rose_quartz = + itemAdvancement("polished_rose_quartz", AllItems.POLISHED_ROSE_QUARTZ, TaskType.NORMAL) + .withParent(andesite_casing) + .register(t, id + ":polished_rose_quartz"); + + Advancement electron_tube = itemAdvancement("electron_tube", AllItems.ELECTRON_TUBE, TaskType.NORMAL) + .withParent(rose_quartz) + .register(t, id + ":electron_tube"); + + Advancement saw = + kinecticAdvancement("saw", AllBlocks.SAW, TaskType.NORMAL).withParent(press).register(t, id + ":saw"); + + Advancement basin = advancement("basin", AllBlocks.BASIN.get(), TaskType.NORMAL) + .withParent(press) + .withCriterion("0", placeBlock(AllBlocks.BASIN.get())) + .withCriterion("1", AllTriggers.BASIN_THROW.instance()) + .register(t, id + ":basin"); + + Advancement mixer = advancement("mixer", AllBlocks.MECHANICAL_MIXER.get(), TaskType.MILESTONE) + .withCriterion("0", placeBlock(AllBlocks.MECHANICAL_MIXER.get())) + .withCriterion("1", isPowered(AllBlocks.MECHANICAL_MIXER.get())) + .withCriterion("2", AllTriggers.MIXER_MIX.instance()) + .withParent(basin) + .register(t, id + ":mixer"); + + Advancement compact = advancement("compact", Blocks.IRON_BLOCK, TaskType.NORMAL) + .withCriterion("0", AllTriggers.PRESS_COMPACT.instance()) + .withParent(basin) + .register(t, id + ":compact"); + + Advancement brass = itemAdvancement("brass", AllItems.BRASS_INGOT, TaskType.NORMAL) + .withParent(mixer) + .register(t, id + ":brass"); + + brassAge(t, brass); + copperAge(t, press); + } + + void kineticsBranch(Consumer t, Advancement root) { + String id = Create.ID; + + Advancement its_alive = advancement("its_alive", AllBlocks.COGWHEEL.get(), TaskType.NORMAL) + .withParent(root) + .withCriterion("0", AllTriggers.ROTATION.instance()) + .register(t, id + ":its_alive"); + + Advancement belt = advancement("belt", AllItems.BELT_CONNECTOR.get(), TaskType.NORMAL) + .withParent(its_alive) + .withCriterion("0", AllTriggers.CONNECT_BELT.instance()) + .register(t, id + ":belt"); + + Advancement wrench = itemAdvancement("wrench", AllItems.WRENCH, TaskType.NORMAL) + .withParent(its_alive) + .register(t, id + ":wrench"); + + Advancement goggles = itemAdvancement("goggles", AllItems.GOGGLES, TaskType.NORMAL) + .withParent(its_alive) + .register(t, id + ":goggles"); + + Advancement speed_gauge = kinecticAdvancement("speed_gauge", AllBlocks.SPEED_GAUGE, TaskType.NORMAL) + .withParent(goggles) + .register(t, id + ":speed_gauge"); + + Advancement stress_gauge = kinecticAdvancement("stress_gauge", AllBlocks.STRESS_GAUGE, TaskType.NORMAL) + .withParent(goggles) + .register(t, id + ":stress_gauge"); + + Advancement shifting_gears = advancement("shifting_gears", AllBlocks.LARGE_COGWHEEL.get(), TaskType.NORMAL) + .withParent(its_alive) + .withCriterion("0", AllTriggers.SHIFTING_GEARS.instance()) + .register(t, id + ":shifting_gears"); + + Advancement overstressed = advancement("overstressed", Items.BARRIER, TaskType.SECRET) + .withParent(its_alive) + .withCriterion("0", AllTriggers.OVERSTRESSED.instance()) + .register(t, id + ":overstressed"); + + } + + void copperAge(Consumer t, Advancement root) { + String id = Create.ID; + + Advancement copper_casing = advancement("copper_casing", AllBlocks.COPPER_CASING.get(), TaskType.GOAL) + .withParent(root) + .withCriterion("0", itemGathered(AllBlocks.COPPER_CASING.get())) + .register(t, id + ":copper_casing"); + + Advancement copper_end = deadEnd() + .withParent(copper_casing) + .withCriterion("0", itemGathered(AllBlocks.COPPER_CASING.get())) + .register(t, id + ":copper_end"); + } + + void brassAge(Consumer t, Advancement root) { + String id = Create.ID; + + Advancement brass_casing = advancement("brass_casing", AllBlocks.BRASS_CASING.get(), TaskType.GOAL) + .withParent(root) + .withCriterion("0", itemGathered(AllBlocks.BRASS_CASING.get())) + .register(t, id + ":brass_casing"); + + Advancement crafter = kinecticAdvancement("crafter", AllBlocks.MECHANICAL_CRAFTER, TaskType.MILESTONE) + .withParent(brass_casing) + .register(t, id + ":crafter"); + + Advancement deployer = kinecticAdvancement("deployer", AllBlocks.DEPLOYER, TaskType.GOAL) + .withParent(brass_casing) + .register(t, id + ":deployer"); + + Advancement fist_bump = advancement("fist_bump", AllBlocks.DEPLOYER.get(), TaskType.SECRET) + .withParent(deployer) + .withCriterion("0", AllTriggers.DEPLOYER_BOOP.instance()) + .register(t, id + ":fist_bump"); + + Advancement crushing_wheel = advancement("crushing_wheel", AllBlocks.CRUSHING_WHEEL.get(), TaskType.MILESTONE) + .withParent(crafter) + .withCriterion("0", itemGathered(AllBlocks.CRUSHING_WHEEL.get())) + .register(t, id + ":crushing_wheel"); + + Advancement chromatic_compound = + itemAdvancement("chromatic_compound", AllItems.CHROMATIC_COMPOUND, TaskType.NORMAL) + .withParent(crushing_wheel) + .register(t, id + ":chromatic_compound"); + + Advancement shadow_steel = itemAdvancement("shadow_steel", AllItems.SHADOW_STEEL, TaskType.GOAL) + .withParent(chromatic_compound) + .register(t, id + ":shadow_steel"); + + Advancement refined_radiance = itemAdvancement("refined_radiance", AllItems.REFINED_RADIANCE, TaskType.GOAL) + .withParent(chromatic_compound) + .register(t, id + ":refined_radiance"); + + Advancement deforester = itemAdvancement("deforester", AllItems.DEFORESTER, TaskType.NORMAL) + .withParent(refined_radiance) + .register(t, id + ":deforester"); + + Advancement zapper = itemAdvancement("zapper", AllItems.PLACEMENT_HANDGUN, TaskType.NORMAL) + .withParent(refined_radiance) + .register(t, id + ":zapper"); + + ItemStack gunWithPurpurStuff = AllItems.PLACEMENT_HANDGUN.asStack(); + for (Components c : Components.values()) + BlockzapperItem.setTier(c, ComponentTier.Chromatic, gunWithPurpurStuff); + Advancement upgraded_zapper = advancement("upgraded_zapper", gunWithPurpurStuff, TaskType.CHALLENGE) + .withCriterion("0", AllTriggers.UPGRADED_ZAPPER.instance()) + .withParent(zapper) + .register(t, id + ":upgraded_zapper"); + + Advancement symmetry_wand = itemAdvancement("symmetry_wand", AllItems.SYMMETRY_WAND, TaskType.NORMAL) + .withParent(refined_radiance) + .register(t, id + ":symmetry_wand"); + + Advancement shadow_end = deadEnd() + .withParent(shadow_steel) + .withCriterion("0", itemGathered(AllItems.SHADOW_STEEL.get())) + .register(t, id + ":shadow_end"); + } + + private void andesiteExpertLane(Consumer t, Advancement root) { + String id = Create.ID; + } + + // Datagen + + private static final Logger LOGGER = LogManager.getLogger(); + private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().create(); + private final DataGenerator generator; + + public CreateAdvancements(DataGenerator generatorIn) { + this.generator = generatorIn; + } + + @Override + public void act(DirectoryCache cache) throws IOException { + Path path = this.generator.getOutputFolder(); + Set set = Sets.newHashSet(); + Consumer consumer = (p_204017_3_) -> { + if (!set.add(p_204017_3_.getId())) + throw new IllegalStateException("Duplicate advancement " + p_204017_3_.getId()); + + Path path1 = getPath(path, p_204017_3_); + + try { + IDataProvider.save(GSON, cache, p_204017_3_.copy().serialize(), path1); + } catch (IOException ioexception) { + LOGGER.error("Couldn't save advancement {}", path1, ioexception); + } + }; + + register(consumer); + } + + private static Path getPath(Path pathIn, Advancement advancementIn) { + return pathIn + .resolve("data/" + advancementIn.getId().getNamespace() + "/advancements/" + + advancementIn.getId().getPath() + ".json"); + } + + @Override + public String getName() { + return "CreateAdvancements"; + } + + public PlacedBlockTrigger.Instance placeBlock(Block block) { + return PlacedBlockTrigger.Instance.placedBlock(block); + } + + public KineticBlockTrigger.Instance isPowered(Block block) { + return AllTriggers.KINETIC_BLOCK.forBlock(block); + } + + public InventoryChangeTrigger.Instance itemGathered(IItemProvider itemprovider) { + return InventoryChangeTrigger.Instance.forItems(itemprovider); + } + + static enum TaskType { + + NORMAL(FrameType.TASK, true, false, false), + MILESTONE(FrameType.TASK, true, true, false), + GOAL(FrameType.GOAL, true, true, false), + SECRET(FrameType.GOAL, true, true, true), + SILENT_GATE(FrameType.CHALLENGE, false, false, false), + CHALLENGE(FrameType.CHALLENGE, true, true, false), + + ; + + private FrameType frame; + private boolean toast; + private boolean announce; + private boolean hide; + + private TaskType(FrameType frame, boolean toast, boolean announce, boolean hide) { + this.frame = frame; + this.toast = toast; + this.announce = announce; + this.hide = hide; + } + } + + public Builder kinecticAdvancement(String name, AllBlocks block, TaskType type) { + return advancement(name, block.get(), type) + .withCriterion("0", placeBlock(block.get())) + .withCriterion("1", isPowered(block.get())); + } + + public Builder advancement(String name, IItemProvider icon, TaskType type) { + return advancement(name, new ItemStack(icon), type); + } + + public Builder deadEnd() { + return advancement("eob", Items.OAK_SAPLING, TaskType.SILENT_GATE); + } + + public Builder advancement(String name, ItemStack icon, TaskType type) { + return Advancement.Builder + .builder() + .withDisplay(icon, new TranslationTextComponent(LANG + name), + new TranslationTextComponent(LANG + name + ".desc"), null, type.frame, type.toast, + type.announce, type.hide); + } + + public Builder itemAdvancement(String name, AllItems item, TaskType type) { + return advancement(name, item.get(), type).withCriterion("0", itemGathered(item.get())); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/advancement/AllTriggers.java b/src/main/java/com/simibubi/create/foundation/advancement/AllTriggers.java index cb8ae3705..e264f7509 100644 --- a/src/main/java/com/simibubi/create/foundation/advancement/AllTriggers.java +++ b/src/main/java/com/simibubi/create/foundation/advancement/AllTriggers.java @@ -15,17 +15,28 @@ public class AllTriggers { private static List> triggers = new LinkedList<>(); - public static SandpaperUseTrigger SANDPAPER_USE = add(new SandpaperUseTrigger("sandpaper_use")); - public static SimpleTrigger DEPLOYER_BOOP = simple("deployer"); - public static SimpleTrigger ABSORBED_LIGHT = simple("light_absorbed"); - public static SimpleTrigger SPEED_READ = simple("speed_read"); - public static SimpleTrigger OVERSTRESSED = simple("overstressed"); - public static SimpleTrigger ROTATION = simple("rotation"); + public static KineticBlockTrigger KINETIC_BLOCK = add(new KineticBlockTrigger("kinetic_block")); + + public static SimpleTrigger + ROTATION = simple("rotation"), + OVERSTRESSED = simple("overstressed"), + SHIFTING_GEARS = simple("shifting_gears"), + CONNECT_BELT = simple("connect_belt"), + BONK = simple("bonk"), + WATER_WHEEL = simple("water_wheel"), + LAVA_WHEEL = simple("lava_wheel"), + DEPLOYER_BOOP = simple("deployer"), + ABSORBED_LIGHT = simple("light_absorbed"), + SPEED_READ = simple("speed_read"), + BASIN_THROW = simple("basin"), + PRESS_COMPACT = simple("compact"), + UPGRADED_ZAPPER = simple("upgraded_zapper"), + MIXER_MIX = simple("mixer"); private static SimpleTrigger simple(String id) { return add(new SimpleTrigger(id)); } - + private static > T add(T instance) { triggers.add(instance); return instance; @@ -35,19 +46,29 @@ public class AllTriggers { triggers.forEach(CriteriaTriggers::register); } - public static void triggerForNearbyPlayers(SimpleTrigger trigger, World world, BlockPos pos, int range) { + public static void triggerFor(ITriggerable trigger, PlayerEntity player) { + if (player instanceof ServerPlayerEntity) + trigger.trigger((ServerPlayerEntity) player); + } + + public static void triggerForNearbyPlayers(ITriggerable trigger, World world, BlockPos pos, int range) { triggerForNearbyPlayers(trigger, world, pos, range, player -> true); } - public static void triggerForNearbyPlayers(SimpleTrigger trigger, World world, BlockPos pos, int range, + public static void triggerForNearbyPlayers(ITriggerable trigger, World world, BlockPos pos, int range, Predicate playerFilter) { if (world == null) return; if (world.isRemote) return; - List players = - world.getEntitiesWithinAABB(ServerPlayerEntity.class, new AxisAlignedBB(pos).grow(range)); + List players = getPlayersInRange(world, pos, range); players.stream().filter(playerFilter).forEach(trigger::trigger); } + public static List getPlayersInRange(World world, BlockPos pos, int range) { + List players = + world.getEntitiesWithinAABB(ServerPlayerEntity.class, new AxisAlignedBB(pos).grow(range)); + return players; + } + } diff --git a/src/main/java/com/simibubi/create/foundation/advancement/ITriggerable.java b/src/main/java/com/simibubi/create/foundation/advancement/ITriggerable.java new file mode 100644 index 000000000..3356815d2 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/advancement/ITriggerable.java @@ -0,0 +1,9 @@ +package com.simibubi.create.foundation.advancement; + +import net.minecraft.entity.player.ServerPlayerEntity; + +public interface ITriggerable { + + public void trigger(ServerPlayerEntity player); + +} diff --git a/src/main/java/com/simibubi/create/foundation/advancement/KineticBlockTrigger.java b/src/main/java/com/simibubi/create/foundation/advancement/KineticBlockTrigger.java new file mode 100644 index 000000000..a72bc6f78 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/advancement/KineticBlockTrigger.java @@ -0,0 +1,76 @@ +package com.simibubi.create.foundation.advancement; + +import java.util.Arrays; +import java.util.List; +import java.util.function.Supplier; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonSyntaxException; +import com.simibubi.create.Create; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.util.JSONUtils; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.Registry; + +public class KineticBlockTrigger extends CriterionTriggerBase { + + private static final ResourceLocation ID = new ResourceLocation(Create.ID, "kinetic_block"); + + public KineticBlockTrigger(String id) { + super(id); + } + + public Instance forBlock(Block block) { + return new Instance(block); + } + + @Override + @SuppressWarnings("deprecation") + public Instance deserializeInstance(JsonObject json, JsonDeserializationContext context) { + Block block = null; + if (json.has("block")) { + ResourceLocation resourcelocation = new ResourceLocation(JSONUtils.getString(json, "block")); + block = Registry.BLOCK.getValue(resourcelocation).orElseThrow(() -> { + return new JsonSyntaxException("Unknown block type '" + resourcelocation + "'"); + }); + } + + return new Instance(block); + } + + public void trigger(ServerPlayerEntity player, BlockState state) { + trigger(player, Arrays.asList(() -> state.getBlock())); + } + + public static class Instance extends CriterionTriggerBase.Instance { + private final Block block; + + public Instance(Block block) { + super(KineticBlockTrigger.ID); + this.block = block; + } + + @Override + protected boolean test(List> suppliers) { + if (suppliers.isEmpty()) + return false; + return block == suppliers.get(0).get(); + } + + @Override + @SuppressWarnings("deprecation") + public JsonElement serialize() { + JsonObject jsonobject = new JsonObject(); + if (this.block != null) + jsonobject.addProperty("block", Registry.BLOCK.getKey(this.block).toString()); + return jsonobject; + } + } + + +} diff --git a/src/main/java/com/simibubi/create/foundation/advancement/SandpaperUseTrigger.java b/src/main/java/com/simibubi/create/foundation/advancement/SandpaperUseTrigger.java deleted file mode 100644 index 24b33c26e..000000000 --- a/src/main/java/com/simibubi/create/foundation/advancement/SandpaperUseTrigger.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.simibubi.create.foundation.advancement; - -import java.util.Arrays; -import java.util.List; -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 { - - public SandpaperUseTrigger(String id) { - super(id); - } - - @Override - public Instance deserializeInstance(JsonObject json, JsonDeserializationContext context) { - return new SandpaperUseTrigger.Instance(getId(), ItemPredicate.deserialize(json.get("target")),ItemPredicate.deserialize(json.get("result"))); - } - - public void trigger(ServerPlayerEntity player, ItemStack target, ItemStack result){ - trigger(player, Arrays.asList(() -> target, () -> result)); - } - - public static class Instance extends CriterionTriggerBase.Instance { - private final ItemPredicate target; - private final ItemPredicate result; - - public Instance(ResourceLocation idIn, ItemPredicate target, ItemPredicate result) { - super(idIn); - this.target = target; - this.result = result; - - } - - @Override - protected boolean test(List> suppliers) { - return this.target.test((ItemStack) suppliers.get(0).get()) && - this.result.test((ItemStack) suppliers.get(1).get()); - } - } -} diff --git a/src/main/java/com/simibubi/create/foundation/advancement/SimpleTrigger.java b/src/main/java/com/simibubi/create/foundation/advancement/SimpleTrigger.java index e9df1c110..375bdb3a2 100644 --- a/src/main/java/com/simibubi/create/foundation/advancement/SimpleTrigger.java +++ b/src/main/java/com/simibubi/create/foundation/advancement/SimpleTrigger.java @@ -9,7 +9,7 @@ import com.google.gson.JsonObject; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.util.ResourceLocation; -public class SimpleTrigger extends CriterionTriggerBase { +public class SimpleTrigger extends CriterionTriggerBase implements ITriggerable { public SimpleTrigger(String id) { super(id); @@ -23,6 +23,10 @@ public class SimpleTrigger extends CriterionTriggerBase public void trigger(ServerPlayerEntity player){ super.trigger(player, null); } + + public Instance instance() { + return new Instance(getId()); + } public static class Instance extends CriterionTriggerBase.Instance { diff --git a/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringBehaviour.java b/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringBehaviour.java index 901ff7c8e..7c8b02381 100644 --- a/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringBehaviour.java +++ b/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringBehaviour.java @@ -1,6 +1,7 @@ package com.simibubi.create.foundation.behaviour.filtering; import java.util.function.Consumer; +import java.util.function.Supplier; import com.simibubi.create.AllPackets; import com.simibubi.create.foundation.behaviour.ValueBoxTransform; @@ -29,6 +30,7 @@ public class FilteringBehaviour extends TileEntityBehaviour { private ItemStack filter; public int count; private Consumer callback; + private Supplier isActive; int scrollableValue; int ticksUntilScrollPacket; @@ -40,6 +42,7 @@ public class FilteringBehaviour extends TileEntityBehaviour { slotPositioning = slot; showCount = false; callback = stack -> {}; + isActive = () -> true; textShift = Vec3d.ZERO; count = 0; ticksUntilScrollPacket = -1; @@ -93,6 +96,11 @@ public class FilteringBehaviour extends TileEntityBehaviour { callback = filterCallback; return this; } + + public FilteringBehaviour onlyActiveWhen(Supplier condition) { + isActive = condition; + return this; + } public FilteringBehaviour showCount() { showCount = true; @@ -161,5 +169,9 @@ public class FilteringBehaviour extends TileEntityBehaviour { public boolean anyAmount() { return count == 0; } + + public boolean isActive() { + return isActive.get(); + } } diff --git a/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringHandler.java b/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringHandler.java index 215f5355e..7e30aab98 100644 --- a/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringHandler.java +++ b/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringHandler.java @@ -41,6 +41,8 @@ public class FilteringHandler { FilteringBehaviour behaviour = TileEntityBehaviour.get(world, pos, FilteringBehaviour.TYPE); if (behaviour == null) return; + if (!behaviour.isActive()) + return; BlockRayTraceResult ray = RaycastHelper.rayTraceRange(world, player, 10); if (ray == null) diff --git a/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringRenderer.java b/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringRenderer.java index ce284ff06..452debb5e 100644 --- a/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringRenderer.java @@ -43,6 +43,8 @@ public class FilteringRenderer { FilteringBehaviour behaviour = TileEntityBehaviour.get(world, pos, FilteringBehaviour.TYPE); if (behaviour == null) return; + if (!behaviour.isActive()) + return; if (Minecraft.getInstance().player.isSneaking()) return; @@ -77,6 +79,8 @@ public class FilteringRenderer { FilteringBehaviour behaviour = TileEntityBehaviour.get(tileEntityIn, FilteringBehaviour.TYPE); if (behaviour == null) return; + if (!behaviour.isActive()) + return; if (behaviour.getFilter().isEmpty()) return; diff --git a/src/main/java/com/simibubi/create/foundation/gui/ScreenElementRenderer.java b/src/main/java/com/simibubi/create/foundation/gui/ScreenElementRenderer.java index 251605a41..415142e84 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/ScreenElementRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/gui/ScreenElementRenderer.java @@ -95,17 +95,20 @@ public class ScreenElementRenderer { blockRenderer.renderBlock(blockToRender, ms, buffer, 0xF000F0, OverlayTexture.DEFAULT_UV, EmptyModelData.INSTANCE); } else { - RenderSystem.rotatef(90, 0, 1, 0); - if (color == -1) { - blockRenderer.getBlockModelRenderer().renderModel(ms.peek(), vb, blockToRender, modelToRender, 1, 1, 1, - 0xF000F0, OverlayTexture.DEFAULT_UV, EmptyModelData.INSTANCE); - } else { - Vec3d rgb = ColorHelper.getRGB(color); - blockRenderer.getBlockModelRenderer().renderModel(ms.peek(), vb, blockToRender, modelToRender, - (float) rgb.x, (float) rgb.y, (float) rgb.z, 0xF000F0, OverlayTexture.DEFAULT_UV, - EmptyModelData.INSTANCE); + if (modelToRender != null) { + RenderSystem.rotatef(90, 0, 1, 0); + if (color == -1) { + blockRenderer.getBlockModelRenderer().renderModel(ms.peek(), vb, blockToRender, modelToRender, 1, 1, + 1, 0xF000F0, OverlayTexture.DEFAULT_UV, EmptyModelData.INSTANCE); + } else { + Vec3d rgb = ColorHelper.getRGB(color); + blockRenderer.getBlockModelRenderer().renderModel(ms.peek(), vb, blockToRender, modelToRender, + (float) rgb.x, (float) rgb.y, (float) rgb.z, 0xF000F0, OverlayTexture.DEFAULT_UV, + EmptyModelData.INSTANCE); + } } } + RenderSystem.popMatrix(); buffer.draw(renderType); diff --git a/src/main/java/com/simibubi/create/foundation/item/ItemHelper.java b/src/main/java/com/simibubi/create/foundation/item/ItemHelper.java index cec27ea45..92f049790 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemHelper.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemHelper.java @@ -127,17 +127,27 @@ public class ItemHelper { return false; } + public static enum ExtractionCountMode { + EXACTLY, UPTO + } + public static ItemStack extract(IItemHandler inv, Predicate test, boolean simulate) { - return extract(inv, test, -1, simulate); + return extract(inv, test, ExtractionCountMode.UPTO, AllConfigs.SERVER.logistics.extractorAmount.get(), + simulate); } public static ItemStack extract(IItemHandler inv, Predicate test, int exactAmount, boolean simulate) { + return extract(inv, test, ExtractionCountMode.EXACTLY, exactAmount, simulate); + } + + public static ItemStack extract(IItemHandler inv, Predicate test, ExtractionCountMode mode, int amount, + boolean simulate) { ItemStack extracting = ItemStack.EMPTY; - boolean amountRequired = exactAmount != -1; + boolean amountRequired = mode == ExtractionCountMode.EXACTLY; boolean checkHasEnoughItems = amountRequired; boolean hasEnoughItems = !checkHasEnoughItems; - int maxExtractionCount = hasEnoughItems ? AllConfigs.SERVER.logistics.extractorAmount.get() : exactAmount; boolean potentialOtherMatch = false; + int maxExtractionCount = amount; Extraction: do { extracting = ItemStack.EMPTY; @@ -186,7 +196,7 @@ public class ItemHelper { } while (true); - if (amountRequired && extracting.getCount() < exactAmount) + if (amountRequired && extracting.getCount() < amount) return ItemStack.EMPTY; return extracting; diff --git a/src/main/java/com/simibubi/create/foundation/utility/data/Generator.java b/src/main/java/com/simibubi/create/foundation/utility/data/Generator.java index 6a99fd7f3..d57f0033a 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/data/Generator.java +++ b/src/main/java/com/simibubi/create/foundation/utility/data/Generator.java @@ -1,5 +1,7 @@ package com.simibubi.create.foundation.utility.data; +import com.simibubi.create.data.CreateAdvancements; + import net.minecraft.data.DataGenerator; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -11,8 +13,8 @@ public class Generator { @SubscribeEvent public static void gatherData(GatherDataEvent event){ DataGenerator gen = event.getGenerator(); - //gen.addProvider(AllSoundEvents.CUCKOO_PIG); gen.addProvider(new AllItemsTagProvider(gen)); + gen.addProvider(new CreateAdvancements(gen)); } } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/CasingBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/CasingBlock.java index a67ba3f12..938b56b2c 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/CasingBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/CasingBlock.java @@ -10,11 +10,13 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemUseContext; +import net.minecraft.util.ActionResultType; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; import net.minecraftforge.common.ToolType; -public class CasingBlock extends Block implements IHaveConnectedTextures { +public class CasingBlock extends Block implements IHaveConnectedTextures, IWrenchable { String textureFrom; @@ -22,6 +24,11 @@ public class CasingBlock extends Block implements IHaveConnectedTextures { super(Properties.from(Blocks.ANDESITE)); this.textureFrom = textureFrom; } + + @Override + public ActionResultType onWrenched(BlockState state, ItemUseContext context) { + return ActionResultType.FAIL; + } @Override public ToolType getHarvestTool(BlockState state) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/IWrenchable.java b/src/main/java/com/simibubi/create/modules/contraptions/IWrenchable.java index 71756a241..9799de613 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/IWrenchable.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/IWrenchable.java @@ -28,6 +28,8 @@ public interface IWrenchable { KineticTileEntity.switchToBlockState(world, context.getPos(), updateAfterWrenched(rotated, context)); TileEntity te = context.getWorld().getTileEntity(context.getPos()); + if (te != null) + te.updateContainingBlockInfo(); if (te instanceof GeneratingKineticTileEntity) { ((GeneratingKineticTileEntity) te).updateGeneratedRotation(); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/RotationPropagator.java b/src/main/java/com/simibubi/create/modules/contraptions/RotationPropagator.java index add7a990a..a75ea0211 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/RotationPropagator.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/RotationPropagator.java @@ -248,7 +248,8 @@ public class RotationPropagator { // Do not overpower you own network -> cycle if (!currentTE.hasNetwork() || currentTE.network.equals(neighbourTE.network)) { - if (Math.abs(newSpeed) > Math.abs(speedOfNeighbour)) + float epsilon = Math.abs(speedOfNeighbour) / 256f / 256f; + if (Math.abs(newSpeed) > Math.abs(speedOfNeighbour) + epsilon) world.destroyBlock(pos, true); continue; } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java index 31a669183..d570b7c9a 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java @@ -4,7 +4,6 @@ import com.simibubi.create.foundation.item.ItemDescription.Palette; import net.minecraft.block.Block; import net.minecraft.block.BlockState; -import net.minecraft.block.material.PushReaction; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -64,11 +63,6 @@ public abstract class KineticBlock extends Block implements IRotate { return true; } - @Override - public PushReaction getPushReaction(BlockState state) { - return PushReaction.BLOCK; - } - @Override public abstract TileEntity createTileEntity(BlockState state, IBlockReader world); 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 21b8f0e60..ebcb384df 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 @@ -166,9 +166,13 @@ public abstract class KineticTileEntity extends SmartTileEntity public void onSpeedChanged(float previousSpeed) { boolean fromOrToZero = (previousSpeed == 0) != (getSpeed() == 0); boolean directionSwap = !fromOrToZero && Math.signum(previousSpeed) != Math.signum(getSpeed()); - if (fromOrToZero || directionSwap) { + if (fromOrToZero || directionSwap) flickerTally = getFlickerScore() + 5; - } + + if (fromOrToZero && previousSpeed == 0 && !world.isRemote) + AllTriggers + .getPlayersInRange(world, pos, 4) + .forEach(p -> AllTriggers.KINETIC_BLOCK.trigger(p, getBlockState())); } @Override @@ -355,8 +359,12 @@ public abstract class KineticTileEntity extends SmartTileEntity return; TileEntity tileEntityIn = world.getTileEntity(pos); - if (!(tileEntityIn instanceof KineticTileEntity)) + boolean isKinetic = tileEntityIn instanceof KineticTileEntity; + + if (!isKinetic) { + world.setBlockState(pos, state, 3); return; + } KineticTileEntity tileEntity = (KineticTileEntity) tileEntityIn; if (tileEntity.hasNetwork()) @@ -368,8 +376,7 @@ public abstract class KineticTileEntity extends SmartTileEntity } @Override - public void addBehaviours(List behaviours) { - } + public void addBehaviours(List behaviours) {} @Override public boolean hasFastRenderer() { @@ -382,8 +389,9 @@ public abstract class KineticTileEntity extends SmartTileEntity 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())); + String hint = Lang + .translate("gui.contraptions.network_overstressed", + I18n.format(getBlockState().getBlock().getTranslationKey())); List cutString = TooltipHelper.cutString(spacing + hint, GRAY, TextFormatting.WHITE); for (int i = 0; i < cutString.size(); i++) tooltip.add((i == 0 ? "" : spacing) + cutString.get(i)); @@ -392,8 +400,9 @@ public abstract class KineticTileEntity extends SmartTileEntity if (notFastEnough) { tooltip.add(spacing + GOLD + Lang.translate("tooltip.speedRequirement")); - String hint = Lang.translate("gui.contraptions.not_fast_enough", - I18n.format(getBlockState().getBlock().getTranslationKey())); + String hint = Lang + .translate("gui.contraptions.not_fast_enough", + I18n.format(getBlockState().getBlock().getTranslationKey())); List cutString = TooltipHelper.cutString(spacing + hint, GRAY, TextFormatting.WHITE); for (int i = 0; i < cutString.size(); i++) tooltip.add((i == 0 ? "" : spacing) + cutString.get(i)); @@ -417,10 +426,14 @@ public abstract class KineticTileEntity extends SmartTileEntity 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.GRAY, IHaveGoggleInformation.format(stressTotal), - Lang.translate("gui.goggles.at_current_speed"))); + tooltip + .add(String + .format(stressString, TextFormatting.AQUA, IHaveGoggleInformation.format(stressAtBase), + 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; } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/AttachedActorBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/AttachedActorBlock.java index c738f69b1..d1b882be7 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/AttachedActorBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/AttachedActorBlock.java @@ -1,6 +1,7 @@ package com.simibubi.create.modules.contraptions.components.actors; import com.simibubi.create.foundation.utility.AllShapes; +import com.simibubi.create.modules.contraptions.IWrenchable; import com.simibubi.create.modules.contraptions.components.contraptions.IPortableBlock; import net.minecraft.block.Block; @@ -8,7 +9,9 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.HorizontalBlock; import net.minecraft.item.BlockItemUseContext; +import net.minecraft.item.ItemUseContext; import net.minecraft.state.StateContainer.Builder; +import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; @@ -16,11 +19,16 @@ import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; -public abstract class AttachedActorBlock extends HorizontalBlock implements IPortableBlock { +public abstract class AttachedActorBlock extends HorizontalBlock implements IPortableBlock, IWrenchable { public AttachedActorBlock() { super(Properties.from(Blocks.IRON_BLOCK)); } + + @Override + public ActionResultType onWrenched(BlockState state, ItemUseContext context) { + return ActionResultType.FAIL; + } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterMovementBehaviour.java b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterMovementBehaviour.java index 83a8548b4..c18a8e0a5 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterMovementBehaviour.java @@ -12,6 +12,7 @@ import com.simibubi.create.modules.contraptions.components.contraptions.Movement import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.block.CocoaBlock; import net.minecraft.block.CropsBlock; import net.minecraft.block.KelpBlock; import net.minecraft.block.SugarCaneBlock; @@ -81,7 +82,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour { return false; return true; } - if (state.getCollisionShape(world, pos).isEmpty()) { + if (state.getCollisionShape(world, pos).isEmpty() || state.getBlock() instanceof CocoaBlock) { for (IProperty property : state.getProperties()) { if (!(property instanceof IntegerProperty)) continue; @@ -96,14 +97,14 @@ public class HarvesterMovementBehaviour extends MovementBehaviour { return false; } - + private boolean isValidOther(World world, BlockPos pos, BlockState state) { if (state.getBlock() instanceof CropsBlock) return false; if (state.getBlock() instanceof SugarCaneBlock) return true; - if (state.getCollisionShape(world, pos).isEmpty()) { + if (state.getCollisionShape(world, pos).isEmpty() || state.getBlock() instanceof CocoaBlock) { for (IProperty property : state.getProperties()) { if (!(property instanceof IntegerProperty)) continue; @@ -131,7 +132,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour { return Blocks.AIR.getDefaultState(); return state.getFluidState().getBlockState(); } - if (state.getCollisionShape(world, pos).isEmpty()) { + if (state.getCollisionShape(world, pos).isEmpty() || state.getBlock() instanceof CocoaBlock) { for (IProperty property : state.getProperties()) { if (!(property instanceof IntegerProperty)) continue; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/PloughMovementBehaviour.java b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/PloughMovementBehaviour.java index 12fd4ea93..81fd2b07d 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/PloughMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/PloughMovementBehaviour.java @@ -7,6 +7,7 @@ import com.simibubi.create.modules.contraptions.components.actors.PloughBlock.Pl import com.simibubi.create.modules.contraptions.components.contraptions.MovementContext; import net.minecraft.block.BlockState; +import net.minecraft.block.FlowingFluidBlock; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; import net.minecraft.item.Items; @@ -25,8 +26,8 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour { @Override public boolean isActive(MovementContext context) { - return !VecHelper.isVecPointingTowards(context.relativeMotion, - context.state.get(HORIZONTAL_FACING).getOpposite()); + return !VecHelper + .isVecPointingTowards(context.relativeMotion, context.state.get(HORIZONTAL_FACING).getOpposite()); } @Override @@ -66,7 +67,8 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour { @Override public boolean canBreak(World world, BlockPos breakingPos, BlockState state) { - return state.getCollisionShape(world, breakingPos).isEmpty(); + return state.getCollisionShape(world, breakingPos).isEmpty() + && !(state.getBlock() instanceof FlowingFluidBlock); } @Override diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/BlockMovementTraits.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/BlockMovementTraits.java index b2ed5c4c6..eb352a8d7 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/BlockMovementTraits.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/BlockMovementTraits.java @@ -15,6 +15,9 @@ import com.simibubi.create.modules.contraptions.components.contraptions.pulley.P import com.simibubi.create.modules.contraptions.components.contraptions.pulley.PulleyBlock.MagnetBlock; import com.simibubi.create.modules.contraptions.components.contraptions.pulley.PulleyBlock.RopeBlock; import com.simibubi.create.modules.contraptions.components.contraptions.pulley.PulleyTileEntity; +import com.simibubi.create.modules.contraptions.components.crank.HandCrankBlock; +import com.simibubi.create.modules.contraptions.components.fan.NozzleBlock; +import com.simibubi.create.modules.contraptions.components.flywheel.engine.EngineBlock; import com.simibubi.create.modules.logistics.block.AttachedLogisticalBlock; import com.simibubi.create.modules.logistics.block.RedstoneLinkBlock; import com.simibubi.create.modules.logistics.block.extractor.ExtractorBlock; @@ -26,6 +29,7 @@ import net.minecraft.block.AbstractRailBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.block.CarpetBlock; import net.minecraft.block.DoorBlock; import net.minecraft.block.FenceGateBlock; import net.minecraft.block.FlowerPotBlock; @@ -105,6 +109,8 @@ public class BlockMovementTraits { Block block = state.getBlock(); if (state.has(BlockStateProperties.HANGING)) return true; + if (block instanceof HandCrankBlock) + return true; if (block instanceof LadderBlock) return true; if (block instanceof ExtractorBlock) @@ -131,8 +137,14 @@ public class BlockMovementTraits { return true; if (block instanceof RopeBlock) return true; + if (block instanceof NozzleBlock) + return true; if (block instanceof MagnetBlock) return true; + if (block instanceof EngineBlock) + return true; + if (block instanceof CarpetBlock) + return true; return false; } @@ -159,6 +171,8 @@ public class BlockMovementTraits { return direction == Direction.DOWN; if (block instanceof RedstoneWireBlock) return direction == Direction.DOWN; + if (block instanceof CarpetBlock) + return direction == Direction.DOWN; if (block instanceof RedstoneWallTorchBlock) return state.get(RedstoneWallTorchBlock.FACING) == direction.getOpposite(); if (block instanceof TorchBlock) @@ -178,6 +192,12 @@ public class BlockMovementTraits { return direction == Direction.DOWN; if (block instanceof AttachedActorBlock) return direction == state.get(HarvesterBlock.HORIZONTAL_FACING).getOpposite(); + if (block instanceof HandCrankBlock) + return direction == state.get(HandCrankBlock.FACING).getOpposite(); + if (block instanceof NozzleBlock) + return direction == state.get(NozzleBlock.FACING).getOpposite(); + if (block instanceof EngineBlock) + return direction == state.get(EngineBlock.HORIZONTAL_FACING).getOpposite(); return false; } @@ -196,6 +216,8 @@ public class BlockMovementTraits { return state.get(BlockStateProperties.HORIZONTAL_FACING) == facing; if (AllBlocks.ROPE_PULLEY.typeOf(state)) return facing == Direction.DOWN; + if (state.getBlock() instanceof CarpetBlock) + return facing == Direction.UP; return isBrittle(state); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionCollider.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionCollider.java index 39cb238df..f92f4db64 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionCollider.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionCollider.java @@ -7,6 +7,7 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.modules.contraptions.components.actors.BlockBreakingMovementBehaviour; import net.minecraft.block.BlockState; +import net.minecraft.block.CocoaBlock; import net.minecraft.block.material.PushReaction; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; @@ -272,7 +273,8 @@ public class ContraptionCollider { if (AllBlocks.PULLEY_MAGNET.typeOf(collidedState) && pos.equals(BlockPos.ZERO) && movementDirection == Direction.UP) continue; - + if (collidedState.getBlock() instanceof CocoaBlock) + continue; if (!collidedState.getMaterial().isReplaceable() && !collidedState.getCollisionShape(world, colliderPos).isEmpty()) { return true; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionEntity.java index 037d4deae..fea87145c 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionEntity.java @@ -593,6 +593,12 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD public void setMotion(Vec3d motionIn) { } + @Override + public void setPositionAndUpdate(double x, double y, double z) { + if (!stationary) + super.setPositionAndUpdate(x, y, z); + } + @Override public PushReaction getPushReaction() { return PushReaction.IGNORE; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/MountedStorage.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/MountedStorage.java index e2056fba1..3a1eccd0f 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/MountedStorage.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/MountedStorage.java @@ -9,6 +9,7 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.state.properties.ChestType; import net.minecraft.tileentity.BarrelTileEntity; import net.minecraft.tileentity.ChestTileEntity; +import net.minecraft.tileentity.ShulkerBoxTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraftforge.items.CapabilityItemHandler; @@ -107,6 +108,8 @@ public class MountedStorage { TileEntityType type = te.getType(); if (type == AllTileEntities.FLEXCRATE.type) return true; + if (te instanceof ShulkerBoxTileEntity) + return true; if (te instanceof ChestTileEntity) return true; if (te instanceof BarrelTileEntity) diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/StructureTransform.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/StructureTransform.java index d1c3723d8..15af8fa1f 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/StructureTransform.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/StructureTransform.java @@ -1,7 +1,9 @@ package com.simibubi.create.modules.contraptions.components.contraptions; +import static net.minecraft.block.HorizontalFaceBlock.FACE; import static net.minecraft.state.properties.BlockStateProperties.AXIS; import static net.minecraft.state.properties.BlockStateProperties.FACING; +import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.utility.DirectionHelper; @@ -11,10 +13,13 @@ import com.simibubi.create.modules.contraptions.components.contraptions.chassis. import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Slope; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.block.HorizontalFaceBlock; import net.minecraft.block.SlabBlock; import net.minecraft.block.StairsBlock; import net.minecraft.state.BooleanProperty; +import net.minecraft.state.properties.AttachFace; import net.minecraft.state.properties.Half; import net.minecraft.state.properties.SlabType; import net.minecraft.util.Direction; @@ -74,90 +79,133 @@ public class StructureTransform { * horizontal axes */ public BlockState apply(BlockState state) { - if (rotationAxis == Axis.Y) - state = state.rotate(rotation); - else { - if (state.getBlock() instanceof AbstractChassisBlock) - return rotateChassis(state); + return state.rotate(rotation); - if (state.getBlock() instanceof StairsBlock) { - if (state.get(StairsBlock.FACING).getAxis() != rotationAxis) { - for (int i = 0; i < rotation.ordinal(); i++) { - Direction direction = state.get(StairsBlock.FACING); - Half half = state.get(StairsBlock.HALF); - if (direction.getAxisDirection() == AxisDirection.POSITIVE ^ half == Half.BOTTOM - ^ direction.getAxis() == Axis.Z) - state = state.cycle(StairsBlock.HALF); - else - state = state.with(StairsBlock.FACING, direction.getOpposite()); - } - } else { - if (rotation == Rotation.CLOCKWISE_180) { - state = state.cycle(StairsBlock.HALF); - } - } + Block block = state.getBlock(); + + if (block instanceof AbstractChassisBlock) + return rotateChassis(state); + + if (block instanceof HorizontalFaceBlock) { + Direction stateFacing = state.get(HorizontalFaceBlock.HORIZONTAL_FACING); + AttachFace stateFace = state.get(FACE); + Direction forcedAxis = rotationAxis == Axis.Z ? Direction.EAST : Direction.SOUTH; + + if (stateFacing.getAxis() == rotationAxis && stateFace == AttachFace.WALL) return state; + + for (int i = 0; i < rotation.ordinal(); i++) { + stateFace = state.get(FACE); + stateFacing = state.get(HorizontalFaceBlock.HORIZONTAL_FACING); + + boolean b = state.get(FACE) == AttachFace.CEILING; + state = state.with(HORIZONTAL_FACING, b ? forcedAxis : forcedAxis.getOpposite()); + + if (stateFace != AttachFace.WALL) { + state = state.with(FACE, AttachFace.WALL); + continue; + } + + if (stateFacing.getAxisDirection() == AxisDirection.POSITIVE) { + state = state.with(FACE, AttachFace.FLOOR); + continue; + } + state = state.with(FACE, AttachFace.CEILING); } - if (AllBlocks.BELT.typeOf(state)) { - if (state.get(BeltBlock.HORIZONTAL_FACING).getAxis() != rotationAxis) { - for (int i = 0; i < rotation.ordinal(); i++) { - Slope slope = state.get(BeltBlock.SLOPE); - Direction direction = state.get(BeltBlock.HORIZONTAL_FACING); + return state; + } - // Rotate diagonal - if (slope != Slope.HORIZONTAL && slope != Slope.VERTICAL) { - if (direction.getAxisDirection() == AxisDirection.POSITIVE ^ slope == Slope.DOWNWARD - ^ direction.getAxis() == Axis.Z) { - state = - state.with(BeltBlock.SLOPE, slope == Slope.UPWARD ? Slope.DOWNWARD : Slope.UPWARD); - } else { - state = state.with(BeltBlock.HORIZONTAL_FACING, direction.getOpposite()); - } + if (block instanceof StairsBlock) { + if (state.get(StairsBlock.FACING).getAxis() != rotationAxis) { + for (int i = 0; i < rotation.ordinal(); i++) { + Direction direction = state.get(StairsBlock.FACING); + Half half = state.get(StairsBlock.HALF); + if (direction.getAxisDirection() == AxisDirection.POSITIVE ^ half == Half.BOTTOM + ^ direction.getAxis() == Axis.Z) + state = state.cycle(StairsBlock.HALF); + else + state = state.with(StairsBlock.FACING, direction.getOpposite()); + } + } else { + if (rotation == Rotation.CLOCKWISE_180) { + state = state.cycle(StairsBlock.HALF); + } + } + return state; + } - // Rotate horizontal/vertical + if (AllBlocks.BELT.typeOf(state)) { + if (state.get(BeltBlock.HORIZONTAL_FACING).getAxis() != rotationAxis) { + for (int i = 0; i < rotation.ordinal(); i++) { + Slope slope = state.get(BeltBlock.SLOPE); + Direction direction = state.get(BeltBlock.HORIZONTAL_FACING); + + // Rotate diagonal + if (slope != Slope.HORIZONTAL && slope != Slope.VERTICAL) { + if (direction.getAxisDirection() == AxisDirection.POSITIVE ^ slope == Slope.DOWNWARD + ^ direction.getAxis() == Axis.Z) { + state = state.with(BeltBlock.SLOPE, slope == Slope.UPWARD ? Slope.DOWNWARD : Slope.UPWARD); } else { - if (slope == Slope.HORIZONTAL ^ direction.getAxis() == Axis.Z) { - state = state.with(BeltBlock.HORIZONTAL_FACING, direction.getOpposite()); - } - state = state.with(BeltBlock.SLOPE, - slope == Slope.HORIZONTAL ? Slope.VERTICAL : Slope.HORIZONTAL); - } - } - } else { - if (rotation == Rotation.CLOCKWISE_180) { - Slope slope = state.get(BeltBlock.SLOPE); - Direction direction = state.get(BeltBlock.HORIZONTAL_FACING); - if (slope == Slope.UPWARD || slope == Slope.DOWNWARD) { - state = state.with(BeltBlock.SLOPE, slope == Slope.UPWARD ? Slope.DOWNWARD - : slope == Slope.DOWNWARD ? Slope.UPWARD : slope); - } else if (slope == Slope.VERTICAL) { state = state.with(BeltBlock.HORIZONTAL_FACING, direction.getOpposite()); } + + // Rotate horizontal/vertical + } else { + if (slope == Slope.HORIZONTAL ^ direction.getAxis() == Axis.Z) { + state = state.with(BeltBlock.HORIZONTAL_FACING, direction.getOpposite()); + } + state = + state.with(BeltBlock.SLOPE, slope == Slope.HORIZONTAL ? Slope.VERTICAL : Slope.HORIZONTAL); + } + } + } else { + if (rotation == Rotation.CLOCKWISE_180) { + Slope slope = state.get(BeltBlock.SLOPE); + Direction direction = state.get(BeltBlock.HORIZONTAL_FACING); + if (slope == Slope.UPWARD || slope == Slope.DOWNWARD) { + state = state + .with(BeltBlock.SLOPE, slope == Slope.UPWARD ? Slope.DOWNWARD + : slope == Slope.DOWNWARD ? Slope.UPWARD : slope); + } else if (slope == Slope.VERTICAL) { + state = state.with(BeltBlock.HORIZONTAL_FACING, direction.getOpposite()); } } - return state; } + return state; + } + + if (state.has(FACING)) { + Direction newFacing = transformFacing(state.get(FACING)); + if (state.has(DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE)) { + if (rotationAxis == newFacing.getAxis() && rotation.ordinal() % 2 == 1) + state = state.cycle(DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE); + } + state = state.with(FACING, newFacing); + + } else if (state.has(AXIS)) { + state = state.with(AXIS, transformAxis(state.get(AXIS))); + + } else if (rotation == Rotation.CLOCKWISE_180) { if (state.has(FACING)) { - Direction newFacing = transformFacing(state.get(FACING)); - if (state.has(DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE)) { - if (rotationAxis == newFacing.getAxis() && rotation.ordinal() % 2 == 1) - state = state.cycle(DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE); - } - state = state.with(FACING, newFacing); - - } else if (state.has(AXIS)) { - state = state.with(AXIS, transformAxis(state.get(AXIS))); - - } else if (rotation == Rotation.CLOCKWISE_180) { - state = state.rotate(rotation); - if (state.has(SlabBlock.TYPE) && state.get(SlabBlock.TYPE) != SlabType.DOUBLE) - state = state.with(SlabBlock.TYPE, - state.get(SlabBlock.TYPE) == SlabType.BOTTOM ? SlabType.TOP : SlabType.BOTTOM); + Direction stateFacing = state.get(FACING); + if (stateFacing.getAxis() == rotationAxis) + return state; } + if (state.has(HORIZONTAL_FACING)) { + Direction stateFacing = state.get(HORIZONTAL_FACING); + if (stateFacing.getAxis() == rotationAxis) + return state; + } + + state = state.rotate(rotation); + if (state.has(SlabBlock.TYPE) && state.get(SlabBlock.TYPE) != SlabType.DOUBLE) + state = state + .with(SlabBlock.TYPE, + state.get(SlabBlock.TYPE) == SlabType.BOTTOM ? SlabType.TOP : SlabType.BOTTOM); } return state; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/bearing/BearingBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/bearing/BearingBlock.java index d0b630bd4..3d2490654 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/bearing/BearingBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/bearing/BearingBlock.java @@ -24,7 +24,7 @@ public abstract class BearingBlock extends DirectionalKineticBlock { protected boolean hasStaticPart() { return true; } - + @Override public Axis getRotationAxis(BlockState state) { return state.get(FACING).getAxis(); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/bearing/MechanicalBearingBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/bearing/MechanicalBearingBlock.java index 1c6198bdf..3e67454f6 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/bearing/MechanicalBearingBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/bearing/MechanicalBearingBlock.java @@ -1,6 +1,7 @@ package com.simibubi.create.modules.contraptions.components.contraptions.bearing; import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.utility.WrappedWorld; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -19,7 +20,7 @@ public class MechanicalBearingBlock extends BearingBlock implements ITE ((ChassisTileEntity) te).collectChassisGroup()); range.requiresWrench(); range.between(1, max); - range.withClientCallback( - i -> DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> ChassisRangeDisplay.display(this))); + range + .withClientCallback( + i -> DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> ChassisRangeDisplay.display(this))); range.value = max / 2; behaviours.add(range); } @@ -161,7 +162,7 @@ public class ChassisTileEntity extends SmartTileEntity { BlockPos current = pos.offset(facing, i); BlockState currentState = world.getBlockState(current); - if (forcedMovement != facing && !visualize && !sticky) + if (forcedMovement != facing && !sticky) break; // Ignore replaceable Blocks and Air-like diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/glue/GlueEffectPacket.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/glue/GlueEffectPacket.java index 02dfe0b48..fd15c0be4 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/glue/GlueEffectPacket.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/glue/GlueEffectPacket.java @@ -9,6 +9,7 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.network.NetworkEvent.Context; @@ -36,6 +37,7 @@ public class GlueEffectPacket extends SimplePacketBase { buffer.writeBoolean(fullBlock); } + @OnlyIn(Dist.CLIENT) public void handle(Supplier context) { context.get().enqueueWork(() -> DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { Minecraft mc = Minecraft.getInstance(); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/glue/SuperGlueEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/glue/SuperGlueEntity.java index d55e0bd64..377a154df 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/glue/SuperGlueEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/glue/SuperGlueEntity.java @@ -8,6 +8,9 @@ import com.simibubi.create.AllEntities; import com.simibubi.create.AllItems; import com.simibubi.create.AllPackets; import com.simibubi.create.AllSoundEvents; +import com.simibubi.create.modules.schematics.ISpecialEntityItemRequirement; +import com.simibubi.create.modules.schematics.ItemRequirement; +import com.simibubi.create.modules.schematics.ItemRequirement.ItemUseType; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; @@ -46,7 +49,7 @@ import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; import net.minecraftforge.fml.network.NetworkHooks; import net.minecraftforge.fml.network.PacketDistributor; -public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnData { +public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnData, ISpecialEntityItemRequirement { private int validationTimer; protected BlockPos hangingPosition; @@ -105,31 +108,32 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat protected void updateBoundingBox() { if (this.getFacingDirection() != null) { - double x = hangingPosition.getX() + 0.5 - facingDirection.getXOffset() * 0.5; - double y = hangingPosition.getY() + 0.5 - facingDirection.getYOffset() * 0.5; - double z = hangingPosition.getZ() + 0.5 - facingDirection.getZOffset() * 0.5; + double offset = 0.5 - 1 / 256d; + double x = hangingPosition.getX() + 0.5 - facingDirection.getXOffset() * offset; + double y = hangingPosition.getY() + 0.5 - facingDirection.getYOffset() * offset; + double z = hangingPosition.getZ() + 0.5 - facingDirection.getZOffset() * offset; this.setPos(x, y, z); - double d1 = (double) this.getWidthPixels(); - double d2 = (double) this.getHeightPixels(); - double d3 = (double) this.getWidthPixels(); + double w = getWidthPixels(); + double h = getHeightPixels(); + double l = getWidthPixels(); Axis axis = this.getFacingDirection().getAxis(); double depth = 2 - 1 / 128f; switch (axis) { case X: - d1 = depth; + w = depth; break; case Y: - d2 = depth; + h = depth; break; case Z: - d3 = depth; + l = depth; } - d1 = d1 / 32.0D; - d2 = d2 / 32.0D; - d3 = d3 / 32.0D; - this.setBoundingBox(new AxisAlignedBB(x - d1, y - d2, z - d3, x + d1, y + d2, z + d3)); + w = w / 32.0D; + h = h / 32.0D; + l = l / 32.0D; + this.setBoundingBox(new AxisAlignedBB(x - w, y - h, z - l, x + w, y + h, z + l)); } } @@ -294,13 +298,13 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat if (this.getFacingDirection().getAxis() != Direction.Axis.Y) { switch (transformRotation) { case CLOCKWISE_180: - this.facingDirection = this.getFacingDirection().getOpposite(); + facingDirection = facingDirection.getOpposite(); break; case COUNTERCLOCKWISE_90: - this.facingDirection = this.getFacingDirection().rotateYCCW(); + facingDirection = facingDirection.rotateYCCW(); break; case CLOCKWISE_90: - this.facingDirection = this.getFacingDirection().rotateY(); + facingDirection = facingDirection.rotateY(); default: break; } @@ -366,4 +370,10 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat public Direction getFacingDirection() { return facingDirection; } + + @Override + public ItemRequirement getRequiredItems() { + return new ItemRequirement(ItemUseType.DAMAGE, AllItems.SUPER_GLUE.get()); + } + } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/mounted/CartAssemblerBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/mounted/CartAssemblerBlock.java index c9fa6bad1..f7ff24e85 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/mounted/CartAssemblerBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/mounted/CartAssemblerBlock.java @@ -4,6 +4,7 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.RenderUtilityBlock; import com.simibubi.create.foundation.utility.AllShapes; +import com.simibubi.create.modules.contraptions.IWrenchable; import com.simibubi.create.modules.contraptions.components.contraptions.ContraptionEntity; import com.simibubi.create.modules.contraptions.components.contraptions.mounted.CartAssemblerTileEntity.CartMovementMode; @@ -32,7 +33,7 @@ import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; -public class CartAssemblerBlock extends AbstractRailBlock implements ITE { +public class CartAssemblerBlock extends AbstractRailBlock implements ITE, IWrenchable { public static IProperty RAIL_SHAPE = EnumProperty.create("shape", RailShape.class, RailShape.EAST_WEST, RailShape.NORTH_SOUTH); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/PistonContraption.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/PistonContraption.java index 947321a0d..a8bc914df 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/PistonContraption.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/PistonContraption.java @@ -21,6 +21,7 @@ import com.simibubi.create.modules.contraptions.components.contraptions.glue.Sup import com.simibubi.create.modules.contraptions.components.contraptions.piston.MechanicalPistonBlock.PistonState; import net.minecraft.block.BlockState; +import net.minecraft.block.CarpetBlock; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; import net.minecraft.state.properties.BlockStateProperties; @@ -152,7 +153,7 @@ public class PistonContraption extends Contraption { if (!BlockMovementTraits.movementNecessary(world, currentPos)) return true; BlockState state = world.getBlockState(currentPos); - if (BlockMovementTraits.isBrittle(state)) + if (BlockMovementTraits.isBrittle(state) && !(state.getBlock() instanceof CarpetBlock)) return true; if (AllBlocks.MECHANICAL_PISTON_HEAD.typeOf(state) && state.get(FACING) == direction.getOpposite()) return true; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/PistonPoleBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/PistonPoleBlock.java index efa1100db..2b7e2256a 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/PistonPoleBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/piston/PistonPoleBlock.java @@ -3,6 +3,7 @@ package com.simibubi.create.modules.contraptions.components.contraptions.piston; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.block.ProperDirectionalBlock; import com.simibubi.create.foundation.utility.AllShapes; +import com.simibubi.create.modules.contraptions.IWrenchable; import com.simibubi.create.modules.contraptions.components.contraptions.piston.MechanicalPistonBlock.PistonState; import net.minecraft.block.BlockState; @@ -20,7 +21,7 @@ import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; -public class PistonPoleBlock extends ProperDirectionalBlock { +public class PistonPoleBlock extends ProperDirectionalBlock implements IWrenchable { public PistonPoleBlock() { super(Properties.from(Blocks.PISTON_HEAD)); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/crafter/MechanicalCrafterTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/components/crafter/MechanicalCrafterTileEntity.java index f9be57d87..02f0b6902 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/crafter/MechanicalCrafterTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/crafter/MechanicalCrafterTileEntity.java @@ -217,10 +217,12 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity { }); groupedItems = new GroupedItems(result); - containers.forEach(stack -> { - GroupedItems container = new GroupedItems(stack); + for (int i = 0; i < containers.size(); i++) { + ItemStack stack = containers.get(i); + GroupedItems container = new GroupedItems(); + container.grid.put(Pair.of(i, 0), stack); container.mergeOnto(groupedItems, Pointing.LEFT); - }); + } phase = Phase.CRAFTING; countDown = 2000; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerItemHandler.java b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerItemHandler.java index b598ff183..cd507742b 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerItemHandler.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerItemHandler.java @@ -58,7 +58,8 @@ public class DeployerItemHandler implements IItemHandlerModifiable { return stack; int space = held.getMaxStackSize() - held.getCount(); - ItemStack split = stack.copy().split(space); + ItemStack remainder = stack.copy(); + ItemStack split = remainder.split(space); if (space == 0) return stack; @@ -68,7 +69,7 @@ public class DeployerItemHandler implements IItemHandlerModifiable { set(held); } - return split; + return remainder; } @Override diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerTileEntity.java index 204b5c8b1..6e7a8ec6a 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerTileEntity.java @@ -51,8 +51,11 @@ import net.minecraftforge.items.ItemHandlerHelper; public class DeployerTileEntity extends KineticTileEntity { - private static final List> EXTRACTING_LOCATIONS = Arrays.asList(Direction.values()) - .stream().map(d -> Pair.of(BlockPos.ZERO.offset(d), d.getOpposite())).collect(Collectors.toList()); + private static final List> EXTRACTING_LOCATIONS = Arrays + .asList(Direction.values()) + .stream() + .map(d -> Pair.of(BlockPos.ZERO.offset(d), d.getOpposite())) + .collect(Collectors.toList()); private FilteringBehaviour filtering; private ExtractingBehaviour extracting; @@ -373,8 +376,9 @@ public class DeployerTileEntity extends KineticTileEntity { reach = tag.getFloat("Reach"); if (tag.contains("Particle")) { ItemStack particleStack = ItemStack.read(tag.getCompound("Particle")); - SandPaperItem.spawnParticles(VecHelper.getCenterOf(pos).add(getMovementVector().scale(2f)), particleStack, - this.world); + SandPaperItem + .spawnParticles(VecHelper.getCenterOf(pos).add(getMovementVector().scale(2f)), particleStack, + this.world); } super.readClientUpdate(tag); @@ -402,7 +406,8 @@ public class DeployerTileEntity extends KineticTileEntity { @Override public void remove() { super.remove(); - invHandler.invalidate(); + if (invHandler != null) + invHandler.invalidate(); } public void changeMode() { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/fan/EncasedFanBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/fan/EncasedFanBlock.java index 09519dcb0..426616804 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/fan/EncasedFanBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/fan/EncasedFanBlock.java @@ -1,6 +1,7 @@ package com.simibubi.create.modules.contraptions.components.fan; import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.utility.WrappedWorld; import com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock; import net.minecraft.block.Block; @@ -49,6 +50,8 @@ public class EncasedFanBlock extends DirectionalKineticBlock implements ITE recipe = getRecipe(itemEntity.getItem()); - if (recipe.isPresent()) + if (recipe.isPresent()) { InWorldProcessing.applyRecipeOn(itemEntity, recipe.get()); + AllTriggers.triggerForNearbyPlayers(AllTriggers.BONK, world, pos, 4); + } } } } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelBlock.java index bdbd234f0..6bd0b3719 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelBlock.java @@ -2,11 +2,14 @@ package com.simibubi.create.modules.contraptions.components.waterwheel; import com.simibubi.create.AllBlocks; import com.simibubi.create.config.AllConfigs; +import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.utility.WrappedWorld; import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.fluid.Fluids; import net.minecraft.fluid.IFluidState; import net.minecraft.item.BlockItemUseContext; import net.minecraft.tileentity.TileEntity; @@ -60,7 +63,7 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE 0 ^ !clockwise ? -flow.y * clockwiseMultiplier : -flow.y; } + if (te.getSpeed() == 0 && flowStrength != 0 && !world.isRemote) { + AllTriggers.triggerForNearbyPlayers(AllTriggers.WATER_WHEEL, world, pos, 5); + if (fluid.getFluid() == Fluids.FLOWING_LAVA || fluid.getFluid() == Fluids.LAVA) + AllTriggers.triggerForNearbyPlayers(AllTriggers.LAVA_WHEEL, world, pos, 5); + } + te.setFlow(f, (float) (flowStrength * AllConfigs.SERVER.kinetics.waterWheelSpeed.get() / 2f)); }); } @@ -126,7 +135,6 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE { +public class BasinBlock extends Block implements ITE, IWrenchable { public BasinBlock() { super(Properties.from(Blocks.ANDESITE)); @@ -41,10 +43,10 @@ public class BasinBlock extends Block implements ITE { public TileEntity createTileEntity(BlockState state, IBlockReader world) { return new BasinTileEntity(); } - + @Override - public PushReaction getPushReaction(BlockState state) { - return PushReaction.BLOCK; + public ActionResultType onWrenched(BlockState state, ItemUseContext context) { + return ActionResultType.FAIL; } @Override @@ -81,6 +83,11 @@ public class BasinBlock extends Block implements ITE { if (insertItem.isEmpty()) { itemEntity.remove(); + + if (!itemEntity.world.isRemote) + AllTriggers + .triggerForNearbyPlayers(AllTriggers.BASIN_THROW, itemEntity.world, + itemEntity.getPosition(), 3); return; } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinOperatingTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinOperatingTileEntity.java index e2d21cbe1..e09fa863b 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinOperatingTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinOperatingTileEntity.java @@ -5,6 +5,9 @@ import java.util.List; import java.util.Optional; import java.util.stream.Collectors; +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.foundation.advancement.AllTriggers; +import com.simibubi.create.foundation.advancement.SimpleTrigger; import com.simibubi.create.foundation.behaviour.base.TileEntityBehaviour; import com.simibubi.create.foundation.behaviour.simple.DeferralBehaviour; import com.simibubi.create.foundation.utility.recipe.RecipeFinder; @@ -149,6 +152,13 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity { // something wasn't found return; } + + if (!world.isRemote) { + SimpleTrigger trigger = AllTriggers.MIXER_MIX; + if (getType() == AllTileEntities.MECHANICAL_PRESS.type) + trigger = AllTriggers.PRESS_COMPACT; + AllTriggers.triggerForNearbyPlayers(trigger, world, pos, 4); + } ItemHandlerHelper.insertItemStacked(outputs, lastRecipe.getRecipeOutput().copy(), false); containers.forEach(stack -> ItemHandlerHelper.insertItemStacked(outputs, stack, false)); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/processing/ProcessingRecipeSerializer.java b/src/main/java/com/simibubi/create/modules/contraptions/processing/ProcessingRecipeSerializer.java index 1d605ea2d..1bde1bd31 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/processing/ProcessingRecipeSerializer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/processing/ProcessingRecipeSerializer.java @@ -28,7 +28,13 @@ public class ProcessingRecipeSerializer> List ingredients = new ArrayList<>(); for (JsonElement e : JSONUtils.getJsonArray(json, "ingredients")) { - ingredients.add(ProcessingIngredient.parse(e.getAsJsonObject())); + int count = 1; + if (JSONUtils.hasField((JsonObject) e, "count")) { + count = JSONUtils.getInt(e.getAsJsonObject().get("count"), "count"); + } + for(int i = 0; i < count; i++) { + ingredients.add(ProcessingIngredient.parse(e.getAsJsonObject())); + } } List results = new ArrayList<>(); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/redstone/ContactBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/redstone/ContactBlock.java index 8ead2bf43..a89d47360 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/redstone/ContactBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/redstone/ContactBlock.java @@ -4,6 +4,7 @@ import java.util.Random; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.block.ProperDirectionalBlock; +import com.simibubi.create.modules.contraptions.IWrenchable; import com.simibubi.create.modules.contraptions.components.contraptions.IPortableBlock; import com.simibubi.create.modules.contraptions.components.contraptions.MovementBehaviour; @@ -21,7 +22,7 @@ import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; -public class ContactBlock extends ProperDirectionalBlock implements IPortableBlock { +public class ContactBlock extends ProperDirectionalBlock implements IPortableBlock, IWrenchable { public static final BooleanProperty POWERED = BlockStateProperties.POWERED; public static MovementBehaviour MOVEMENT = new ContactMovementBehaviour(); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/SpeedControllerTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/SpeedControllerTileEntity.java index d90c58efe..fbccb83d3 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/SpeedControllerTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/SpeedControllerTileEntity.java @@ -59,10 +59,25 @@ public class SpeedControllerTileEntity extends KineticTileEntity { boolean targetingController) { if (!(speedControllerIn instanceof SpeedControllerTileEntity)) return 0; - SpeedControllerTileEntity speedController = (SpeedControllerTileEntity) speedControllerIn; + float speed = speedControllerIn.getTheoreticalSpeed(); + float wheelSpeed = cogWheel.getTheoreticalSpeed(); + float desiredOutputSpeed = getDesiredOutputSpeed(cogWheel, speedControllerIn, targetingController); + + float compareSpeed = targetingController ? speed : wheelSpeed; + if (desiredOutputSpeed >= 0 && compareSpeed >= 0) + return Math.max(desiredOutputSpeed, compareSpeed); + if (desiredOutputSpeed < 0 && compareSpeed < 0) + return Math.min(desiredOutputSpeed, compareSpeed); + + return desiredOutputSpeed; + } + + public static float getDesiredOutputSpeed(KineticTileEntity cogWheel, KineticTileEntity speedControllerIn, + boolean targetingController) { + SpeedControllerTileEntity speedController = (SpeedControllerTileEntity) speedControllerIn; float targetSpeed = speedController.targetSpeed.getValue(); - float speed = speedControllerIn.getSpeed(); + float speed = speedControllerIn.getTheoreticalSpeed(); float wheelSpeed = cogWheel.getTheoreticalSpeed(); if (targetSpeed == 0) diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java index 2bb47b76c..c341de5c3 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java @@ -1,5 +1,6 @@ package com.simibubi.create.modules.contraptions.relays.belt; +import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -16,6 +17,9 @@ import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock; import com.simibubi.create.modules.contraptions.relays.belt.transport.BeltMovementHandler.TransportedEntityInfo; import com.simibubi.create.modules.logistics.block.belts.tunnel.BeltTunnelBlock; +import com.simibubi.create.modules.schematics.ISpecialBlockItemRequirement; +import com.simibubi.create.modules.schematics.ItemRequirement; +import com.simibubi.create.modules.schematics.ItemRequirement.ItemUseType; import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; @@ -45,12 +49,14 @@ import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.Hand; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; @@ -62,7 +68,7 @@ import net.minecraftforge.common.Tags; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; -public class BeltBlock extends HorizontalKineticBlock implements ITE, IHaveColorHandler { +public class BeltBlock extends HorizontalKineticBlock implements ITE, IHaveColorHandler, ISpecialBlockItemRequirement { public static final IProperty SLOPE = EnumProperty.create("slope", Slope.class); public static final IProperty PART = EnumProperty.create("part", Part.class); @@ -338,10 +344,11 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE 0 && current != null) { - positions.add(current); BlockState state = world.getBlockState(current); if (!AllBlocks.BELT.typeOf(state)) break; + positions.add(current); current = nextSegmentPosition(state, current, true); } @@ -605,4 +616,34 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE required = new ArrayList<>(); + if (state.get(PART) != Part.MIDDLE) + required.add(new ItemStack(AllBlocksNew.SHAFT.get())); + if (state.get(CASING)) + required.add(new ItemStack(AllBlocks.BRASS_CASING.get())); + if (state.get(PART) == Part.START) + required.add(AllItems.BELT_CONNECTOR.asStack()); + if (required.isEmpty()) + return ItemRequirement.NONE; + return new ItemRequirement(ItemUseType.CONSUME, required); + } + + @Override + public BlockState rotate(BlockState state, Rotation rot) { + BlockState rotate = super.rotate(state, rot); + + if (state.get(SLOPE) != Slope.VERTICAL) + return rotate; + if (state.get(HORIZONTAL_FACING).getAxisDirection() != rotate.get(HORIZONTAL_FACING).getAxisDirection()) { + if (state.get(PART) == Part.START) + return rotate.with(PART, Part.END); + if (state.get(PART) == Part.END) + return rotate.with(PART, Part.START); + } + + return rotate; + } + } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntity.java index 18b546483..6aa355884 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntity.java @@ -73,6 +73,8 @@ public class BeltTileEntity extends KineticTileEntity { // Init belt if (beltLength == 0) BeltBlock.initBelt(world, pos); + if (!AllBlocks.BELT.typeOf(world.getBlockState(pos))) + return; // Initialize Belt Attachments if (world != null && trackerUpdateTag != null) { @@ -131,7 +133,10 @@ public class BeltTileEntity extends KineticTileEntity { TileEntity te = world.getTileEntity(controller); if (te == null || !(te instanceof BeltTileEntity)) return; - IItemHandler handler = ((BeltTileEntity) te).getInventory().createHandlerForSegment(index); + BeltInventory inventory = ((BeltTileEntity) te).getInventory(); + if (inventory == null) + return; + IItemHandler handler = inventory.createHandlerForSegment(index); itemHandler = LazyOptional.of(() -> handler); } @@ -306,8 +311,8 @@ public class BeltTileEntity extends KineticTileEntity { public Direction getMovementFacing() { Axis axis = getBeltFacing().getAxis(); - return Direction.getFacingFromAxisDirection(axis, - getBeltMovementSpeed() < 0 ^ axis == Axis.X ? NEGATIVE : POSITIVE); + return Direction + .getFacingFromAxisDirection(axis, getBeltMovementSpeed() < 0 ^ axis == Axis.X ? NEGATIVE : POSITIVE); } protected Direction getBeltFacing() { @@ -344,7 +349,7 @@ public class BeltTileEntity extends KineticTileEntity { if (simulate) return true; - transportedStack.beltPosition = index + .5f - Math.signum(getSpeed()) / 16f; + transportedStack.beltPosition = index + .5f - Math.signum(getDirectionAwareBeltMovementSpeed()) / 16f; Direction movementFacing = getMovementFacing(); if (!side.getAxis().isVertical()) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/item/BeltConnectorItem.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/item/BeltConnectorItem.java index 02934b59b..cecc06822 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/item/BeltConnectorItem.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/item/BeltConnectorItem.java @@ -5,6 +5,7 @@ import java.util.List; import com.simibubi.create.AllBlocks; import com.simibubi.create.config.AllConfigs; +import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.item.IAddedByOther; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; @@ -71,9 +72,9 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther { if (!canConnect(world, firstPulley, pos)) return ActionResultType.FAIL; - if (firstPulley != null && !firstPulley.equals(pos)) { + if (firstPulley != null && !firstPulley.equals(pos) && !world.isRemote) { createBelts(world, firstPulley, pos); - + AllTriggers.triggerFor(AllTriggers.CONNECT_BELT, context.getPlayer()); if (!context.getPlayer().isCreative()) context.getItem().shrink(1); } @@ -91,15 +92,16 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther { return ActionResultType.SUCCESS; } - private void createBelts(World world, BlockPos start, BlockPos end) { + public static void createBelts(World world, BlockPos start, BlockPos end) { BeltBlock.Slope slope = getSlopeBetween(start, end); Direction facing = getFacingFromTo(start, end); BlockPos diff = end.subtract(start); if (diff.getX() == diff.getZ()) - facing = Direction.getFacingFromAxis(facing.getAxisDirection(), - world.getBlockState(start).get(BlockStateProperties.AXIS) == Axis.X ? Axis.Z : Axis.X); + facing = Direction + .getFacingFromAxis(facing.getAxisDirection(), + world.getBlockState(start).get(BlockStateProperties.AXIS) == Axis.X ? Axis.Z : Axis.X); List beltsToCreate = getBeltChainBetween(start, end, slope, facing); BlockState beltBlock = AllBlocks.BELT.get().getDefaultState(); @@ -109,12 +111,17 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther { boolean pulley = ShaftBlock.isShaft(world.getBlockState(pos)); if (part == Part.MIDDLE && pulley) part = Part.PULLEY; - world.setBlockState(pos, beltBlock.with(BeltBlock.SLOPE, slope).with(BeltBlock.PART, part) - .with(BeltBlock.HORIZONTAL_FACING, facing), 3); + world + .setBlockState(pos, + beltBlock + .with(BeltBlock.SLOPE, slope) + .with(BeltBlock.PART, part) + .with(BeltBlock.HORIZONTAL_FACING, facing), + 3); } } - private Direction getFacingFromTo(BlockPos start, BlockPos end) { + private static Direction getFacingFromTo(BlockPos start, BlockPos end) { Axis beltAxis = start.getX() == end.getX() ? Axis.Z : Axis.X; BlockPos diff = end.subtract(start); AxisDirection axisDirection = AxisDirection.POSITIVE; @@ -128,7 +135,7 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther { return Direction.getFacingFromAxis(axisDirection, beltAxis); } - private Slope getSlopeBetween(BlockPos start, BlockPos end) { + private static Slope getSlopeBetween(BlockPos start, BlockPos end) { BlockPos diff = end.subtract(start); if (diff.getY() != 0) { @@ -139,7 +146,7 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther { return Slope.HORIZONTAL; } - private List getBeltChainBetween(BlockPos start, BlockPos end, Slope slope, Direction direction) { + private static List getBeltChainBetween(BlockPos start, BlockPos end, Slope slope, Direction direction) { List positions = new LinkedList<>(); int limit = 1000; BlockPos current = start; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/transport/BeltInventory.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/transport/BeltInventory.java index abf85f488..41196d14b 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/transport/BeltInventory.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/transport/BeltInventory.java @@ -118,18 +118,18 @@ public class BeltInventory { float diffToEnd = beltMovementPositive ? belt.beltLength - currentPos : -currentPos; float limitedMovement = beltMovementPositive ? Math.min(movement, diffToEnd) : Math.max(movement, diffToEnd); - float nextOffset = current.beltPosition + limitedMovement; - if (!onClient) { + + if (!onClient && segmentBefore != -1) { // Don't move if belt attachments want to continue processing - if (segmentBefore != -1 && current.locked) { + if (current.locked) { BeltTileEntity beltSegment = BeltHelper.getBeltAtSegment(belt, segmentBefore); if (beltSegment != null) { - + // wait in case belt isnt initialized yet if (current.locked && beltSegment.trackerUpdateTag != null) continue; - + current.locked = false; List attachments = beltSegment.attachmentTracker.attachments; for (BeltAttachmentState attachmentState : attachments) { @@ -146,22 +146,24 @@ public class BeltInventory { } // See if any new belt processing catches the item - int upcomingSegment = (int) (current.beltPosition + (beltMovementPositive ? .5f : -.5f)); - for (int segment = upcomingSegment; beltMovementPositive ? segment + .5f <= nextOffset - : segment + .5f >= nextOffset; segment += beltMovementPositive ? 1 : -1) { - BeltTileEntity beltSegment = BeltHelper.getBeltAtSegment(belt, segmentBefore); - if (beltSegment == null) - break; - for (BeltAttachmentState attachmentState : beltSegment.attachmentTracker.attachments) { - ItemStack stackBefore = current.stack.copy(); - if (attachmentState.attachment.startProcessingItem(beltSegment, current, attachmentState)) { - current.beltPosition = segment + .5f + (beltMovementPositive ? 1 / 64f : -1 / 64f); - current.locked = true; - belt.sendData(); - continue Items; + if (current.beltPosition > .5f || beltMovementPositive) { + int firstUpcomingSegment = (int) (current.beltPosition + (beltMovementPositive ? .5f : -.5f)); + for (int segment = firstUpcomingSegment; beltMovementPositive ? segment + .5f <= nextOffset + : segment + .5f >= nextOffset; segment += beltMovementPositive ? 1 : -1) { + BeltTileEntity beltSegment = BeltHelper.getBeltAtSegment(belt, segment); + if (beltSegment == null) + break; + for (BeltAttachmentState attachmentState : beltSegment.attachmentTracker.attachments) { + ItemStack stackBefore = current.stack.copy(); + if (attachmentState.attachment.startProcessingItem(beltSegment, current, attachmentState)) { + current.beltPosition = segment + .5f + (beltMovementPositive ? 1 / 64f : -1 / 64f); + current.locked = true; + belt.sendData(); + continue Items; + } + if (!stackBefore.equals(current.stack, true)) + belt.sendData(); } - if (!stackBefore.equals(current.stack, true)) - belt.sendData(); } } } @@ -202,8 +204,9 @@ public class BeltInventory { if (segment == -1) continue; if (!world.isRemote) - world.updateComparatorOutputLevel(BeltHelper.getPositionForOffset(belt, segment), - belt.getBlockState().getBlock()); + world + .updateComparatorOutputLevel(BeltHelper.getPositionForOffset(belt, segment), + belt.getBlockState().getBlock()); } } @@ -392,7 +395,8 @@ public class BeltInventory { public void read(CompoundNBT nbt) { getItems().clear(); - nbt.getList("Items", NBT.TAG_COMPOUND) + nbt + .getList("Items", NBT.TAG_COMPOUND) .forEach(inbt -> getItems().add(TransportedItemStack.read((CompoundNBT) inbt))); beltMovementPositive = nbt.getBoolean("PositiveOrder"); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/elementary/CogwheelBlockItem.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/elementary/CogwheelBlockItem.java index 907025a45..dbb7288e1 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/elementary/CogwheelBlockItem.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/elementary/CogwheelBlockItem.java @@ -1,8 +1,12 @@ package com.simibubi.create.modules.contraptions.relays.elementary; +import com.simibubi.create.AllBlocksNew; +import com.simibubi.create.foundation.advancement.AllTriggers; +import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItemUseContext; import net.minecraft.util.ActionResultType; @@ -11,6 +15,7 @@ import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; public class CogwheelBlockItem extends BlockItem { @@ -52,8 +57,8 @@ public class CogwheelBlockItem extends BlockItem { hitVec = hitVec .mul(new Vec3d(Direction.getFacingFromAxis(AxisDirection.POSITIVE, offsetAxis).getDirectionVec())); - BlockPos correctPos = context.getPos().add(Math.signum(hitVec.x), Math.signum(hitVec.y), - Math.signum(hitVec.z)); + BlockPos correctPos = + context.getPos().add(Math.signum(hitVec.x), Math.signum(hitVec.y), Math.signum(hitVec.z)); if (context.getWorld().getBlockState(correctPos).getMaterial().isReplaceable()) context = BlockItemUseContext.func_221536_a(context, correctPos, largeOnLarge ? face @@ -65,4 +70,41 @@ public class CogwheelBlockItem extends BlockItem { return super.tryPlace(context); } + @Override + // Trigger cogwheel criterion + protected boolean placeBlock(BlockItemUseContext context, BlockState state) { + World world = context.getWorld(); + PlayerEntity player = context.getPlayer(); + + if (!world.isRemote && player != null) { + Axis axis = state.get(CogWheelBlock.AXIS); + for (Axis perpendicular1 : Iterate.axes) { + if (perpendicular1 == axis) + continue; + Direction d1 = Direction.getFacingFromAxis(AxisDirection.POSITIVE, perpendicular1); + for (Axis perpendicular2 : Iterate.axes) { + if (perpendicular1 == perpendicular2) + continue; + if (axis == perpendicular2) + continue; + Direction d2 = Direction.getFacingFromAxis(AxisDirection.POSITIVE, perpendicular2); + for (int offset1 : Iterate.positiveAndNegative) { + for (int offset2 : Iterate.positiveAndNegative) { + BlockPos connectedPos = context.getPos().offset(d1, offset1).offset(d2, offset2); + BlockState blockState = world.getBlockState(connectedPos); + if (!(blockState.getBlock() instanceof CogWheelBlock)) + continue; + if (blockState.get(CogWheelBlock.AXIS) != axis) + continue; + if (AllBlocksNew.equals(AllBlocksNew.LARGE_COGWHEEL, blockState) == large) + continue; + AllTriggers.triggerFor(AllTriggers.SHIFTING_GEARS, player); + } + } + } + } + } + return super.placeBlock(context, state); + } + } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/AdjustablePulleyTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/AdjustablePulleyTileEntity.java index 1deacba3e..755894047 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/AdjustablePulleyTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/AdjustablePulleyTileEntity.java @@ -33,6 +33,8 @@ public class AdjustablePulleyTileEntity extends KineticTileEntity { } public void neighborChanged() { + if (!hasWorld()) + return; int power = world.getRedstonePowerFromNeighbors(pos); if (power != signal) signalChanged = true; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeBlock.java index bcd1f077b..1f2897f4b 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeBlock.java @@ -5,6 +5,7 @@ import java.util.Random; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.VecHelper; +import com.simibubi.create.foundation.utility.WrappedWorld; import com.simibubi.create.modules.contraptions.base.DirectionalAxisKineticBlock; import com.simibubi.create.modules.contraptions.base.IRotate; @@ -79,13 +80,16 @@ public class GaugeBlock extends DirectionalAxisKineticBlock { Direction nearestLookingDirection = context.getNearestLookingDirection(); boolean lookPositive = nearestLookingDirection.getAxisDirection() == AxisDirection.POSITIVE; if (face.getAxis() == Axis.X) { - toPlace = toPlace.with(FACING, lookPositive ? Direction.NORTH : Direction.SOUTH) + 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); + 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) + toPlace = toPlace + .with(FACING, lookPositive ? Direction.WEST : Direction.EAST) .with(AXIS_ALONG_FIRST_COORDINATE, false); } @@ -119,8 +123,8 @@ public class GaugeBlock extends DirectionalAxisKineticBlock { if (getRotationAxis(state) == Axis.Y && face != state.get(FACING)) return false; BlockState blockState = world.getBlockState(pos.offset(face)); - if (Block.hasSolidSide(blockState, world, pos, face.getOpposite()) - && blockState.getMaterial() != Material.GLASS) + if (Block.hasSolidSide(blockState, world, pos, face.getOpposite()) && blockState.getMaterial() != Material.GLASS + && !(world instanceof WrappedWorld)) return false; return true; } @@ -149,11 +153,15 @@ public class GaugeBlock extends DirectionalAxisKineticBlock { continue; for (int i = 0; i < particleCount; i++) { - Vec3d mul = VecHelper.offsetRandomly(Vec3d.ZERO, rand, .25f) - .mul(new Vec3d(1, 1, 1).subtract(positiveFaceVec)).normalize().scale(.3f); + Vec3d mul = VecHelper + .offsetRandomly(Vec3d.ZERO, rand, .25f) + .mul(new Vec3d(1, 1, 1).subtract(positiveFaceVec)) + .normalize() + .scale(.3f); Vec3d offset = VecHelper.getCenterOf(pos).add(faceVec.scale(.55)).add(mul); - worldIn.addParticle(new RedstoneParticleData((float) rgb.x, (float) rgb.y, (float) rgb.z, 1), offset.x, - offset.y, offset.z, mul.x, mul.y, mul.z); + worldIn + .addParticle(new RedstoneParticleData((float) rgb.x, (float) rgb.y, (float) rgb.z, 1), offset.x, + offset.y, offset.z, mul.x, mul.y, mul.z); } } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/tools/BlazingSwordItem.java b/src/main/java/com/simibubi/create/modules/curiosities/tools/BlazingSwordItem.java new file mode 100644 index 000000000..36ec39727 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/curiosities/tools/BlazingSwordItem.java @@ -0,0 +1,26 @@ +package com.simibubi.create.modules.curiosities.tools; + +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.IItemTier; +import net.minecraft.item.ItemStack; +import net.minecraft.item.SwordItem; + +public class BlazingSwordItem extends SwordItem { + + public BlazingSwordItem(IItemTier tier, int attackDamageIn, float attackSpeedIn, Properties builder) { + super(tier, attackDamageIn, attackSpeedIn, builder); + } + + @Override + public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) { + target.setFire(2); + return BlazingToolItem.shouldTakeDamage(attacker.world, stack) ? super.hitEntity(stack, target, attacker) + : true; + } + + @Override + public int getBurnTime(ItemStack itemStack) { + return itemStack.getMaxDamage() - itemStack.getDamage() + 1; + } + +} diff --git a/src/main/java/com/simibubi/create/modules/curiosities/tools/BlazingToolItem.java b/src/main/java/com/simibubi/create/modules/curiosities/tools/BlazingToolItem.java index 3d04a038e..082041198 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/tools/BlazingToolItem.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/tools/BlazingToolItem.java @@ -55,7 +55,7 @@ public class BlazingToolItem extends AbstractToolItem { return shouldTakeDamage(attacker.world, stack) ? super.hitEntity(stack, target, attacker) : true; } - protected boolean shouldTakeDamage(World world, ItemStack stack) { + static boolean shouldTakeDamage(World world, ItemStack stack) { return world.getDimension().getType() != DimensionType.THE_NETHER; } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItem.java b/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItem.java index b80f3c34b..6747f1f5a 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItem.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItem.java @@ -1,10 +1,8 @@ package com.simibubi.create.modules.curiosities.tools; -import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.block.render.CustomRenderedItemModel; import com.simibubi.create.foundation.item.IHaveCustomItemModel; import com.simibubi.create.foundation.utility.VecHelper; -import com.simibubi.create.modules.contraptions.components.deployer.DeployerFakePlayer; import com.simibubi.create.modules.curiosities.tools.SandPaperItemRenderer.SandPaperModel; import net.minecraft.client.renderer.model.IBakedModel; @@ -12,7 +10,6 @@ import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; @@ -31,6 +28,7 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.common.util.FakePlayer; public class SandPaperItem extends Item implements IHaveCustomItemModel { @@ -136,11 +134,9 @@ public class SandPaperItem extends Item implements IHaveCustomItemModel { } if (!polished.isEmpty()) { - if (player instanceof DeployerFakePlayer) { + if (player instanceof FakePlayer) { player.dropItem(polished, false, false); } else { - AllTriggers.SANDPAPER_USE.trigger((ServerPlayerEntity) player, toPolish, polished); - player.inventory.placeItemBackInInventory(worldIn, polished); } } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/zapper/blockzapper/BlockzapperItem.java b/src/main/java/com/simibubi/create/modules/curiosities/zapper/blockzapper/BlockzapperItem.java index 20c0480b6..5cc8cd05a 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/zapper/blockzapper/BlockzapperItem.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/zapper/blockzapper/BlockzapperItem.java @@ -7,6 +7,7 @@ import java.util.Set; import com.simibubi.create.AllItems; import com.simibubi.create.Create; +import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.block.render.CustomRenderedItemModel; import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.item.IHaveCustomItemModel; @@ -110,8 +111,10 @@ public class BlockzapperItem extends ZapperItem implements IHaveCustomItemModel continue; if (!player.isCreative() && BlockHelper.findAndRemoveInInventory(selectedState, player, 1) == 0) { player.getCooldownTracker().setCooldown(stack.getItem(), 20); - player.sendStatusMessage( - new StringTextComponent(TextFormatting.RED + Lang.translate("blockzapper.empty")), true); + player + .sendStatusMessage( + new StringTextComponent(TextFormatting.RED + Lang.translate("blockzapper.empty")), + true); return false; } @@ -119,9 +122,9 @@ public class BlockzapperItem extends ZapperItem implements IHaveCustomItemModel dropBlocks(world, player, stack, face, placed); for (Direction updateDirection : Direction.values()) - selectedState = selectedState.updatePostPlacement(updateDirection, - world.getBlockState(placed.offset(updateDirection)), world, placed, - placed.offset(updateDirection)); + selectedState = selectedState + .updatePostPlacement(updateDirection, world.getBlockState(placed.offset(updateDirection)), + world, placed, placed.offset(updateDirection)); BlockSnapshot blocksnapshot = BlockSnapshot.getBlockSnapshot(world, placed); IFluidState ifluidstate = world.getFluidState(placed); @@ -132,9 +135,20 @@ public class BlockzapperItem extends ZapperItem implements IHaveCustomItemModel return false; } - if (player instanceof ServerPlayerEntity) - CriteriaTriggers.PLACED_BLOCK.trigger((ServerPlayerEntity) player, placed, - new ItemStack(selectedState.getBlock())); + if (player instanceof ServerPlayerEntity && world instanceof ServerWorld) { + ServerPlayerEntity serverPlayer = (ServerPlayerEntity) player; + CriteriaTriggers.PLACED_BLOCK.trigger(serverPlayer, placed, new ItemStack(selectedState.getBlock())); + + boolean fullyUpgraded = true; + for (Components c : Components.values()) { + if (getTier(c, stack) != ComponentTier.Chromatic) { + fullyUpgraded = false; + break; + } + } + if (fullyUpgraded) + AllTriggers.UPGRADED_ZAPPER.trigger(serverPlayer); + } } return true; @@ -179,8 +193,9 @@ public class BlockzapperItem extends ZapperItem implements IHaveCustomItemModel Vec3d start = player.getPositionVec().add(0, player.getEyeHeight(), 0); Vec3d range = player.getLookVec().scale(getRange(stack)); - BlockRayTraceResult raytrace = player.world.rayTraceBlocks( - new RayTraceContext(start, start.add(range), BlockMode.COLLIDER, FluidMode.NONE, player)); + BlockRayTraceResult raytrace = player.world + .rayTraceBlocks( + new RayTraceContext(start, start.add(range), BlockMode.COLLIDER, FluidMode.NONE, player)); BlockPos pos = raytrace.getPos().toImmutable(); if (pos == null) @@ -318,8 +333,8 @@ public class BlockzapperItem extends ZapperItem implements IHaveCustomItemModel Block.spawnDrops(worldIn.getBlockState(placed), worldIn, playerIn.getPosition(), tileentity); if (getTier(Components.Retriever, item) == ComponentTier.Chromatic) - for (ItemStack stack : Block.getDrops(worldIn.getBlockState(placed), (ServerWorld) worldIn, placed, - tileentity)) + for (ItemStack stack : Block + .getDrops(worldIn.getBlockState(placed), (ServerWorld) worldIn, placed, tileentity)) if (!playerIn.inventory.addItemStackToInventory(stack)) Block.spawnAsEntity(worldIn, placed, stack); } diff --git a/src/main/java/com/simibubi/create/modules/logistics/InWorldProcessing.java b/src/main/java/com/simibubi/create/modules/logistics/InWorldProcessing.java index 73d854d12..9ce6e403b 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/InWorldProcessing.java +++ b/src/main/java/com/simibubi/create/modules/logistics/InWorldProcessing.java @@ -153,6 +153,9 @@ public class InWorldProcessing { return null; List stacks = process(transported.stack, type, belt.getWorld()); + if (stacks == null) + return null; + List transportedStacks = new ArrayList<>(); for (ItemStack additional : stacks) { TransportedItemStack newTransported = transported.getSimilar(); diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/AttachedLogisticalBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/AttachedLogisticalBlock.java index 4974a6270..c5ff8ffcd 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/AttachedLogisticalBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/AttachedLogisticalBlock.java @@ -1,6 +1,7 @@ package com.simibubi.create.modules.logistics.block; import com.simibubi.create.AllBlocks; +import com.simibubi.create.modules.contraptions.IWrenchable; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; import com.simibubi.create.modules.logistics.block.transposer.TransposerBlock; @@ -12,8 +13,10 @@ import net.minecraft.block.material.PushReaction; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUseContext; import net.minecraft.state.BooleanProperty; import net.minecraft.state.StateContainer.Builder; +import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; @@ -22,7 +25,7 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -public abstract class AttachedLogisticalBlock extends HorizontalBlock { +public abstract class AttachedLogisticalBlock extends HorizontalBlock implements IWrenchable { public static final BooleanProperty UPWARD = BooleanProperty.create("upward"); @@ -30,6 +33,11 @@ public abstract class AttachedLogisticalBlock extends HorizontalBlock { super(Properties.from(Blocks.ANDESITE)); } + @Override + public ActionResultType onWrenched(BlockState state, ItemUseContext context) { + return ActionResultType.FAIL; + } + protected abstract boolean isVertical(); protected abstract BlockState getVerticalDefaultState(); diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java index 59d8958b6..90636a5e9 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java @@ -1,13 +1,14 @@ package com.simibubi.create.modules.logistics.block; +import com.simibubi.create.AllItems; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.gui.ScreenOpener; +import com.simibubi.create.modules.contraptions.IWrenchable; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.HorizontalBlock; -import net.minecraft.block.material.PushReaction; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItemUseContext; @@ -27,7 +28,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.items.CapabilityItemHandler; -public class StockswitchBlock extends HorizontalBlock implements ITE { +public class StockswitchBlock extends HorizontalBlock implements ITE, IWrenchable { public static final IntegerProperty INDICATOR = IntegerProperty.create("indicator", 0, 6); @@ -85,6 +86,8 @@ public class StockswitchBlock extends HorizontalBlock implements ITE () -> withTileEntityDo(worldIn, pos, te -> this.displayScreen(te, player))); return ActionResultType.SUCCESS; @@ -136,11 +139,6 @@ public class StockswitchBlock extends HorizontalBlock implements ITE getTileEntityClass() { return StockswitchTileEntity.class; diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchTileEntity.java b/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchTileEntity.java index 3922b79c1..90c69cd51 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchTileEntity.java @@ -1,7 +1,10 @@ package com.simibubi.create.modules.logistics.block; +import java.util.List; + import com.simibubi.create.AllTileEntities; -import com.simibubi.create.foundation.block.SyncedTileEntity; +import com.simibubi.create.foundation.behaviour.base.SmartTileEntity; +import com.simibubi.create.foundation.behaviour.base.TileEntityBehaviour; import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; @@ -15,7 +18,7 @@ import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; -public class StockswitchTileEntity extends SyncedTileEntity { +public class StockswitchTileEntity extends SmartTileEntity { public float onWhenAbove; public float offWhenBelow; @@ -34,6 +37,7 @@ public class StockswitchTileEntity extends SyncedTileEntity { currentLevel = -1; powered = false; observedInventory = LazyOptional.empty(); + setLazyTickRate(10); } @Override @@ -107,7 +111,17 @@ public class StockswitchTileEntity extends SyncedTileEntity { world.notifyNeighbors(pos, getBlockState().getBlock()); } + @Override + public void lazyTick() { + super.lazyTick(); + if (world.isRemote) + return; + findNewInventory(); + updateCurrentLevel(); + } + private boolean findNewInventory() { + observedInventory = LazyOptional.empty(); BlockPos invPos = getPos().offset(getBlockState().get(BlockStateProperties.HORIZONTAL_FACING)); if (!world.isBlockPresent(invPos)) @@ -117,14 +131,21 @@ public class StockswitchTileEntity extends SyncedTileEntity { if (!invState.hasTileEntity()) return false; TileEntity invTE = world.getTileEntity(invPos); + if (invTE == null) + return false; observedInventory = invTE.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY); if (observedInventory.isPresent()) { updateCurrentLevel(); return true; } - + return false; } + @Override + public void addBehaviours(List behaviours) { + + } + } diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/belts/tunnel/BeltTunnelBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/belts/tunnel/BeltTunnelBlock.java index af335eb28..2b5e51bd2 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/belts/tunnel/BeltTunnelBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/belts/tunnel/BeltTunnelBlock.java @@ -7,6 +7,7 @@ import java.util.List; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.utility.Lang; +import com.simibubi.create.foundation.utility.WrappedWorld; import com.simibubi.create.modules.contraptions.IWrenchable; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Slope; @@ -104,7 +105,8 @@ public class BeltTunnelBlock extends Block implements ITE, @Override public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) { - withTileEntityDo(worldIn, currentPos, BeltTunnelTileEntity::initFlaps); + if (!(worldIn instanceof WrappedWorld)) + withTileEntityDo(worldIn, currentPos, BeltTunnelTileEntity::initFlaps); BlockState tunnelState = getTunnelState(worldIn, currentPos); if (tunnelState.get(HORIZONTAL_AXIS) == state.get(HORIZONTAL_AXIS)) { @@ -160,11 +162,11 @@ public class BeltTunnelBlock extends Block implements ITE, // T and Cross Direction left = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis).rotateY(); BlockState leftState = reader.getBlockState(pos.offset(left).down()); - boolean onLeft = AllBlocks.BELT.typeOf(leftState) - && leftState.get(BeltBlock.HORIZONTAL_FACING).getAxis() != axis; + boolean onLeft = + AllBlocks.BELT.typeOf(leftState) && leftState.get(BeltBlock.HORIZONTAL_FACING).getAxis() != axis; BlockState rightState = reader.getBlockState(pos.offset(left.getOpposite()).down()); - boolean onRight = AllBlocks.BELT.typeOf(rightState) - && rightState.get(BeltBlock.HORIZONTAL_FACING).getAxis() != axis; + boolean onRight = + AllBlocks.BELT.typeOf(rightState) && rightState.get(BeltBlock.HORIZONTAL_FACING).getAxis() != axis; if (onLeft && onRight) state = state.with(SHAPE, Shape.CROSS); diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/AbstractDiodeBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/AbstractDiodeBlock.java new file mode 100644 index 000000000..04ad51126 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/AbstractDiodeBlock.java @@ -0,0 +1,13 @@ +package com.simibubi.create.modules.logistics.block.diodes; + +import com.simibubi.create.modules.contraptions.IWrenchable; + +import net.minecraft.block.RedstoneDiodeBlock; + +public abstract class AbstractDiodeBlock extends RedstoneDiodeBlock implements IWrenchable { + + public AbstractDiodeBlock(Properties builder) { + super(builder); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterBlock.java index dc2d0ca72..5865771eb 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterBlock.java @@ -5,7 +5,6 @@ import com.simibubi.create.AllBlocks; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; -import net.minecraft.block.RedstoneDiodeBlock; import net.minecraft.state.BooleanProperty; import net.minecraft.state.StateContainer.Builder; import net.minecraft.tileentity.TileEntity; @@ -13,7 +12,7 @@ import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; -public class FlexpeaterBlock extends RedstoneDiodeBlock { +public class FlexpeaterBlock extends AbstractDiodeBlock { public static BooleanProperty POWERING = BooleanProperty.create("powering"); diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/LatchBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/LatchBlock.java index 364482216..11027f021 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/LatchBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/LatchBlock.java @@ -4,6 +4,8 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.RedstoneWireBlock; import net.minecraft.state.BooleanProperty; import net.minecraft.state.StateContainer.Builder; import net.minecraft.util.ActionResultType; @@ -30,13 +32,9 @@ public class LatchBlock extends ToggleLatchBlock { @Override protected void updateState(World worldIn, BlockPos pos, BlockState state) { boolean back = state.get(POWERED); - boolean shouldBack = this.shouldBePowered(worldIn, pos, state); + boolean shouldBack = shouldBePowered(worldIn, pos, state); boolean side = state.get(POWERED_SIDE); - - Direction direction = state.get(HORIZONTAL_FACING); - Direction left = direction.rotateY(); - Direction right = direction.rotateYCCW(); - boolean shouldSide = worldIn.isBlockPowered(pos.offset(left)) || worldIn.isBlockPowered(pos.offset(right)); + boolean shouldSide = isPoweredOnSides(worldIn, pos, state); TickPriority tickpriority = TickPriority.HIGH; if (this.isFacingTowardsRepeater(worldIn, pos, state)) @@ -50,16 +48,29 @@ public class LatchBlock extends ToggleLatchBlock { worldIn.getPendingBlockTicks().scheduleTick(pos, this, this.getDelay(state), tickpriority); } + protected boolean isPoweredOnSides(World worldIn, BlockPos pos, BlockState state) { + Direction direction = state.get(HORIZONTAL_FACING); + Direction left = direction.rotateY(); + Direction right = direction.rotateYCCW(); + + for (Direction d : new Direction[] { left, right }) { + BlockPos blockpos = pos.offset(d); + int i = worldIn.getRedstonePower(blockpos, d); + if (i > 0) + return true; + BlockState blockstate = worldIn.getBlockState(blockpos); + if (blockstate.getBlock() == Blocks.REDSTONE_WIRE && blockstate.get(RedstoneWireBlock.POWER) > 0) + return true; + } + return false; + } + @Override public void scheduledTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { boolean back = state.get(POWERED); boolean shouldBack = this.shouldBePowered(worldIn, pos, state); boolean side = state.get(POWERED_SIDE); - - Direction direction = state.get(HORIZONTAL_FACING); - Direction left = direction.rotateY(); - Direction right = direction.rotateYCCW(); - boolean shouldSide = worldIn.isBlockPowered(pos.offset(left)) || worldIn.isBlockPowered(pos.offset(right)); + boolean shouldSide = isPoweredOnSides(worldIn, pos, state); BlockState stateIn = state; if (back != shouldBack) { diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/PulseRepeaterBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/PulseRepeaterBlock.java index 0fb7af6e1..46a01faf6 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/PulseRepeaterBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/PulseRepeaterBlock.java @@ -5,7 +5,6 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; -import net.minecraft.block.RedstoneDiodeBlock; import net.minecraft.state.BooleanProperty; import net.minecraft.state.StateContainer.Builder; import net.minecraft.util.Direction; @@ -14,7 +13,7 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.TickPriority; import net.minecraft.world.server.ServerWorld; -public class PulseRepeaterBlock extends RedstoneDiodeBlock { +public class PulseRepeaterBlock extends AbstractDiodeBlock { public static BooleanProperty PULSING = BooleanProperty.create("pulsing"); diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/ToggleLatchBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/ToggleLatchBlock.java index 8a7d93071..e99fab8f8 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/ToggleLatchBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/ToggleLatchBlock.java @@ -2,10 +2,11 @@ package com.simibubi.create.modules.logistics.block.diodes; import java.util.Random; +import com.simibubi.create.AllItems; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; -import net.minecraft.block.RedstoneDiodeBlock; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.state.BooleanProperty; import net.minecraft.state.StateContainer.Builder; @@ -18,10 +19,10 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; -public class ToggleLatchBlock extends RedstoneDiodeBlock { +public class ToggleLatchBlock extends AbstractDiodeBlock { public static BooleanProperty POWERING = BooleanProperty.create("powering"); - + public ToggleLatchBlock() { super(Properties.from(Blocks.REPEATER)); setDefaultState(getDefaultState().with(POWERING, false).with(POWERED, false)); @@ -31,17 +32,17 @@ public class ToggleLatchBlock extends RedstoneDiodeBlock { protected void fillStateContainer(Builder builder) { builder.add(POWERED, POWERING, HORIZONTAL_FACING); } - + @Override public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) { return blockState.get(HORIZONTAL_FACING) == side ? this.getActiveSignal(blockAccess, pos, blockState) : 0; } - + @Override protected int getDelay(BlockState state) { return 1; } - + @Override public ActionResultType onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { @@ -49,6 +50,8 @@ public class ToggleLatchBlock extends RedstoneDiodeBlock { return ActionResultType.PASS; if (player.isSneaking()) return ActionResultType.PASS; + if (AllItems.WRENCH.typeOf(player.getHeldItem(handIn))) + return ActionResultType.PASS; return activated(worldIn, pos, state); } diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/inventories/CrateBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/CrateBlock.java new file mode 100644 index 000000000..b72733e50 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/CrateBlock.java @@ -0,0 +1,82 @@ +package com.simibubi.create.modules.logistics.block.inventories; + +import com.simibubi.create.foundation.block.ProperDirectionalBlock; +import com.simibubi.create.foundation.utility.AllShapes; +import com.simibubi.create.modules.contraptions.IWrenchable; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.state.BooleanProperty; +import net.minecraft.state.StateContainer.Builder; +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.IWorld; +import net.minecraft.world.World; + +public class CrateBlock extends ProperDirectionalBlock implements IWrenchable { + + public static final BooleanProperty DOUBLE = BooleanProperty.create("double"); + + public CrateBlock(Properties p_i48415_1_) { + super(p_i48415_1_); + setDefaultState(getDefaultState().with(FACING, Direction.UP).with(DOUBLE, false)); + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + return AllShapes.CRATE_BLOCK_SHAPE; + } + + @Override + public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, + BlockPos currentPos, BlockPos facingPos) { + + boolean isDouble = stateIn.get(DOUBLE); + Direction blockFacing = stateIn.get(FACING); + boolean isFacingOther = facingState.getBlock() == this && facingState.get(DOUBLE) + && facingState.get(FACING) == facing.getOpposite(); + + if (!isDouble) { + if (!isFacingOther) + return stateIn; + return stateIn.with(DOUBLE, true).with(FACING, facing); + } + + if (facing != blockFacing) + return stateIn; + if (!isFacingOther) + return stateIn.with(DOUBLE, false); + + return stateIn; + } + + @Override + public BlockState getStateForPlacement(BlockItemUseContext context) { + BlockPos pos = context.getPos(); + World world = context.getWorld(); + + if (!context.isPlacerSneaking()) { + for (Direction d : Direction.values()) { + BlockState state = world.getBlockState(pos.offset(d)); + if (state.getBlock() == this && !state.get(DOUBLE)) + return getDefaultState().with(FACING, d).with(DOUBLE, true); + } + } + + Direction placedOnFace = context.getFace().getOpposite(); + BlockState state = world.getBlockState(pos.offset(placedOnFace)); + if (state.getBlock() == this && !state.get(DOUBLE)) + return getDefaultState().with(FACING, placedOnFace).with(DOUBLE, true); + return getDefaultState(); + } + + @Override + protected void fillStateContainer(Builder builder) { + super.fillStateContainer(builder.add(DOUBLE)); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/inventories/CrateTileEntity.java b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/CrateTileEntity.java new file mode 100644 index 000000000..a30a76486 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/CrateTileEntity.java @@ -0,0 +1,37 @@ +package com.simibubi.create.modules.logistics.block.inventories; + +import java.util.List; + +import com.simibubi.create.foundation.behaviour.base.SmartTileEntity; +import com.simibubi.create.foundation.behaviour.base.TileEntityBehaviour; + +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.AxisDirection; + +public abstract class CrateTileEntity extends SmartTileEntity { + + public CrateTileEntity(TileEntityType tileEntityTypeIn) { + super(tileEntityTypeIn); + } + + @Override + public void addBehaviours(List behaviours) {} + + public boolean isDoubleCrate() { + return getBlockState().get(FlexcrateBlock.DOUBLE); + } + + public boolean isSecondaryCrate() { + if (!hasWorld()) + return false; + if (!(getBlockState().getBlock() instanceof CrateBlock)) + return false; + return isDoubleCrate() && getFacing().getAxisDirection() == AxisDirection.NEGATIVE; + } + + public Direction getFacing() { + return getBlockState().get(FlexcrateBlock.FACING); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/inventories/CreativeCrateBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/CreativeCrateBlock.java new file mode 100644 index 000000000..cd63d9a89 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/CreativeCrateBlock.java @@ -0,0 +1,36 @@ +package com.simibubi.create.modules.logistics.block.inventories; + +import com.simibubi.create.foundation.block.ITE; + +import net.minecraft.block.BlockState; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; + +public class CreativeCrateBlock extends CrateBlock implements ITE { + + public CreativeCrateBlock(Properties p_i48415_1_) { + super(p_i48415_1_); + } + + @Override + public boolean hasTileEntity(BlockState state) { + return true; + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return new CreativeCrateTileEntity(); + } + + @Override + public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { + withTileEntityDo(worldIn, pos, CreativeCrateTileEntity::onPlaced); + } + + @Override + public Class getTileEntityClass() { + return CreativeCrateTileEntity.class; + } +} diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/inventories/CreativeCrateInventory.java b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/CreativeCrateInventory.java new file mode 100644 index 000000000..2e0fb5f14 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/CreativeCrateInventory.java @@ -0,0 +1,52 @@ +package com.simibubi.create.modules.logistics.block.inventories; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.items.IItemHandler; + +public class CreativeCrateInventory implements IItemHandler { + + private CreativeCrateTileEntity te; + + public CreativeCrateInventory(CreativeCrateTileEntity te) { + this.te = te; + } + + @Override + public int getSlots() { + return 2; + } + + @Override + public ItemStack getStackInSlot(int slot) { + if (slot == 1) + return ItemStack.EMPTY; + ItemStack filter = te.filter.getFilter().copy(); + if (!filter.isEmpty()) + filter.setCount(filter.getMaxStackSize()); + return filter; + } + + @Override + public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { + return ItemStack.EMPTY; + } + + @Override + public ItemStack extractItem(int slot, int amount, boolean simulate) { + ItemStack filter = te.filter.getFilter().copy(); + if (!filter.isEmpty()) + filter.setCount(amount); + return filter; + } + + @Override + public int getSlotLimit(int slot) { + return getStackInSlot(slot).getMaxStackSize(); + } + + @Override + public boolean isItemValid(int slot, ItemStack stack) { + return true; + } + +} diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/inventories/CreativeCrateTileEntity.java b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/CreativeCrateTileEntity.java new file mode 100644 index 000000000..ccf5bb73b --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/CreativeCrateTileEntity.java @@ -0,0 +1,106 @@ +package com.simibubi.create.modules.logistics.block.inventories; + +import java.util.List; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.foundation.behaviour.ValueBoxTransform; +import com.simibubi.create.foundation.behaviour.base.TileEntityBehaviour; +import com.simibubi.create.foundation.behaviour.filtering.FilteringBehaviour; + +import net.minecraft.block.BlockState; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; +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.IItemHandler; + +public class CreativeCrateTileEntity extends CrateTileEntity { + + public CreativeCrateTileEntity() { + super(AllTileEntities.CREATIVE_CRATE.type); + inv = new CreativeCrateInventory(this); + itemHandler = LazyOptional.of(() -> inv); + } + + FilteringBehaviour filter; + LazyOptional itemHandler; + private CreativeCrateInventory inv; + + @Override + public void addBehaviours(List behaviours) { + filter = createFilter(); + filter.onlyActiveWhen(this::filterVisible); + filter.withCallback(this::filterChanged); + behaviours.add(filter); + } + + private boolean filterVisible() { + if (!hasWorld() || isDoubleCrate() && !isSecondaryCrate()) + return false; + return true; + } + + private void filterChanged(ItemStack filter) { + if (!filterVisible()) + return; + CreativeCrateTileEntity otherCrate = getOtherCrate(); + if (otherCrate == null) + return; + if (ItemStack.areItemsEqual(filter, otherCrate.filter.getFilter())) + return; + otherCrate.filter.setFilter(filter); + } + + private CreativeCrateTileEntity getOtherCrate() { + if (!AllBlocks.CREATIVE_CRATE.typeOf(getBlockState())) + return null; + TileEntity tileEntity = world.getTileEntity(pos.offset(getFacing())); + if (tileEntity instanceof CreativeCrateTileEntity) + return (CreativeCrateTileEntity) tileEntity; + return null; + } + + public void onPlaced() { + if (!isDoubleCrate()) + return; + CreativeCrateTileEntity otherCrate = getOtherCrate(); + if (otherCrate == null) + return; + + filter.withCallback($ -> {}); + filter.setFilter(otherCrate.filter.getFilter()); + filter.withCallback(this::filterChanged); + } + + @Override + public LazyOptional getCapability(Capability cap, Direction side) { + if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + return itemHandler.cast(); + return super.getCapability(cap, side); + } + + public FilteringBehaviour createFilter() { + return new FilteringBehaviour(this, new ValueBoxTransform() { + + @Override + protected Vec3d getOrientation(BlockState state) { + return new Vec3d(0, 0, 90); + } + + @Override + protected Vec3d getLocation(BlockState state) { + return new Vec3d(0.5, 13 / 16d, 0.5); + } + + protected float getScale() { + return super.getScale() * 1.5f; + }; + + }); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateBlock.java index af1789a24..2b2d5b61c 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateBlock.java @@ -1,50 +1,27 @@ package com.simibubi.create.modules.logistics.block.inventories; import com.simibubi.create.AllBlocks; -import com.simibubi.create.foundation.block.ProperDirectionalBlock; import com.simibubi.create.foundation.item.ItemHelper; -import com.simibubi.create.foundation.utility.AllShapes; -import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; -import net.minecraft.state.BooleanProperty; -import net.minecraft.state.StateContainer.Builder; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ActionResultType; -import net.minecraft.util.Direction; import net.minecraft.util.Direction.AxisDirection; 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.IWorld; import net.minecraft.world.World; import net.minecraftforge.fml.network.NetworkHooks; -public class FlexcrateBlock extends ProperDirectionalBlock { - - public static final BooleanProperty DOUBLE = BooleanProperty.create("double"); +public class FlexcrateBlock extends CrateBlock { public FlexcrateBlock() { super(Properties.from(Blocks.ANDESITE)); - setDefaultState(getDefaultState().with(FACING, Direction.UP).with(DOUBLE, false)); - } - - @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return AllShapes.CRATE_BLOCK_SHAPE; - } - - @Override - protected void fillStateContainer(Builder builder) { - super.fillStateContainer(builder.add(DOUBLE)); } @Override @@ -53,23 +30,8 @@ public class FlexcrateBlock extends ProperDirectionalBlock { } @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { - BlockPos pos = context.getPos(); - World world = context.getWorld(); - - if (!context.getPlayer().isSneaking()) { - for (Direction d : Direction.values()) { - BlockState state = world.getBlockState(pos.offset(d)); - if (AllBlocks.FLEXCRATE.typeOf(state) && !state.get(DOUBLE)) - return getDefaultState().with(FACING, d).with(DOUBLE, true); - } - } - - Direction placedOnFace = context.getFace().getOpposite(); - BlockState state = world.getBlockState(pos.offset(placedOnFace)); - if (AllBlocks.FLEXCRATE.typeOf(state) && !state.get(DOUBLE)) - return getDefaultState().with(FACING, placedOnFace).with(DOUBLE, true); - return getDefaultState(); + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return new FlexcrateTileEntity(); } @Override @@ -84,7 +46,7 @@ public class FlexcrateBlock extends ProperDirectionalBlock { FlexcrateTileEntity other = te.getOtherCrate(); if (other == null) return; - + for (int slot = 0; slot < other.inventory.getSlots(); slot++) { te.inventory.setStackInSlot(slot, other.inventory.getStackInSlot(slot)); other.inventory.setStackInSlot(slot, ItemStack.EMPTY); @@ -94,29 +56,6 @@ public class FlexcrateBlock extends ProperDirectionalBlock { } } - @Override - public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, - BlockPos currentPos, BlockPos facingPos) { - - boolean isDouble = stateIn.get(DOUBLE); - Direction blockFacing = stateIn.get(FACING); - boolean isFacingOther = AllBlocks.FLEXCRATE.typeOf(facingState) && facingState.get(DOUBLE) - && facingState.get(FACING) == facing.getOpposite(); - - if (!isDouble) { - if (!isFacingOther) - return stateIn; - return stateIn.with(DOUBLE, true).with(FACING, facing); - } - - if (facing != blockFacing) - return stateIn; - if (!isFacingOther) - return stateIn.with(DOUBLE, false); - - return stateIn; - } - @Override public ActionResultType onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { @@ -134,11 +73,6 @@ public class FlexcrateBlock extends ProperDirectionalBlock { } } - @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new FlexcrateTileEntity(); - } - public static void splitCrate(World world, BlockPos pos) { BlockState state = world.getBlockState(pos); if (!AllBlocks.FLEXCRATE.typeOf(state)) diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateTileEntity.java b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateTileEntity.java index 7de4030b2..665971392 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateTileEntity.java @@ -2,7 +2,6 @@ package com.simibubi.create.modules.logistics.block.inventories; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllTileEntities; -import com.simibubi.create.foundation.block.SyncedTileEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; @@ -15,7 +14,6 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; -import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.common.capabilities.Capability; @@ -24,7 +22,7 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; -public class FlexcrateTileEntity extends SyncedTileEntity implements INamedContainerProvider { +public class FlexcrateTileEntity extends CrateTileEntity implements INamedContainerProvider { public class Inv extends ItemStackHandler { public Inv() { @@ -81,20 +79,6 @@ public class FlexcrateTileEntity extends SyncedTileEntity implements INamedConta return new FlexcrateContainer(id, inventory, this); } - public boolean isDoubleCrate() { - return getBlockState().get(FlexcrateBlock.DOUBLE); - } - - public FlexcrateTileEntity getMainCrate() { - if (isSecondaryCrate()) - return getOtherCrate(); - return this; - } - - public boolean isSecondaryCrate() { - return isDoubleCrate() && getFacing().getAxisDirection() == AxisDirection.NEGATIVE; - } - public FlexcrateTileEntity getOtherCrate() { if (!AllBlocks.FLEXCRATE.typeOf(getBlockState())) return null; @@ -104,8 +88,10 @@ public class FlexcrateTileEntity extends SyncedTileEntity implements INamedConta return null; } - public Direction getFacing() { - return getBlockState().get(FlexcrateBlock.FACING); + public FlexcrateTileEntity getMainCrate() { + if (isSecondaryCrate()) + return getOtherCrate(); + return this; } public void onSplit() { @@ -195,7 +181,7 @@ public class FlexcrateTileEntity extends SyncedTileEntity implements INamedConta public LazyOptional getCapability(Capability capability, Direction facing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { FlexcrateTileEntity mainCrate = getMainCrate(); - if (mainCrate != null && mainCrate.invHandler.isPresent()) + if (mainCrate != null && mainCrate.invHandler != null && mainCrate.invHandler.isPresent()) return mainCrate.invHandler.cast(); } return super.getCapability(capability, facing); diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/transposer/TransposerBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/transposer/TransposerBlock.java index 172541992..d4e9069dc 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/transposer/TransposerBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/transposer/TransposerBlock.java @@ -2,7 +2,6 @@ package com.simibubi.create.modules.logistics.block.transposer; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.utility.AllShapes; -import com.simibubi.create.modules.contraptions.IWrenchable; import com.simibubi.create.modules.logistics.block.belts.BeltAttachableLogisticalBlock; import net.minecraft.block.Block; @@ -23,7 +22,7 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -public class TransposerBlock extends BeltAttachableLogisticalBlock implements IWrenchable { +public class TransposerBlock extends BeltAttachableLogisticalBlock { public static BooleanProperty POWERED = BlockStateProperties.POWERED; diff --git a/src/main/java/com/simibubi/create/modules/schematics/ISpecialBlockItemRequirement.java b/src/main/java/com/simibubi/create/modules/schematics/ISpecialBlockItemRequirement.java new file mode 100644 index 000000000..c0832dee3 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/schematics/ISpecialBlockItemRequirement.java @@ -0,0 +1,11 @@ +package com.simibubi.create.modules.schematics; + +import net.minecraft.block.BlockState; + +public interface ISpecialBlockItemRequirement { + + default ItemRequirement getRequiredItems(BlockState state) { + return ItemRequirement.INVALID; + } + +} diff --git a/src/main/java/com/simibubi/create/modules/schematics/ISpecialEntityItemRequirement.java b/src/main/java/com/simibubi/create/modules/schematics/ISpecialEntityItemRequirement.java new file mode 100644 index 000000000..914eb8827 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/schematics/ISpecialEntityItemRequirement.java @@ -0,0 +1,9 @@ +package com.simibubi.create.modules.schematics; + +public interface ISpecialEntityItemRequirement { + + default ItemRequirement getRequiredItems() { + return ItemRequirement.INVALID; + } + +} diff --git a/src/main/java/com/simibubi/create/modules/schematics/ItemRequirement.java b/src/main/java/com/simibubi/create/modules/schematics/ItemRequirement.java new file mode 100644 index 000000000..3c08adf47 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/schematics/ItemRequirement.java @@ -0,0 +1,125 @@ +package com.simibubi.create.modules.schematics; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.item.ArmorStandEntity; +import net.minecraft.entity.item.BoatEntity; +import net.minecraft.entity.item.ItemFrameEntity; +import net.minecraft.entity.item.minecart.AbstractMinecartEntity; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.state.properties.SlabType; + +public class ItemRequirement { + + public enum ItemUseType { + CONSUME, DAMAGE + } + + ItemUseType usage; + List requiredItems; + + public static ItemRequirement INVALID = new ItemRequirement(); + public static ItemRequirement NONE = new ItemRequirement(); + + private ItemRequirement() { + } + + public ItemRequirement(ItemUseType usage, Item item) { + this(usage, Arrays.asList(new ItemStack(item))); + } + + public ItemRequirement(ItemUseType usage, List requiredItems) { + this.usage = usage; + this.requiredItems = requiredItems; + } + + public static ItemRequirement of(BlockState state) { + Block block = state.getBlock(); + if (block == Blocks.AIR) + return NONE; + if (block instanceof ISpecialBlockItemRequirement) + return ((ISpecialBlockItemRequirement) block).getRequiredItems(state); + + Item item = BlockItem.BLOCK_TO_ITEM.getOrDefault(state.getBlock(), Items.AIR); + + // double slab needs two items + if (state.has(BlockStateProperties.SLAB_TYPE) && state.get(BlockStateProperties.SLAB_TYPE) == SlabType.DOUBLE) + return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(item, 2))); + + return item == Items.AIR ? INVALID : new ItemRequirement(ItemUseType.CONSUME, item); + } + + public static ItemRequirement of(Entity entity) { + EntityType type = entity.getType(); + + if (entity instanceof ISpecialEntityItemRequirement) + return ((ISpecialEntityItemRequirement) entity).getRequiredItems(); + + if (type == EntityType.ITEM_FRAME) { + ItemFrameEntity ife = (ItemFrameEntity) entity; + ItemStack frame = new ItemStack(Items.ITEM_FRAME); + ItemStack displayedItem = ife.getDisplayedItem(); + if (displayedItem.isEmpty()) + return new ItemRequirement(ItemUseType.CONSUME, Items.ITEM_FRAME); + return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(frame, displayedItem)); + } + + if (type == EntityType.PAINTING) + return new ItemRequirement(ItemUseType.CONSUME, Items.PAINTING); + + if (type == EntityType.ARMOR_STAND) { + List requirements = new ArrayList<>(); + ArmorStandEntity armorStandEntity = (ArmorStandEntity) entity; + armorStandEntity.getEquipmentAndArmor().forEach(requirements::add); + requirements.add(new ItemStack(Items.ARMOR_STAND)); + return new ItemRequirement(ItemUseType.CONSUME, requirements); + } + + if (entity instanceof AbstractMinecartEntity) { + AbstractMinecartEntity minecartEntity = (AbstractMinecartEntity) entity; + return new ItemRequirement(ItemUseType.CONSUME, minecartEntity.getCartItem().getItem()); + } + + if (entity instanceof BoatEntity) { + BoatEntity boatEntity = (BoatEntity) entity; + return new ItemRequirement(ItemUseType.CONSUME, boatEntity.getItemBoat().getItem()); + } + + if (type == EntityType.END_CRYSTAL) + return new ItemRequirement(ItemUseType.CONSUME, Items.END_CRYSTAL); + + return INVALID; + } + + public boolean isEmpty() { + return NONE == this; + } + + public boolean isInvalid() { + return INVALID == this; + } + + public List getRequiredItems() { + return requiredItems; + } + + public ItemUseType getUsage() { + return usage; + } + + public static boolean validate(ItemStack required, ItemStack present) { + return required.isEmpty() || required.getItem() == present.getItem(); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/schematics/MaterialChecklist.java b/src/main/java/com/simibubi/create/modules/schematics/MaterialChecklist.java index c115653a1..ddbd5401f 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/MaterialChecklist.java +++ b/src/main/java/com/simibubi/create/modules/schematics/MaterialChecklist.java @@ -7,6 +7,9 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import com.google.common.collect.Sets; +import com.simibubi.create.modules.schematics.ItemRequirement.ItemUseType; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; @@ -21,10 +24,12 @@ public class MaterialChecklist { public Map gathered; public Map required; + public Map damageRequired; public boolean blocksNotLoaded; public MaterialChecklist() { required = new HashMap<>(); + damageRequired = new HashMap<>(); gathered = new HashMap<>(); } @@ -32,16 +37,33 @@ public class MaterialChecklist { blocksNotLoaded = true; } - public void require(Item item) { - if (required.containsKey(item)) - required.put(item, required.get(item) + 1); + public void require(ItemRequirement requirement) { + if (requirement.isEmpty()) + return; + if (requirement.isInvalid()) + return; + + for (ItemStack stack : requirement.requiredItems) { + if (requirement.getUsage() == ItemUseType.DAMAGE) + putOrIncrement(damageRequired, stack); + if (requirement.getUsage() == ItemUseType.CONSUME) + putOrIncrement(required, stack); + } + } + + private void putOrIncrement(Map map, ItemStack stack) { + Item item = stack.getItem(); + if (item == Items.AIR) + return; + if (map.containsKey(item)) + map.put(item, map.get(item) + stack.getCount()); else - required.put(item, 1); + map.put(item, stack.getCount()); } public void collect(ItemStack stack) { Item item = stack.getItem(); - if (required.containsKey(item)) + if (required.containsKey(item) || damageRequired.containsKey(item)) if (gathered.containsKey(item)) gathered.put(item, gathered.get(item) + stack.getCount()); else @@ -65,19 +87,19 @@ public class MaterialChecklist { string = new StringBuilder("{\"text\":\""); } - List keys = new ArrayList<>(required.keySet()); + List keys = new ArrayList<>(Sets.union(required.keySet(), damageRequired.keySet())); Collections.sort(keys, (item1, item2) -> { Locale locale = Locale.ENGLISH; - String name1 = new TranslationTextComponent(((Item) item1).getTranslationKey()).getFormattedText() - .toLowerCase(locale); - String name2 = new TranslationTextComponent(((Item) item2).getTranslationKey()).getFormattedText() - .toLowerCase(locale); + String name1 = + new TranslationTextComponent(((Item) item1).getTranslationKey()).getFormattedText().toLowerCase(locale); + String name2 = + new TranslationTextComponent(((Item) item2).getTranslationKey()).getFormattedText().toLowerCase(locale); return name1.compareTo(name2); }); List completed = new ArrayList<>(); for (Item item : keys) { - int amount = required.get(item); + int amount = getRequiredAmount(item); if (gathered.containsKey(item)) amount -= gathered.get(item); @@ -106,7 +128,7 @@ public class MaterialChecklist { } itemsWritten++; - string.append(gatheredEntry(new ItemStack(item), required.get(item))); + string.append(gatheredEntry(new ItemStack(item), getRequiredAmount(item))); } string.append("\"}"); @@ -120,6 +142,13 @@ public class MaterialChecklist { return book; } + public Integer getRequiredAmount(Item item) { + int amount = required.getOrDefault(item, 0); + if (damageRequired.containsKey(item)) + amount += Math.ceil(damageRequired.get(item) / (float) new ItemStack(item).getMaxDamage()); + return amount; + } + private String gatheredEntry(ItemStack item, int amount) { int stacks = amount / 64; int remainder = amount % 64; diff --git a/src/main/java/com/simibubi/create/modules/schematics/SchematicWorld.java b/src/main/java/com/simibubi/create/modules/schematics/SchematicWorld.java index 664ea2d92..33c5d8223 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/SchematicWorld.java +++ b/src/main/java/com/simibubi/create/modules/schematics/SchematicWorld.java @@ -1,5 +1,6 @@ package com.simibubi.create.modules.schematics; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -14,6 +15,8 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.entity.Entity; +import net.minecraft.entity.item.ArmorStandEntity; +import net.minecraft.entity.item.ItemFrameEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.IFluidState; @@ -31,6 +34,7 @@ public class SchematicWorld extends WrappedWorld { private Map blocks; private Map tileEntities; + private List entities; private Cuboid bounds; public BlockPos anchor; public boolean renderMode; @@ -41,11 +45,28 @@ public class SchematicWorld extends WrappedWorld { this.tileEntities = new HashMap<>(); this.bounds = new Cuboid(); this.anchor = anchor; + this.entities = new ArrayList<>(); } public Set getAllPositions() { return blocks.keySet(); } + + @Override + public boolean addEntity(Entity entityIn) { + if (entityIn instanceof ItemFrameEntity) + ((ItemFrameEntity) entityIn).getDisplayedItem().setTag(null); + if (entityIn instanceof ArmorStandEntity) { + ArmorStandEntity armorStandEntity = (ArmorStandEntity) entityIn; + armorStandEntity.getEquipmentAndArmor().forEach(stack -> stack.setTag(null)); + } + + return entities.add(entityIn); + } + + public List getEntities() { + return entities; + } @Override public TileEntity getTileEntity(BlockPos pos) { diff --git a/src/main/java/com/simibubi/create/modules/schematics/ServerSchematicLoader.java b/src/main/java/com/simibubi/create/modules/schematics/ServerSchematicLoader.java index 303f430f1..06f433322 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/ServerSchematicLoader.java +++ b/src/main/java/com/simibubi/create/modules/schematics/ServerSchematicLoader.java @@ -25,7 +25,6 @@ import com.simibubi.create.modules.schematics.item.SchematicItem; import net.minecraft.block.BlockState; import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TranslationTextComponent; @@ -234,7 +233,6 @@ public class ServerSchematicLoader { if (table == null) return; table.finishUpload(); - table.inventory.setStackInSlot(0, ItemStack.EMPTY); table.inventory.setStackInSlot(1, SchematicItem.create(schematic, player.getName().getFormattedText())); } catch (IOException e) { 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 deleted file mode 100644 index 83df75282..000000000 --- a/src/main/java/com/simibubi/create/modules/schematics/block/CreativeCrateBlock.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.simibubi.create.modules.schematics.block; - -import com.simibubi.create.foundation.utility.AllShapes; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -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; -import net.minecraft.world.IBlockReader; - -public class CreativeCrateBlock extends Block { - - public CreativeCrateBlock(Properties properties) { - super(properties); - } - - @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/LaunchedBlock.java b/src/main/java/com/simibubi/create/modules/schematics/block/LaunchedBlock.java deleted file mode 100644 index 0f9b5300d..000000000 --- a/src/main/java/com/simibubi/create/modules/schematics/block/LaunchedBlock.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.simibubi.create.modules.schematics.block; - -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; - -public class LaunchedBlock { - - private final SchematicannonTileEntity te; - public int totalTicks; - public int ticksRemaining; - public BlockPos target; - public BlockState state; - - public LaunchedBlock(SchematicannonTileEntity schematicannonTileEntity, BlockPos target, BlockState state) { - te = schematicannonTileEntity; - this.target = target; - this.state = state; - totalTicks = (int) (Math.max(10, MathHelper.sqrt(MathHelper.sqrt(target.distanceSq(te.getPos()))) * 4f)); - ticksRemaining = totalTicks; - } - - public LaunchedBlock(SchematicannonTileEntity schematicannonTileEntity, BlockPos target, BlockState state, - int ticksLeft, int total) { - te = schematicannonTileEntity; - this.target = target; - this.state = state; - this.totalTicks = total; - this.ticksRemaining = ticksLeft; - } - - public void update() { - if (ticksRemaining > 0) - ticksRemaining--; - } -} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/LaunchedItem.java b/src/main/java/com/simibubi/create/modules/schematics/block/LaunchedItem.java new file mode 100644 index 000000000..f283eb3fe --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/schematics/block/LaunchedItem.java @@ -0,0 +1,210 @@ +package com.simibubi.create.modules.schematics.block; + +import java.util.Optional; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; +import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Part; +import com.simibubi.create.modules.contraptions.relays.belt.item.BeltConnectorItem; +import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock; + +import net.minecraft.block.BlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.world.World; + +public abstract class LaunchedItem { + + public int totalTicks; + public int ticksRemaining; + public BlockPos target; + public ItemStack stack; + + private LaunchedItem(BlockPos start, BlockPos target, ItemStack stack) { + this(target, stack, ticksForDistance(start, target), ticksForDistance(start, target)); + } + + private static int ticksForDistance(BlockPos start, BlockPos target) { + return (int) (Math.max(10, MathHelper.sqrt(MathHelper.sqrt(target.distanceSq(start))) * 4f)); + } + + LaunchedItem() {} + + private LaunchedItem(BlockPos target, ItemStack stack, int ticksLeft, int total) { + this.target = target; + this.stack = stack; + this.totalTicks = total; + this.ticksRemaining = ticksLeft; + } + + public boolean update(World world) { + if (ticksRemaining > 0) { + ticksRemaining--; + return false; + } + if (world.isRemote) + return false; + + place(world); + return true; + } + + public CompoundNBT serializeNBT() { + CompoundNBT c = new CompoundNBT(); + c.putInt("TotalTicks", totalTicks); + c.putInt("TicksLeft", ticksRemaining); + c.put("Stack", stack.serializeNBT()); + c.put("Target", NBTUtil.writeBlockPos(target)); + return c; + } + + public static LaunchedItem fromNBT(CompoundNBT c) { + LaunchedItem launched = c.contains("Length") ? new LaunchedItem.ForBelt() + : c.contains("BlockState") ? new LaunchedItem.ForBlockState() : new LaunchedItem.ForEntity(); + launched.readNBT(c); + return launched; + } + + abstract void place(World world); + + void readNBT(CompoundNBT c) { + target = NBTUtil.readBlockPos(c.getCompound("Target")); + ticksRemaining = c.getInt("TicksLeft"); + totalTicks = c.getInt("TotalTicks"); + stack = ItemStack.read(c.getCompound("Stack")); + } + + public static class ForBlockState extends LaunchedItem { + public BlockState state; + + ForBlockState() {} + + public ForBlockState(BlockPos start, BlockPos target, ItemStack stack, BlockState state) { + super(start, target, stack); + this.state = state; + } + + @Override + public CompoundNBT serializeNBT() { + CompoundNBT serializeNBT = super.serializeNBT(); + serializeNBT.put("BlockState", NBTUtil.writeBlockState(state)); + return serializeNBT; + } + + @Override + void readNBT(CompoundNBT nbt) { + super.readNBT(nbt); + state = NBTUtil.readBlockState(nbt.getCompound("BlockState")); + } + + @Override + void place(World world) { + // Piston + if (state.has(BlockStateProperties.EXTENDED)) + state = state.with(BlockStateProperties.EXTENDED, false); + + if (AllBlocks.BELT.typeOf(state)) { + world.setBlockState(target, state, 2); + return; + } + + world.setBlockState(target, state, 18); + state.getBlock().onBlockPlacedBy(world, target, state, null, stack); + } + + } + + public static class ForBelt extends ForBlockState { + public int length; + + public ForBelt() {} + + @Override + public CompoundNBT serializeNBT() { + CompoundNBT serializeNBT = super.serializeNBT(); + serializeNBT.putInt("Length", length); + return serializeNBT; + } + + @Override + void readNBT(CompoundNBT nbt) { + length = nbt.getInt("Length"); + super.readNBT(nbt); + } + + public ForBelt(BlockPos start, BlockPos target, ItemStack stack, BlockState state, int length) { + super(start, target, stack, state); + this.length = length; + } + + @Override + void place(World world) { + // todo place belt + boolean isStart = state.get(BeltBlock.PART) == Part.START; + BlockPos offset = BeltBlock.nextSegmentPosition(state, BlockPos.ZERO, isStart); + int i = length - 1; + Axis axis = state.get(BeltBlock.HORIZONTAL_FACING).rotateY().getAxis(); + world.setBlockState(target, AllBlocks.SHAFT.getDefault().with(ShaftBlock.AXIS, axis)); + BeltConnectorItem + .createBelts(world, target, target.add(offset.getX() * i, offset.getY() * i, offset.getZ() * i)); + } + + } + + public static class ForEntity extends LaunchedItem { + public Entity entity; + private CompoundNBT deferredTag; + + ForEntity() {} + + public ForEntity(BlockPos start, BlockPos target, ItemStack stack, Entity entity) { + super(start, target, stack); + this.entity = entity; + } + + @Override + public boolean update(World world) { + if (deferredTag != null && entity == null) { + try { + Optional loadEntityUnchecked = EntityType.loadEntityUnchecked(deferredTag, world); + if (!loadEntityUnchecked.isPresent()) + return true; + entity = loadEntityUnchecked.get(); + } catch (Exception var3) { + return true; + } + deferredTag = null; + } + return super.update(world); + } + + @Override + public CompoundNBT serializeNBT() { + CompoundNBT serializeNBT = super.serializeNBT(); + if (entity != null) + serializeNBT.put("Entity", entity.serializeNBT()); + return serializeNBT; + } + + @Override + void readNBT(CompoundNBT nbt) { + super.readNBT(nbt); + if (nbt.contains("Entity")) + deferredTag = nbt.getCompound("Entity"); + } + + @Override + void place(World world) { + world.addEntity(entity); + } + + } + +} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableTileEntity.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableTileEntity.java index 968ff81b5..272e45ced 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableTileEntity.java @@ -7,6 +7,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.INamedContainerProvider; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.ITickableTileEntity; @@ -102,6 +103,7 @@ public class SchematicTableTileEntity extends SyncedTileEntity implements ITicka uploadingProgress = 0; uploadingSchematic = schematic; sendUpdate = true; + inventory.setStackInSlot(0, ItemStack.EMPTY); } public void finishUpload() { diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonBlock.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonBlock.java index 1a03f8920..ed9a6a8c5 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonBlock.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonBlock.java @@ -17,7 +17,6 @@ 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.fml.network.NetworkHooks; @@ -47,17 +46,11 @@ public class SchematicannonBlock extends Block implements ITE NetworkHooks.openGui((ServerPlayerEntity) player, te, te::sendToContainer)); return ActionResultType.SUCCESS; diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonRenderer.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonRenderer.java index bba4f2cb6..7701ec607 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonRenderer.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonRenderer.java @@ -3,10 +3,13 @@ package com.simibubi.create.modules.schematics.block; import java.util.Random; import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.block.SafeTileEntityRenderer; import com.simibubi.create.foundation.utility.SuperByteBuffer; +import com.simibubi.create.modules.schematics.block.LaunchedItem.ForBlockState; +import com.simibubi.create.modules.schematics.block.LaunchedItem.ForEntity; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; @@ -14,6 +17,7 @@ import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.particles.ParticleTypes; @@ -23,6 +27,7 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraftforge.client.model.data.EmptyModelData; +@SuppressWarnings("deprecation") public class SchematicannonRenderer extends SafeTileEntityRenderer { public SchematicannonRenderer(TileEntityRendererDispatcher dispatcher) { @@ -30,8 +35,8 @@ public class SchematicannonRenderer extends SafeTileEntityRenderer block.totalTicks - 10) { - recoil = Math.max(recoil, (block.ticksRemaining + 1 - partialTicks) - block.totalTicks + 10); + if ((launched.ticksRemaining + 1 - partialTicks) > launched.totalTicks - 10) { + recoil = Math.max(recoil, (launched.ticksRemaining + 1 - partialTicks) - launched.totalTicks + 10); } // Render particles for launch - if (block.ticksRemaining == block.totalTicks && tileEntityIn.firstRenderTick) { + if (launched.ticksRemaining == launched.totalTicks && tileEntityIn.firstRenderTick) { tileEntityIn.firstRenderTick = false; for (int i = 0; i < 10; i++) { Random r = tileEntityIn.getWorld().getRandom(); @@ -128,7 +144,7 @@ public class SchematicannonRenderer extends SafeTileEntityRenderer(4); replaceLevelIndicators = new Vector<>(4); - List icons = ImmutableList.of(ScreenResources.I_DONT_REPLACE, - ScreenResources.I_REPLACE_SOLID, ScreenResources.I_REPLACE_ANY, - ScreenResources.I_REPLACE_EMPTY); - List toolTips = ImmutableList.of(Lang.translate("gui.schematicannon.option.dontReplaceSolid"), - Lang.translate("gui.schematicannon.option.replaceWithSolid"), - Lang.translate("gui.schematicannon.option.replaceWithAny"), - Lang.translate("gui.schematicannon.option.replaceWithEmpty")); + List icons = ImmutableList + .of(ScreenResources.I_DONT_REPLACE, ScreenResources.I_REPLACE_SOLID, ScreenResources.I_REPLACE_ANY, + ScreenResources.I_REPLACE_EMPTY); + List toolTips = ImmutableList + .of(Lang.translate("gui.schematicannon.option.dontReplaceSolid"), + Lang.translate("gui.schematicannon.option.replaceWithSolid"), + Lang.translate("gui.schematicannon.option.replaceWithAny"), + Lang.translate("gui.schematicannon.option.replaceWithEmpty")); for (int i = 0; i < 4; i++) { replaceLevelIndicators.add(new Indicator(x + 16 + i * 18, y + 96, "")); @@ -191,8 +191,10 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen tip = button.getToolTip(); tip.add(TextFormatting.BLUE + (enabled ? optionEnabled : optionDisabled)); - tip.addAll(TooltipHelper.cutString(Lang.translate("gui.schematicannon.option." + tooltipKey + ".description"), - GRAY, GRAY)); + tip + .addAll(TooltipHelper + .cutString(Lang.translate("gui.schematicannon.option." + tooltipKey + ".description"), GRAY, + GRAY)); } @Override @@ -215,21 +217,22 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen= fuelX && mouseY >= fuelY && mouseX <= fuelX + ScreenResources.SCHEMATICANNON_FUEL.width && mouseY <= fuelY + ScreenResources.SCHEMATICANNON_FUEL.height) { container.getTileEntity(); + double fuelUsageRate = te.getFuelUsageRate(); int shotsLeft = (int) (te.fuelLevel / fuelUsageRate); int shotsLeftWithItems = (int) (shotsLeft + te.inventory.getStackInSlot(4).getCount() * (te.getFuelAddedByGunPowder() / fuelUsageRate)); - renderTooltip(ImmutableList.of(Lang.translate(_gunpowderLevel, "" + (int) (te.fuelLevel * 100)), - GRAY + Lang.translate(_shotsRemaining, "" + TextFormatting.BLUE + shotsLeft), - GRAY + Lang.translate(_shotsRemainingWithBackup, "" + TextFormatting.BLUE + shotsLeftWithItems)), - mouseX, mouseY); + + List tooltip = new ArrayList<>(); + float f = te.hasCreativeCrate ? 100 : te.fuelLevel * 100; + tooltip.add(Lang.translate(_gunpowderLevel, "" + (int) f)); + if (!te.hasCreativeCrate) + tooltip.add(GRAY + Lang.translate(_shotsRemaining, "" + TextFormatting.BLUE + shotsLeft)); + if (shotsLeftWithItems != shotsLeft) + tooltip + .add(GRAY + Lang + .translate(_shotsRemainingWithBackup, "" + TextFormatting.BLUE + shotsLeftWithItems)); + + renderTooltip(tooltip, mouseX, mouseY); } - if (te.missingBlock != null) { + if (te.missingItem != null) { int missingBlockX = guiLeft + 145, missingBlockY = guiTop + 25; if (mouseX >= missingBlockX && mouseY >= missingBlockY && mouseX <= missingBlockX + 16 && mouseY <= missingBlockY + 16) { - renderTooltip(new ItemStack(BlockItem.BLOCK_TO_ITEM.get(te.missingBlock.getBlock())), mouseX, mouseY); + renderTooltip(te.missingItem, mouseX, mouseY); } } diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java index c2b01e7c6..82e1c65fd 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java @@ -11,6 +11,15 @@ import com.simibubi.create.config.AllConfigs; import com.simibubi.create.config.CSchematics; import com.simibubi.create.foundation.behaviour.base.SmartTileEntity; import com.simibubi.create.foundation.behaviour.base.TileEntityBehaviour; +import com.simibubi.create.foundation.item.ItemHelper; +import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode; +import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; +import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Part; +import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Slope; +import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntity; +import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock; +import com.simibubi.create.modules.schematics.ItemRequirement; +import com.simibubi.create.modules.schematics.ItemRequirement.ItemUseType; import com.simibubi.create.modules.schematics.MaterialChecklist; import com.simibubi.create.modules.schematics.SchematicWorld; import com.simibubi.create.modules.schematics.item.SchematicItem; @@ -18,6 +27,7 @@ import com.simibubi.create.modules.schematics.item.SchematicItem; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.PistonHeadBlock; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.Container; @@ -33,21 +43,23 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.state.properties.BedPart; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.DoubleBlockHalf; -import net.minecraft.state.properties.SlabType; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; +import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; +import net.minecraft.world.gen.feature.template.PlacementSettings; import net.minecraft.world.gen.feature.template.Template; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; +import net.minecraftforge.items.ItemHandlerHelper; public class SchematicannonTileEntity extends SmartTileEntity implements INamedContainerProvider { @@ -71,17 +83,18 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC public BlockPos currentPos; public BlockPos schematicAnchor; public boolean schematicLoaded; - public BlockState missingBlock; - public boolean blockNotLoaded; + public ItemStack missingItem; + public boolean positionNotLoaded; public boolean hasCreativeCrate; private int printerCooldown; private int skipsLeft; private boolean blockSkipped; + private int printingEntityIndex; public BlockPos target; public BlockPos previousTarget; public List attachedInventories; - public List flyingBlocks; + public List flyingBlocks; public MaterialChecklist checklist; // Gui information @@ -124,6 +137,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC inventory = new SchematicannonInventory(this); statusMsg = "idle"; state = State.STOPPED; + printingEntityIndex = -1; replaceMode = 2; neighbourCheckCooldown = NEIGHBOUR_CHECKING; checklist = new MaterialChecklist(); @@ -143,8 +157,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC TileEntity tileEntity = world.getTileEntity(pos.offset(facing)); if (tileEntity != null) { - LazyOptional capability = tileEntity - .getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()); + LazyOptional capability = + tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()); if (capability.isPresent()) { attachedInventories.add(capability.orElse(null)); } @@ -156,7 +170,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC public void read(CompoundNBT compound) { inventory.deserializeNBT(compound.getCompound("Inventory")); - if (compound.contains("Running")) + if (compound.contains("CurrentPos")) currentPos = NBTUtil.readBlockPos(compound.getCompound("CurrentPos")); readClientUpdate(compound); @@ -174,11 +188,11 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC state = State.valueOf(compound.getString("State")); blocksPlaced = compound.getInt("AmountPlaced"); blocksToPlace = compound.getInt("AmountToPlace"); + printingEntityIndex = compound.getInt("EntityProgress"); - if (compound.contains("MissingBlock")) - missingBlock = NBTUtil.readBlockState(compound.getCompound("MissingBlock")); - else - missingBlock = null; + missingItem = null; + if (compound.contains("MissingItem")) + missingItem = ItemStack.read(compound.getCompound("MissingItem")); // Settings CompoundNBT options = compound.getCompound("Options"); @@ -203,15 +217,12 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC for (int i = 0; i < tagBlocks.size(); i++) { CompoundNBT c = tagBlocks.getCompound(i); - - BlockPos readBlockPos = NBTUtil.readBlockPos(c.getCompound("Target")); - BlockState readBlockState = NBTUtil.readBlockState(c.getCompound("Block")); - int int1 = c.getInt("TicksLeft"); - int int2 = c.getInt("TotalTicks"); + LaunchedItem launched = LaunchedItem.fromNBT(c); + BlockPos readBlockPos = launched.target; // Always write to Server tile if (world == null || !world.isRemote) { - flyingBlocks.add(new LaunchedBlock(this, readBlockPos, readBlockState, int1, int2)); + flyingBlocks.add(launched); continue; } @@ -224,7 +235,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC // Add new server side blocks if (i >= flyingBlocks.size()) { - flyingBlocks.add(new LaunchedBlock(this, readBlockPos, readBlockState, int1, int2)); + flyingBlocks.add(launched); continue; } @@ -238,7 +249,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC if (state == State.RUNNING) { compound.putBoolean("Running", true); - compound.put("CurrentPos", NBTUtil.writeBlockPos(currentPos)); + if (currentPos != null) + compound.put("CurrentPos", NBTUtil.writeBlockPos(currentPos)); } writeToClient(compound); @@ -256,9 +268,10 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC compound.putString("State", state.name()); compound.putInt("AmountPlaced", blocksPlaced); compound.putInt("AmountToPlace", blocksToPlace); + compound.putInt("EntityProgress", printingEntityIndex); - if (missingBlock != null) - compound.put("MissingBlock", NBTUtil.writeBlockState(missingBlock)); + if (missingItem != null) + compound.put("MissingItem", missingItem.serializeNBT()); // Settings CompoundNBT options = new CompoundNBT(); @@ -271,14 +284,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC if (target != null) compound.put("Target", NBTUtil.writeBlockPos(target)); ListNBT tagBlocks = new ListNBT(); - for (LaunchedBlock b : flyingBlocks) { - CompoundNBT c = new CompoundNBT(); - c.putInt("TotalTicks", b.totalTicks); - c.putInt("TicksLeft", b.ticksRemaining); - c.put("Target", NBTUtil.writeBlockPos(b.target)); - c.put("Block", NBTUtil.writeBlockState(b.state)); - tagBlocks.add(c); - } + for (LaunchedItem b : flyingBlocks) + tagBlocks.add(b.serializeNBT()); compound.put("FlyingBlocks", tagBlocks); return compound; @@ -287,7 +294,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC @Override public void tick() { super.tick(); - + if (neighbourCheckCooldown-- <= 0) { neighbourCheckCooldown = NEIGHBOUR_CHECKING; findInventories(); @@ -344,7 +351,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC return; } - if (state == State.PAUSED && !blockNotLoaded && missingBlock == null && fuelLevel > getFuelUsageRate()) + if (state == State.PAUSED && !positionNotLoaded && missingItem == null && fuelLevel > getFuelUsageRate()) return; // Initialize Printer @@ -360,7 +367,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC } // Check Fuel - if (fuelLevel <= 0) { + if (fuelLevel <= 0 && !hasCreativeCrate) { fuelLevel = 0; state = State.PAUSED; statusMsg = "noGunpowder"; @@ -370,13 +377,13 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC // Update Target if (hasCreativeCrate) { - if (missingBlock != null) { - missingBlock = null; + if (missingItem != null) { + missingItem = null; state = State.RUNNING; } } - if (missingBlock == null && !blockNotLoaded) { + if (missingItem == null && !positionNotLoaded) { advanceCurrentPos(); // End reached @@ -387,65 +394,121 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC target = schematicAnchor.add(currentPos); } + boolean entityMode = printingEntityIndex >= 0; + // Check block if (!getWorld().isAreaLoaded(target, 0)) { - blockNotLoaded = true; + positionNotLoaded = true; statusMsg = "targetNotLoaded"; state = State.PAUSED; return; } else { - if (blockNotLoaded) { - blockNotLoaded = false; + if (positionNotLoaded) { + positionNotLoaded = false; state = State.RUNNING; } } - BlockState blockState = blockReader.getBlockState(target); - ItemStack requiredItem = getItemForBlock(blockState); + boolean shouldSkip = false; + BlockState blockState = Blocks.AIR.getDefaultState(); + ItemRequirement requirement; - if (!shouldPlace(target, blockState) || requiredItem.isEmpty()) { + if (entityMode) { + requirement = ItemRequirement.of(blockReader.getEntities().get(printingEntityIndex)); + + } else { + blockState = blockReader.getBlockState(target); + requirement = ItemRequirement.of(blockState); + shouldSkip = !shouldPlace(target, blockState); + } + + if (shouldSkip || requirement.isInvalid()) { statusMsg = "searching"; blockSkipped = true; return; } // Find item - if (blockState.has(BlockStateProperties.SLAB_TYPE) - && blockState.get(BlockStateProperties.SLAB_TYPE) == SlabType.DOUBLE) - requiredItem.setCount(2); + List requiredItems = requirement.getRequiredItems(); + if (!requirement.isEmpty()) { + for (ItemStack required : requiredItems) { + if (!grabItemsFromAttachedInventories(required, requirement.getUsage(), true)) { + if (skipMissing) { + statusMsg = "skipping"; + blockSkipped = true; + if (missingItem != null) { + missingItem = null; + state = State.RUNNING; + } + return; + } - if (!findItemInAttachedInventories(requiredItem)) { - if (skipMissing) { - statusMsg = "skipping"; - blockSkipped = true; - if (missingBlock != null) { - missingBlock = null; - state = State.RUNNING; + missingItem = required; + state = State.PAUSED; + statusMsg = "missingBlock"; + return; } - return; } - missingBlock = blockState; - state = State.PAUSED; - statusMsg = "missingBlock"; - return; + for (ItemStack required : requiredItems) + grabItemsFromAttachedInventories(required, requirement.getUsage(), false); } // Success state = State.RUNNING; - if (blockState.getBlock() != Blocks.AIR) + if (blockState.getBlock() != Blocks.AIR || entityMode) statusMsg = "placing"; else statusMsg = "clearing"; - launchBlock(target, blockState); + + ItemStack icon = requirement.isEmpty() || requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0); + if (entityMode) + launchEntity(target, icon, blockReader.getEntities().get(printingEntityIndex)); + else if (AllBlocks.BELT.typeOf(blockState)) { + TileEntity te = blockReader.getTileEntity(currentPos.add(schematicAnchor)); + blockState = stripBeltIfNotLast(blockState); + if (te instanceof BeltTileEntity && AllBlocks.BELT.typeOf(blockState)) + launchBelt(target, blockState, ((BeltTileEntity) te).beltLength); + else + launchBlock(target, icon, blockState); + } else + launchBlock(target, icon, blockState); + printerCooldown = config().schematicannonDelay.get(); fuelLevel -= getFuelUsageRate(); sendUpdate = true; - missingBlock = null; + missingItem = null; + } + + public BlockState stripBeltIfNotLast(BlockState blockState) { + // is highest belt? + boolean isLastSegment = false; + Direction facing = blockState.get(BeltBlock.HORIZONTAL_FACING); + Slope slope = blockState.get(BeltBlock.SLOPE); + boolean positive = facing.getAxisDirection() == AxisDirection.POSITIVE; + boolean start = blockState.get(BeltBlock.PART) == Part.START; + boolean end = blockState.get(BeltBlock.PART) == Part.END; + + switch (slope) { + case DOWNWARD: + isLastSegment = start; + break; + case UPWARD: + isLastSegment = end; + break; + case HORIZONTAL: + case VERTICAL: + default: + isLastSegment = positive && end || !positive && start; + } + if (!isLastSegment) + blockState = (blockState.get(BeltBlock.PART) == Part.MIDDLE) ? Blocks.AIR.getDefaultState() + : AllBlocks.SHAFT.getDefault().with(ShaftBlock.AXIS, facing.rotateY().getAxis()); + return blockState; } public double getFuelUsageRate() { - return config().schematicannonFuelUsage.get() / 100f; + return hasCreativeCrate ? 0 : config().schematicannonFuelUsage.get() / 100f; } protected void initializePrinter(ItemStack blueprint) { @@ -483,10 +546,12 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC schematicAnchor = anchor; blockReader = new SchematicWorld(schematicAnchor, world); - activeTemplate.addBlocksToWorld(blockReader, schematicAnchor, SchematicItem.getSettings(blueprint)); + PlacementSettings settings = SchematicItem.getSettings(blueprint); + activeTemplate.addBlocksToWorld(blockReader, schematicAnchor, settings); schematicLoaded = true; state = State.PAUSED; statusMsg = "ready"; + printingEntityIndex = -1; updateChecklist(); sendUpdate = true; blocksToPlace += blocksPlaced; @@ -498,44 +563,86 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC return item == Items.AIR ? ItemStack.EMPTY : new ItemStack(item); } - protected boolean findItemInAttachedInventories(ItemStack requiredItem) { + protected boolean grabItemsFromAttachedInventories(ItemStack required, ItemUseType usage, boolean simulate) { if (hasCreativeCrate) return true; - boolean two = requiredItem.getCount() == 2; - int lastSlot = -1; + // Find and apply damage + if (usage == ItemUseType.DAMAGE) { + for (IItemHandler iItemHandler : attachedInventories) { + for (int slot = 0; slot < iItemHandler.getSlots(); slot++) { + ItemStack extractItem = iItemHandler.extractItem(slot, 1, true); + if (!ItemRequirement.validate(required, extractItem)) + continue; + if (!extractItem.isDamageable()) + continue; - for (IItemHandler iItemHandler : attachedInventories) { - for (int slot = 0; slot < iItemHandler.getSlots(); slot++) { - ItemStack stackInSlot = iItemHandler.getStackInSlot(slot); - if (!stackInSlot.isItemEqual(requiredItem)) - continue; - if (!two && !iItemHandler.extractItem(slot, 1, false).isEmpty()) - return true; - - // Two Items required (Double slabs) - if (two) { - int count = iItemHandler.extractItem(slot, 2, true).getCount(); - if (count == 2) { - iItemHandler.extractItem(slot, 2, false); - return true; - } else if (count == 1) { - if (lastSlot == -1) - lastSlot = slot; - else { - iItemHandler.extractItem(lastSlot, 1, false); - iItemHandler.extractItem(slot, 1, false); - return true; + if (!simulate) { + ItemStack stack = iItemHandler.extractItem(slot, 1, false); + stack.setDamage(stack.getDamage() + 1); + if (stack.getDamage() <= stack.getMaxDamage()) { + if (iItemHandler.getStackInSlot(slot).isEmpty()) + iItemHandler.insertItem(slot, stack, false); + else + ItemHandlerHelper.insertItem(iItemHandler, stack, false); } } - } + return true; + } } } - return false; + + // Find and remove + boolean success = false; + if (usage == ItemUseType.CONSUME) { + int amountFound = 0; + for (IItemHandler iItemHandler : attachedInventories) { + + amountFound += ItemHelper + .extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO, + required.getCount(), true) + .getCount(); + + if (amountFound < required.getCount()) + continue; + + success = true; + break; + } + } + + if (!simulate && success) { + int amountFound = 0; + for (IItemHandler iItemHandler : attachedInventories) { + amountFound += ItemHelper + .extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO, + required.getCount(), false) + .getCount(); + if (amountFound < required.getCount()) + continue; + break; + } + } + + return success; } protected void advanceCurrentPos() { + List entities = blockReader.getEntities(); + if (printingEntityIndex != -1) { + printingEntityIndex++; + + // End of entities reached + if (printingEntityIndex >= entities.size()) { + finishedPrinting(); + return; + } + + currentPos = entities.get(printingEntityIndex).getPosition().subtract(schematicAnchor); + return; + } + BlockPos size = blockReader.getBounds().getSize(); currentPos = currentPos.offset(Direction.EAST); BlockPos posInBounds = currentPos.subtract(blockReader.getBounds().getOrigin()); @@ -545,29 +652,40 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC if (posInBounds.getZ() > size.getZ()) currentPos = new BlockPos(currentPos.getX(), currentPos.getY() + 1, blockReader.getBounds().z).west(); - // End reached + // End of blocks reached if (currentPos.getY() > size.getY()) { - inventory.setStackInSlot(0, ItemStack.EMPTY); - inventory.setStackInSlot(1, - new ItemStack(AllItems.EMPTY_BLUEPRINT.get(), inventory.getStackInSlot(1).getCount() + 1)); - state = State.STOPPED; - statusMsg = "finished"; - resetPrinter(); - target = getPos().add(1, 0, 0); - world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), AllSoundEvents.SCHEMATICANNON_FINISH.get(), - SoundCategory.BLOCKS, 1, .7f); - sendUpdate = true; - return; + printingEntityIndex = 0; + if (entities.isEmpty()) { + finishedPrinting(); + return; + } + currentPos = entities.get(0).getPosition().subtract(schematicAnchor); } } + public void finishedPrinting() { + inventory.setStackInSlot(0, ItemStack.EMPTY); + inventory + .setStackInSlot(1, + new ItemStack(AllItems.EMPTY_BLUEPRINT.get(), inventory.getStackInSlot(1).getCount() + 1)); + state = State.STOPPED; + statusMsg = "finished"; + resetPrinter(); + target = getPos().add(1, 0, 0); + world + .playSound(null, pos.getX(), pos.getY(), pos.getZ(), AllSoundEvents.SCHEMATICANNON_FINISH.get(), + SoundCategory.BLOCKS, 1, .7f); + sendUpdate = true; + } + protected void resetPrinter() { schematicLoaded = false; schematicAnchor = null; currentPos = null; blockReader = null; - missingBlock = null; + missingItem = null; sendUpdate = true; + printingEntityIndex = -1; schematicProgress = 0; blocksPlaced = 0; blocksToPlace = 0; @@ -577,6 +695,10 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC BlockState toReplace = world.getBlockState(pos); boolean placingAir = state.getBlock() == Blocks.AIR; + if (!world.isBlockPresent(pos)) + return false; + if (!world.getWorldBorder().contains(pos)) + return false; if (toReplace == state) return false; if (toReplace.getBlockHardness(world, pos) == -1) @@ -622,25 +744,16 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC } protected void tickFlyingBlocks() { - List toRemove = new LinkedList<>(); - for (LaunchedBlock b : flyingBlocks) { - b.update(); - if (b.ticksRemaining <= 0 && !world.isRemote) { - - // Piston - if (b.state.has(BlockStateProperties.EXTENDED)) { - b.state = b.state.with(BlockStateProperties.EXTENDED, false); - } - - world.setBlockState(b.target, b.state, 18); - b.state.getBlock().onBlockPlacedBy(world, b.target, b.state, null, getItemForBlock(b.state)); + List toRemove = new LinkedList<>(); + for (LaunchedItem b : flyingBlocks) + if (b.update(world)) toRemove.add(b); - } - } flyingBlocks.removeAll(toRemove); } protected void refillFuelIfPossible() { + if (hasCreativeCrate) + return; if (1 - fuelLevel + 1 / 128f < getFuelAddedByGunPowder()) return; if (inventory.getStackInSlot(4).isEmpty()) @@ -696,12 +809,30 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC sendUpdate = true; } - protected void launchBlock(BlockPos target, BlockState state) { + protected void launchBelt(BlockPos target, BlockState state, int length) { + blocksPlaced++; + ItemStack connector = AllItems.BELT_CONNECTOR.asStack(); + flyingBlocks.add(new LaunchedItem.ForBelt(this.getPos(), target, connector, state, length)); + playFiringSound(); + } + + protected void launchBlock(BlockPos target, ItemStack stack, BlockState state) { if (state.getBlock() != Blocks.AIR) blocksPlaced++; - flyingBlocks.add(new LaunchedBlock(this, target, state)); - world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), AllSoundEvents.SCHEMATICANNON_LAUNCH_BLOCK.get(), - SoundCategory.BLOCKS, .1f, 1.1f); + flyingBlocks.add(new LaunchedItem.ForBlockState(this.getPos(), target, stack, state)); + playFiringSound(); + } + + protected void launchEntity(BlockPos target, ItemStack stack, Entity entity) { + blocksPlaced++; + flyingBlocks.add(new LaunchedItem.ForEntity(this.getPos(), target, stack, entity)); + playFiringSound(); + } + + public void playFiringSound() { + world + .playSound(null, pos.getX(), pos.getY(), pos.getZ(), AllSoundEvents.SCHEMATICANNON_LAUNCH_BLOCK.get(), + SoundCategory.BLOCKS, .1f, 1.1f); } public void sendToContainer(PacketBuffer buffer) { @@ -721,6 +852,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC public void updateChecklist() { checklist.required.clear(); + checklist.damageRequired.clear(); checklist.blocksNotLoaded = false; if (schematicLoaded) { @@ -734,18 +866,22 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC } if (!shouldPlace(pos.add(schematicAnchor), required)) continue; - ItemStack requiredItem = getItemForBlock(required); - if (requiredItem.isEmpty()) + ItemRequirement requirement = ItemRequirement.of(required); + if (requirement.isEmpty()) continue; - - // Two items for double slabs - if (required.has(BlockStateProperties.SLAB_TYPE) - && required.get(BlockStateProperties.SLAB_TYPE) == SlabType.DOUBLE) - checklist.require(requiredItem.getItem()); - - checklist.require(requiredItem.getItem()); + if (requirement.isInvalid()) + continue; + checklist.require(requirement); blocksToPlace++; } + for (Entity entity : blockReader.getEntities()) { + ItemRequirement requirement = ItemRequirement.of(entity); + if (requirement.isEmpty()) + continue; + if (requirement.isInvalid()) + continue; + checklist.require(requirement); + } } checklist.gathered.clear(); for (IItemHandler inventory : attachedInventories) { @@ -760,9 +896,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC } @Override - public void addBehaviours(List behaviours) { - } - + public void addBehaviours(List behaviours) {} + @Override public void lazyTick() { super.lazyTick(); diff --git a/src/main/java/com/simibubi/create/modules/schematics/client/SchematicAndQuillHandler.java b/src/main/java/com/simibubi/create/modules/schematics/client/SchematicAndQuillHandler.java index c0cec4880..aabb4e709 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/client/SchematicAndQuillHandler.java +++ b/src/main/java/com/simibubi/create/modules/schematics/client/SchematicAndQuillHandler.java @@ -225,7 +225,7 @@ public class SchematicAndQuillHandler { Template t = new Template(); MutableBoundingBox bb = new MutableBoundingBox(firstPos, secondPos); t.takeBlocksFromWorld(Minecraft.getInstance().world, new BlockPos(bb.minX, bb.minY, bb.minZ), - new BlockPos(bb.getXSize(), bb.getYSize(), bb.getZSize()), false, Blocks.AIR); + new BlockPos(bb.getXSize(), bb.getYSize(), bb.getZSize()), true, Blocks.AIR); if (string.isEmpty()) string = Lang.translate("schematicAndQuill.fallbackName"); diff --git a/src/main/java/com/simibubi/create/modules/schematics/item/SchematicItem.java b/src/main/java/com/simibubi/create/modules/schematics/item/SchematicItem.java index c53bc74fa..a7f42a22f 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/item/SchematicItem.java +++ b/src/main/java/com/simibubi/create/modules/schematics/item/SchematicItem.java @@ -17,6 +17,7 @@ import com.simibubi.create.modules.schematics.client.SchematicEditScreen; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; import net.minecraft.nbt.CompoundNBT; @@ -26,6 +27,7 @@ import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.Mirror; +import net.minecraft.util.NonNullList; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; @@ -61,6 +63,9 @@ public class SchematicItem extends Item { return blueprint; } + @Override + public void fillItemGroup(ItemGroup group, NonNullList items) {} + @Override @OnlyIn(value = Dist.CLIENT) public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { diff --git a/src/main/java/com/simibubi/create/modules/schematics/packet/SchematicPlacePacket.java b/src/main/java/com/simibubi/create/modules/schematics/packet/SchematicPlacePacket.java index 82db762ef..a62e6e2f1 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/packet/SchematicPlacePacket.java +++ b/src/main/java/com/simibubi/create/modules/schematics/packet/SchematicPlacePacket.java @@ -9,6 +9,7 @@ import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTUtil; import net.minecraft.network.PacketBuffer; +import net.minecraft.world.gen.feature.template.PlacementSettings; import net.minecraft.world.gen.feature.template.Template; import net.minecraftforge.fml.network.NetworkEvent.Context; @@ -32,8 +33,10 @@ public class SchematicPlacePacket extends SimplePacketBase { context.get().enqueueWork(() -> { ServerPlayerEntity player = context.get().getSender(); Template t = SchematicItem.loadSchematic(stack); + PlacementSettings settings = SchematicItem.getSettings(stack); + settings.setIgnoreEntities(false); t.addBlocksToWorld(player.getServerWorld(), NBTUtil.readBlockPos(stack.getTag().getCompound("Anchor")), - SchematicItem.getSettings(stack)); + settings); }); context.get().setPacketHandled(true); } diff --git a/src/main/resources/assets/create/blockstates/creative_crate.json b/src/main/resources/assets/create/blockstates/creative_crate.json new file mode 100644 index 000000000..e8c3b0338 --- /dev/null +++ b/src/main/resources/assets/create/blockstates/creative_crate.json @@ -0,0 +1,17 @@ +{ + "variants": { + "double=true,facing=up": { "model": "create:block/crate/creative/double_bottom" }, + "double=true,facing=down": { "model": "create:block/crate/creative/double_top" }, + "double=true,facing=west": { "model": "create:block/crate/creative/double_left", "y": 90 }, + "double=true,facing=east": { "model": "create:block/crate/creative/double_right", "y": 90 }, + "double=true,facing=north": { "model": "create:block/crate/creative/double_right" }, + "double=true,facing=south": { "model": "create:block/crate/creative/double_left" }, + + "double=false,facing=up": { "model": "create:block/crate/creative/single" }, + "double=false,facing=down": { "model": "create:block/crate/creative/single" }, + "double=false,facing=west": { "model": "create:block/crate/creative/single" }, + "double=false,facing=east": { "model": "create:block/crate/creative/single" }, + "double=false,facing=north": { "model": "create:block/crate/creative/single" }, + "double=false,facing=south": { "model": "create:block/crate/creative/single" } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/filtered_crate.json b/src/main/resources/assets/create/blockstates/filtered_crate.json new file mode 100644 index 000000000..4a297e253 --- /dev/null +++ b/src/main/resources/assets/create/blockstates/filtered_crate.json @@ -0,0 +1,17 @@ +{ + "variants": { + "double=true,facing=up": { "model": "create:block/crate/copper/double_bottom" }, + "double=true,facing=down": { "model": "create:block/crate/copper/double_top" }, + "double=true,facing=west": { "model": "create:block/crate/copper/double_left", "y": 90 }, + "double=true,facing=east": { "model": "create:block/crate/copper/double_right", "y": 90 }, + "double=true,facing=north": { "model": "create:block/crate/copper/double_right" }, + "double=true,facing=south": { "model": "create:block/crate/copper/double_left" }, + + "double=false,facing=up": { "model": "create:block/crate/copper/single" }, + "double=false,facing=down": { "model": "create:block/crate/copper/single" }, + "double=false,facing=west": { "model": "create:block/crate/copper/single" }, + "double=false,facing=east": { "model": "create:block/crate/copper/single" }, + "double=false,facing=north": { "model": "create:block/crate/copper/single" }, + "double=false,facing=south": { "model": "create:block/crate/copper/single" } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/flexcrate.json b/src/main/resources/assets/create/blockstates/flexcrate.json index cb94c53e6..887558a53 100644 --- a/src/main/resources/assets/create/blockstates/flexcrate.json +++ b/src/main/resources/assets/create/blockstates/flexcrate.json @@ -1,17 +1,17 @@ { "variants": { - "double=true,facing=up": { "model": "create:block/flexcrate/double_bottom" }, - "double=true,facing=down": { "model": "create:block/flexcrate/double_top" }, - "double=true,facing=west": { "model": "create:block/flexcrate/double_left", "y": 90 }, - "double=true,facing=east": { "model": "create:block/flexcrate/double_right", "y": 90 }, - "double=true,facing=north": { "model": "create:block/flexcrate/double_right" }, - "double=true,facing=south": { "model": "create:block/flexcrate/double_left" }, + "double=true,facing=up": { "model": "create:block/crate/brass/double_bottom" }, + "double=true,facing=down": { "model": "create:block/crate/brass/double_top" }, + "double=true,facing=west": { "model": "create:block/crate/brass/double_left", "y": 90 }, + "double=true,facing=east": { "model": "create:block/crate/brass/double_right", "y": 90 }, + "double=true,facing=north": { "model": "create:block/crate/brass/double_right" }, + "double=true,facing=south": { "model": "create:block/crate/brass/double_left" }, - "double=false,facing=up": { "model": "create:block/flexcrate/single" }, - "double=false,facing=down": { "model": "create:block/flexcrate/single" }, - "double=false,facing=west": { "model": "create:block/flexcrate/single" }, - "double=false,facing=east": { "model": "create:block/flexcrate/single" }, - "double=false,facing=north": { "model": "create:block/flexcrate/single" }, - "double=false,facing=south": { "model": "create:block/flexcrate/single" } + "double=false,facing=up": { "model": "create:block/crate/brass/single" }, + "double=false,facing=down": { "model": "create:block/crate/brass/single" }, + "double=false,facing=west": { "model": "create:block/crate/brass/single" }, + "double=false,facing=east": { "model": "create:block/crate/brass/single" }, + "double=false,facing=north": { "model": "create:block/crate/brass/single" }, + "double=false,facing=south": { "model": "create:block/crate/brass/single" } } } \ No newline at end of file diff --git a/src/main/resources/assets/create/blockstates/warehouse_crate.json b/src/main/resources/assets/create/blockstates/warehouse_crate.json new file mode 100644 index 000000000..0d6635db5 --- /dev/null +++ b/src/main/resources/assets/create/blockstates/warehouse_crate.json @@ -0,0 +1,17 @@ +{ + "variants": { + "double=true,facing=up": { "model": "create:block/crate/andesite/double_bottom" }, + "double=true,facing=down": { "model": "create:block/crate/andesite/double_top" }, + "double=true,facing=west": { "model": "create:block/crate/andesite/double_left", "y": 90 }, + "double=true,facing=east": { "model": "create:block/crate/andesite/double_right", "y": 90 }, + "double=true,facing=north": { "model": "create:block/crate/andesite/double_right" }, + "double=true,facing=south": { "model": "create:block/crate/andesite/double_left" }, + + "double=false,facing=up": { "model": "create:block/crate/andesite/single" }, + "double=false,facing=down": { "model": "create:block/crate/andesite/single" }, + "double=false,facing=west": { "model": "create:block/crate/andesite/single" }, + "double=false,facing=east": { "model": "create:block/crate/andesite/single" }, + "double=false,facing=north": { "model": "create:block/crate/andesite/single" }, + "double=false,facing=south": { "model": "create:block/crate/andesite/single" } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/lang/en_us.json b/src/main/resources/assets/create/lang/en_us.json index 566681264..d9bdd07d8 100644 --- a/src/main/resources/assets/create/lang/en_us.json +++ b/src/main/resources/assets/create/lang/en_us.json @@ -132,6 +132,7 @@ "block.create.redstone_bridge": "Redstone Link", "block.create.stockswitch": "Stockpile Switch", "block.create.flexcrate": "Adjustable Crate", + "block.create.creative_crate": "The Endless Crate", "block.create.extractor": "Extractor", "block.create.belt_funnel": "Funnel", "block.create.linked_extractor": "Linked Extractor", @@ -256,7 +257,6 @@ "block.create.schematicannon": "Schematicannon", "block.create.schematic_table": "Schematic Table", - "block.create.creative_crate": "Schematicannon Creatifier", "block.create.cocoa_log": "Cocoa Jungle Log", @@ -272,7 +272,6 @@ "death.attack.create.drill": "%1$s was impaled by Mechanical Drill", "death.attack.create.saw": "%1$s got cut in half by Mechanical Saw", "create.block.deployer.damage_source_name": "a rogue Deployer", - "death.attack.create.curse_polish": "%1$s tried to polish a cursed item", "death.attack.create.cuckoo_clock_explosion": "%1$s was blown up by tampered cuckoo clock", "create.recipe.crushing": "Crushing", @@ -534,11 +533,11 @@ "create.schematicannon.status.paused": "Paused", "create.schematicannon.status.stopped": "Stopped", "create.schematicannon.status.noGunpowder": "Out of Gunpowder", - "create.schematicannon.status.targetNotLoaded": "Block is Not Loaded", - "create.schematicannon.status.targetOutsideRange": "Target too Far Away", + "create.schematicannon.status.targetNotLoaded": "Target is not loaded", + "create.schematicannon.status.targetOutsideRange": "Target too far away", "create.schematicannon.status.searching": "Searching", "create.schematicannon.status.skipping": "Skipping", - "create.schematicannon.status.missingBlock": "Missing Block:", + "create.schematicannon.status.missingBlock": "Missing Item:", "create.schematicannon.status.placing": "Placing", "create.schematicannon.status.clearing": "Clearing Blocks", "create.schematicannon.status.schematicInvalid": "Schematic Invalid", @@ -628,47 +627,91 @@ "create.command.killTPSCommand.status.usage.1": "[Create]: use /killtps start to artificially slow down the server tick", "create.command.killTPSCommand.argument.tickTime": "tickTime", - "advancement.create:root": "In the beginning, let's Create!", - "advancement.create:root.desc": "It's time to start building some amazing Contraptions!", - "advancement.create:andesite_alloy": "Alliterations Aplenty", - "advancement.create:andesite_alloy.desc": "Create's materials have weird names, Andesite Alloy is one of them.", - "advancement.create:andesite_casing": "The Andesite Age ", - "advancement.create:andesite_casing.desc": "Use some Andesite, Meta, and Wood to create a basic Casing.", - "advancement.create:crushing_wheel": "A Pair of Giants", - "advancement.create:crushing_wheel.desc": "Create some Crushing Wheels to break down materials.", - "advancement.create:rotation": "It's Alive!", - "advancement.create:rotation.desc": "Watch your first kinetic component spin.", - "advancement.create:overstressed": "Overstressed", - "advancement.create:overstressed.desc": "Experience the laws of physics firsthand.", - "advancement.create:sand_paper": "Power Polish", - "advancement.create:sand_paper.desc": "Create some Sand Paper to make things pretty.", - "advancement.create:polished_rose_quartz": "Pink Diamonds", - "advancement.create:polished_rose_quartz.desc": "Polish Rose Quartz until you can see through it.", - "advancement.create:sand_paper_secret": "9001 Grit Sand Paper", - "advancement.create:sand_paper_secret.desc": "Use your Sand Paper to sand some Sand Paper.", - "advancement.create:press": "'Bonk!'", - "advancement.create:press.desc": "Make a Mechanical Press and use it to create some Plates.", - "advancement.create:mixer": "Mixin' it Up", - "advancement.create:mixer.desc": "Create a Mechanical Mixer.", - "advancement.create:brass": "An Actual Alloy", - "advancement.create:brass.desc": "Use Copper and Zinc to create some Brass.", - "advancement.create:brass_casing": "The Brass Age", - "advancement.create:brass_casing.desc": "Use newly obtained Brass and some Wood to create a more advanced Casing.", - "advancement.create:deployer": "Poke, Place, and Attack", - "advancement.create:deployer.desc": "Create a Deployer, the perfect reflection of yourself.", - "advancement.create:deployer_secret": "Pound It, Bro!", - "advancement.create:deployer_secret.desc": "Make two Deployers fist-bump.", - "advancement.create:chromatic_compound": "Bipolar Materials", - "advancement.create:chromatic_compound.desc": "Craft a Bar of Chromatic Compound.", - "advancement.create:shadow_steel": "Void Returner", - "advancement.create:shadow_steel.desc": "Create Shadow Steel, a metal bar of nothingness.", - "advancement.create:refined_radiance": "Bright and Inspiring", - "advancement.create:refined_radiance.desc": "Create Refined Radiance, a powerful chromatic substance.", - "advancement.create:refined_radiance_secret": "Forged by the Beam of Light", - "advancement.create:refined_radiance_secret.desc": "Find the alternative way to make Refined Radiance.", - "advancement.create:speed_secret": "Nice ", - "advancement.create:speed_secret.desc": "Watch a Speedometer reach exactly 69 rpm.", + "advancement.create.root": "Welcome to Create", + "advancement.create.root.desc": "It's time to start building some amazing Contraptions!", + "advancement.create.andesite_alloy": "Alliterations Aplenty", + "advancement.create.andesite_alloy.desc": "Create's materials have weird names, Andesite Alloy is one of them.", + "advancement.create.its_alive": "It's Alive!", + "advancement.create.its_alive.desc": "Watch your first kinetic component spin.", + "advancement.create.shifting_gears": "Shifting Gear", + "advancement.create.shifting_gears.desc": "Connect a large to a small cogwheel allowing you to change the speed of your contraption.", + "advancement.create.overstressed": "Overstressed", + "advancement.create.overstressed.desc": "Experience the limits of stress firsthand.", + "advancement.create.belt": "Convey it all", + "advancement.create.belt.desc": "Connect two shafts with a Mechanical Belt.", + "advancement.create.wrench": "Configure Conveniently", + "advancement.create.wrench.desc": "Create a Wrench to aid you in building your contraptions.", + "advancement.create.goggles": "Stress-o-vision", + "advancement.create.goggles.desc": "Create some goggles to aid you in getting more kinetic information for components.", + "advancement.create.speed_gauge": "But how fast exactly?", + "advancement.create.speed_gauge.desc": "Place and power a Speedometer. Look at it through your goggles to read its exact value.", + "advancement.create.stress_gauge": "But how stressed exactly?", + "advancement.create.stress_gauge.desc": "Place and power a Stressometer. Look at it through your goggles to read its exact value.", + + "advancement.create.water_wheel": "Harnessing Hydraulics", + "advancement.create.water_wheel.desc": "Place a Water Wheel and try getting it to spin!", + "advancement.create.lava_wheel": "Magma Wheel", + "advancement.create.lava_wheel.desc": "This shouldn't have worked.", + "advancement.create.millstone": "Pocket Crusher", + "advancement.create.millstone.desc": "Place and power a Millstone", + "advancement.create.andesite_casing": "The Andesite Age", + "advancement.create.andesite_casing.desc": "Use some Andesite Alloy and Wood to create a basic Casing.", + "advancement.create.drill": "Stationary breakers", + "advancement.create.drill.desc": "Place and power a Mechanical Drill", + "advancement.create.press": "Press goes 'Bonk!'", + "advancement.create.press.desc": "Power a Mechanical Press and use it to create some Plates.", + "advancement.create.polished_rose_quartz": "Pink Diamonds", + "advancement.create.polished_rose_quartz.desc": "Use a piece of sand paper to polish Rose Quartz until it becomes transparent.", + "advancement.create.electron_tube": "Beep boop", + "advancement.create.electron_tube.desc": "Make some Electron Tubes, useful in crafting less primitive machinery.", + "advancement.create.saw": "Stationary Chopping", + "advancement.create.saw.desc": "Place and power a Mechanical Saw", + "advancement.create.basin": "Basin Operation", + "advancement.create.basin.desc": "Place a basin and try throwing items into it.", + "advancement.create.mixer": "Mixin' it Up", + "advancement.create.mixer.desc": "Place a Mechanical Mixer above the basin, power it, and start mixing some ingredients.", + "advancement.create.compact": "Automated Compacting", + "advancement.create.compact.desc": "Use a press and a basin to compact some items.", + + "advancement.create.expert_lane_1": "The Andesite Expert Lane", + "advancement.create.expert_lane_1.desc": "Work in Progress", + + "advancement.create.brass": "An Actual Alloy", + "advancement.create.brass.desc": "Use Crushed Copper and Crushed Zinc to create some Brass.", + "advancement.create.brass_casing": "The Brass Age", + "advancement.create.brass_casing.desc": "Use newly obtained Brass and some Wood to create a more advanced Casing.", + "advancement.create.copper_casing": "The Copper Age", + "advancement.create.copper_casing.desc": "Use some copper sheets to create Copper Casing.", + + "advancement.create.crafter": "Automated Assembly", + "advancement.create.crafter.desc": "Place and power some Mechanical Crafters", + "advancement.create.deployer": "Poke, Place, and Attack", + "advancement.create.deployer.desc": "Place and power a Deployer, the perfect reflection of yourself.", + "advancement.create.fist_bump": "Pound It, Bro!", + "advancement.create.fist_bump.desc": "Make two Deployers fist-bump.", + "advancement.create.crushing_wheel": "A Pair of Giants", + "advancement.create.crushing_wheel.desc": "Create some Crushing Wheels to break down more materials more effectively.", + + "advancement.create.chromatic_compound": "Bipolar Minerals", + "advancement.create.chromatic_compound.desc": "Create a Bar of Chromatic Compound.", + "advancement.create.shadow_steel": "Void Returner", + "advancement.create.shadow_steel.desc": "Create Shadow Steel, a metal bar of nothingness.", + "advancement.create.refined_radiance": "Bright and Inspiring", + "advancement.create.refined_radiance.desc": "Create Refined Radiance, a powerful chromatic substance.", + + "advancement.create.zapper": "Building with style", + "advancement.create.zapper.desc": "Craft a Blockzapper. A radiant laser gun that helps you build.", + "advancement.create.upgraded_zapper": "Radiant Overdrive", + "advancement.create.upgraded_zapper.desc": "Create and activate a fully upgraded Blockzapper.", + "advancement.create.symmetry_wand": "Radiant Mirrors", + "advancement.create.symmetry_wand.desc": "Craft a Staff of Symmetry.", + "advancement.create.deforester": "Radiant Chopping", + "advancement.create.deforester.desc": "Craft a Deforester, and say goodbye to the local forest.", + + "advancement.create.eob": "End of Beta", + "advancement.create.eob.desc": "Expect more content here in the future. <3", + "create.subtitle.schematicannon_launch_block": "Schematicannon shoots", "create.subtitle.schematicannon_finish": "Schematicannon finishes", "create.subtitle.slime_added": "Slime squishes", @@ -769,9 +812,6 @@ "item.create.blueprint_and_quill.tooltip.control3": "R-Click while Sneaking", "item.create.blueprint_and_quill.tooltip.action3": "_Resets_ and removes the selection.", - "block.create.creative_crate.tooltip": "CREATIVE CRATE", - "block.create.creative_crate.tooltip.summary": "Provides an endless supply of blocks to adjacent _Schematicannons_.", - "block.create.schematicannon.tooltip": "SCHEMATICANNON", "block.create.schematicannon.tooltip.summary": "Shoots blocks to recreate a deployed _Schematic_ in the World. Uses items from adjacent Inventories and _Gunpowder_ as fuel.", "block.create.schematicannon.tooltip.control1": "When R-Clicked", @@ -1046,6 +1086,11 @@ "block.create.flexcrate.tooltip.summary": "This _Storage_ _Container_ allows Manual control over its capacity. It can hold up to _16_ _Stacks_ of any Item. Supports _Redstone_ _Comparators_.", "block.create.flexcrate.tooltip.control1": "When R-Clicked", "block.create.flexcrate.tooltip.action1": "Opens the _Interface_.", + + "block.create.creative_crate.tooltip": "THE ENDLESS CRATE", + "block.create.creative_crate.tooltip.summary": "This _Storage_ _Container_ allows infinite replication of any item. Place next to a _Schematicannon_ to remove any material requirements.", + "block.create.creative_crate.tooltip.condition1": "When Item in Filter Slot", + "block.create.creative_crate.tooltip.behaviour1": "Anything _extracting_ from this container will provide an _endless_ _supply_ of the item specified. Items _inserted_ into this crate will be _voided._", "block.create.extractor.tooltip": "EXTRACTOR", "block.create.extractor.tooltip.summary": "_Takes_ _Items_ from an attached _Inventory_ and drops them onto the ground. Will not drop Items unless the space is clear. Can be assigned an item-stack as a _filter_.", diff --git a/src/main/resources/assets/create/models/block/crate/andesite/double_bottom.json b/src/main/resources/assets/create/models/block/crate/andesite/double_bottom.json new file mode 100644 index 000000000..1f64b86a4 --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/andesite/double_bottom.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_bottom", + "textures": { + "side": "create:block/crate_andesite_side", + "crate": "create:block/crate_andesite", + "casing": "create:block/andesite_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/andesite/double_left.json b/src/main/resources/assets/create/models/block/crate/andesite/double_left.json new file mode 100644 index 000000000..7e80d3c0f --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/andesite/double_left.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_left", + "textures": { + "side": "create:block/crate_andesite_side", + "crate": "create:block/crate_andesite", + "casing": "create:block/andesite_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/andesite/double_right.json b/src/main/resources/assets/create/models/block/crate/andesite/double_right.json new file mode 100644 index 000000000..ef4e4879b --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/andesite/double_right.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_right", + "textures": { + "side": "create:block/crate_andesite_side", + "crate": "create:block/crate_andesite", + "casing": "create:block/andesite_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/andesite/double_top.json b/src/main/resources/assets/create/models/block/crate/andesite/double_top.json new file mode 100644 index 000000000..1365289d2 --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/andesite/double_top.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_top", + "textures": { + "side": "create:block/crate_andesite_side", + "crate": "create:block/crate_andesite", + "casing": "create:block/andesite_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/andesite/single.json b/src/main/resources/assets/create/models/block/crate/andesite/single.json new file mode 100644 index 000000000..fd13c504e --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/andesite/single.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/single", + "textures": { + "side": "create:block/crate_andesite_side", + "crate": "create:block/crate_andesite", + "casing": "create:block/andesite_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/brass/double_bottom.json b/src/main/resources/assets/create/models/block/crate/brass/double_bottom.json new file mode 100644 index 000000000..17421d454 --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/brass/double_bottom.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_bottom", + "textures": { + "side": "create:block/crate_brass_side", + "crate": "create:block/crate_brass", + "casing": "create:block/brass_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/brass/double_left.json b/src/main/resources/assets/create/models/block/crate/brass/double_left.json new file mode 100644 index 000000000..1bafd8483 --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/brass/double_left.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_left", + "textures": { + "side": "create:block/crate_brass_side", + "crate": "create:block/crate_brass", + "casing": "create:block/brass_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/brass/double_right.json b/src/main/resources/assets/create/models/block/crate/brass/double_right.json new file mode 100644 index 000000000..8a2fae584 --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/brass/double_right.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_right", + "textures": { + "side": "create:block/crate_brass_side", + "crate": "create:block/crate_brass", + "casing": "create:block/brass_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/brass/double_top.json b/src/main/resources/assets/create/models/block/crate/brass/double_top.json new file mode 100644 index 000000000..1f143378e --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/brass/double_top.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_top", + "textures": { + "side": "create:block/crate_brass_side", + "crate": "create:block/crate_brass", + "casing": "create:block/brass_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/brass/single.json b/src/main/resources/assets/create/models/block/crate/brass/single.json new file mode 100644 index 000000000..b1caf4cf2 --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/brass/single.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/single", + "textures": { + "side": "create:block/crate_brass_side", + "crate": "create:block/crate_brass", + "casing": "create:block/brass_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/copper/double_bottom.json b/src/main/resources/assets/create/models/block/crate/copper/double_bottom.json new file mode 100644 index 000000000..8f3c1d55f --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/copper/double_bottom.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_bottom", + "textures": { + "side": "create:block/crate_copper_side", + "crate": "create:block/crate_copper", + "casing": "create:block/copper_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/copper/double_left.json b/src/main/resources/assets/create/models/block/crate/copper/double_left.json new file mode 100644 index 000000000..6cb52e843 --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/copper/double_left.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_left", + "textures": { + "side": "create:block/crate_copper_side", + "crate": "create:block/crate_copper", + "casing": "create:block/copper_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/copper/double_right.json b/src/main/resources/assets/create/models/block/crate/copper/double_right.json new file mode 100644 index 000000000..fc4f8230b --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/copper/double_right.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_right", + "textures": { + "side": "create:block/crate_copper_side", + "crate": "create:block/crate_copper", + "casing": "create:block/copper_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/copper/double_top.json b/src/main/resources/assets/create/models/block/crate/copper/double_top.json new file mode 100644 index 000000000..a1c05fdf4 --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/copper/double_top.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_top", + "textures": { + "side": "create:block/crate_copper_side", + "crate": "create:block/crate_copper", + "casing": "create:block/copper_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/copper/single.json b/src/main/resources/assets/create/models/block/crate/copper/single.json new file mode 100644 index 000000000..9424436d3 --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/copper/single.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/single", + "textures": { + "side": "create:block/crate_copper_side", + "crate": "create:block/crate_copper", + "casing": "create:block/copper_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/creative/double_bottom.json b/src/main/resources/assets/create/models/block/crate/creative/double_bottom.json new file mode 100644 index 000000000..a6a52312c --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/creative/double_bottom.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_bottom", + "textures": { + "side": "create:block/crate_creative_side", + "crate": "create:block/crate_creative", + "casing": "create:block/chorus_chrome_mesh" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/creative/double_left.json b/src/main/resources/assets/create/models/block/crate/creative/double_left.json new file mode 100644 index 000000000..17188e56f --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/creative/double_left.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_left", + "textures": { + "side": "create:block/crate_creative_side", + "crate": "create:block/crate_creative", + "casing": "create:block/chorus_chrome_mesh" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/creative/double_right.json b/src/main/resources/assets/create/models/block/crate/creative/double_right.json new file mode 100644 index 000000000..e23a11c5e --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/creative/double_right.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_right", + "textures": { + "side": "create:block/crate_creative_side", + "crate": "create:block/crate_creative", + "casing": "create:block/chorus_chrome_mesh" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/creative/double_top.json b/src/main/resources/assets/create/models/block/crate/creative/double_top.json new file mode 100644 index 000000000..fe10d5395 --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/creative/double_top.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/double_top", + "textures": { + "side": "create:block/crate_creative_side", + "crate": "create:block/crate_creative", + "casing": "create:block/chorus_chrome_mesh" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/crate/creative/single.json b/src/main/resources/assets/create/models/block/crate/creative/single.json new file mode 100644 index 000000000..bf83bf254 --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/creative/single.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/crate/single", + "textures": { + "side": "create:block/crate_creative_side", + "crate": "create:block/crate_creative", + "casing": "create:block/chorus_chrome_mesh" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/flexcrate/double_bottom.json b/src/main/resources/assets/create/models/block/crate/double_bottom.json similarity index 67% rename from src/main/resources/assets/create/models/block/flexcrate/double_bottom.json rename to src/main/resources/assets/create/models/block/crate/double_bottom.json index 3d3ec3d4e..36ead3ace 100644 --- a/src/main/resources/assets/create/models/block/flexcrate/double_bottom.json +++ b/src/main/resources/assets/create/models/block/crate/double_bottom.json @@ -2,9 +2,9 @@ "credit": "Made with Blockbench", "parent": "block/block", "textures": { - "0": "create:block/double_flexcrate_side", - "3": "create:block/brass_casing_14", - "particle": "create:block/flex_crate" + "0": "#side", + "4": "#crate", + "particle": "#casing" }, "elements": [ { @@ -15,7 +15,7 @@ "east": {"uv": [8.5, 8, 15.5, 16], "texture": "#0"}, "south": {"uv": [8.5, 8, 15.5, 16], "texture": "#0"}, "west": {"uv": [8.5, 8, 15.5, 16], "texture": "#0"}, - "down": {"uv": [1, 1, 15, 15], "rotation": 270, "texture": "#3"} + "down": {"uv": [8.5, 8.5, 15.5, 15.5], "rotation": 270, "texture": "#4"} } } ] diff --git a/src/main/resources/assets/create/models/block/flexcrate/double_left.json b/src/main/resources/assets/create/models/block/crate/double_left.json similarity index 66% rename from src/main/resources/assets/create/models/block/flexcrate/double_left.json rename to src/main/resources/assets/create/models/block/crate/double_left.json index 4055d2672..f1e327587 100644 --- a/src/main/resources/assets/create/models/block/flexcrate/double_left.json +++ b/src/main/resources/assets/create/models/block/crate/double_left.json @@ -2,17 +2,16 @@ "credit": "Made with Blockbench", "parent": "block/block", "textures": { - "0": "create:block/double_flexcrate_side", - "1": "create:block/double_flexcrate_bottom", - "2": "create:block/flex_crate", - "particle": "create:block/flex_crate" + "0": "#side", + "1": "#crate", + "particle": "#casing" }, "elements": [ { "from": [1, 0, 1], "to": [15, 14, 16], "faces": { - "north": {"uv": [1, 1, 15, 15], "texture": "#2"}, + "north": {"uv": [0.5, 8.5, 7.5, 15.5], "texture": "#1"}, "east": {"uv": [8, 0.5, 15.5, 7.5], "texture": "#0"}, "west": {"uv": [0.5, 0.5, 8, 7.5], "texture": "#0"}, "up": {"uv": [0.5, 0.5, 8, 7.5], "rotation": 90, "texture": "#1"}, diff --git a/src/main/resources/assets/create/models/block/flexcrate/double_right.json b/src/main/resources/assets/create/models/block/crate/double_right.json similarity index 66% rename from src/main/resources/assets/create/models/block/flexcrate/double_right.json rename to src/main/resources/assets/create/models/block/crate/double_right.json index 92b457020..8d7a73675 100644 --- a/src/main/resources/assets/create/models/block/flexcrate/double_right.json +++ b/src/main/resources/assets/create/models/block/crate/double_right.json @@ -2,10 +2,9 @@ "credit": "Made with Blockbench", "parent": "block/block", "textures": { - "0": "create:block/double_flexcrate_side", - "1": "create:block/double_flexcrate_bottom", - "2": "create:block/flex_crate", - "particle": "create:block/flex_crate" + "0": "#side", + "1": "#crate", + "particle": "#casing" }, "elements": [ { @@ -13,7 +12,7 @@ "to": [15, 14, 15], "faces": { "east": {"uv": [0.5, 0.5, 8, 7.5], "texture": "#0"}, - "south": {"uv": [1, 1, 15, 15], "texture": "#2"}, + "south": {"uv": [0.5, 8.5, 7.5, 15.5], "texture": "#1"}, "west": {"uv": [8, 0.5, 15.5, 7.5], "texture": "#0"}, "up": {"uv": [8, 0.5, 15.5, 7.5], "rotation": 90, "texture": "#1"}, "down": {"uv": [8, 0.5, 15.5, 7.5], "rotation": 270, "texture": "#1"} diff --git a/src/main/resources/assets/create/models/block/flexcrate/double_top.json b/src/main/resources/assets/create/models/block/crate/double_top.json similarity index 68% rename from src/main/resources/assets/create/models/block/flexcrate/double_top.json rename to src/main/resources/assets/create/models/block/crate/double_top.json index 8defc54ef..ce2106e66 100644 --- a/src/main/resources/assets/create/models/block/flexcrate/double_top.json +++ b/src/main/resources/assets/create/models/block/crate/double_top.json @@ -2,9 +2,9 @@ "credit": "Made with Blockbench", "parent": "block/block", "textures": { - "0": "create:block/double_flexcrate_side", - "3": "create:block/brass_casing_14", - "particle": "create:block/flex_crate" + "0": "#side", + "2": "#crate", + "particle": "#casing" }, "elements": [ { @@ -15,7 +15,7 @@ "east": {"uv": [0.5, 8.5, 7.5, 15.5], "texture": "#0"}, "south": {"uv": [0.5, 8.5, 7.5, 15.5], "texture": "#0"}, "west": {"uv": [0.5, 8.5, 7.5, 15.5], "texture": "#0"}, - "up": {"uv": [1, 1, 15, 15], "rotation": 90, "texture": "#3"} + "up": {"uv": [8.5, 8.5, 15.5, 15.5], "rotation": 90, "texture": "#2"} } } ] diff --git a/src/main/resources/assets/create/models/block/crate/single.json b/src/main/resources/assets/create/models/block/crate/single.json new file mode 100644 index 000000000..acc71e720 --- /dev/null +++ b/src/main/resources/assets/create/models/block/crate/single.json @@ -0,0 +1,23 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "2": "#crate", + "particle": "#casing" + }, + "elements": [ + { + "name": "Crate", + "from": [1, 0, 1], + "to": [15, 14, 15], + "faces": { + "north": {"uv": [0.5, 8.5, 7.5, 15.5], "texture": "#2"}, + "east": {"uv": [0.5, 8.5, 7.5, 15.5], "texture": "#2"}, + "south": {"uv": [0.5, 8.5, 7.5, 15.5], "texture": "#2"}, + "west": {"uv": [0.5, 8.5, 7.5, 15.5], "texture": "#2"}, + "up": {"uv": [8.5, 8.5, 15.5, 15.5], "texture": "#2"}, + "down": {"uv": [8.5, 8.5, 15.5, 15.5], "texture": "#2"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/flexcrate/single.json b/src/main/resources/assets/create/models/block/flexcrate/single.json deleted file mode 100644 index c397bfad0..000000000 --- a/src/main/resources/assets/create/models/block/flexcrate/single.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "parent": "block/block", - "textures": { - "particle": "create:block/flex_crate", - "side": "create:block/flex_crate", - "top": "create:block/brass_casing_14" - }, - "elements": [ - { - "name": "Crate", - "from": [ 1, 0, 1 ], - "to": [ 15, 14, 15 ], - "faces": { - "north": { "texture": "#side", "uv": [ 1, 1, 15, 15 ] }, - "east": { "texture": "#side", "uv": [ 1, 1, 15, 15 ] }, - "south": { "texture": "#side", "uv": [ 1, 1, 15, 15 ] }, - "west": { "texture": "#side", "uv": [ 1, 1, 15, 15 ] }, - "up": { "texture": "#top", "uv": [ 1, 1, 15, 15 ] }, - "down": { "texture": "#top", "uv": [ 1, 1, 15, 15 ] } - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/creative_crate.json b/src/main/resources/assets/create/models/item/creative_crate.json index 5cea86295..b206b9358 100644 --- a/src/main/resources/assets/create/models/item/creative_crate.json +++ b/src/main/resources/assets/create/models/item/creative_crate.json @@ -1,3 +1,3 @@ { - "parent": "create:block/creative_crate" + "parent": "create:block/crate/creative/single" } \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/filtered_crate.json b/src/main/resources/assets/create/models/item/filtered_crate.json new file mode 100644 index 000000000..9478a7f23 --- /dev/null +++ b/src/main/resources/assets/create/models/item/filtered_crate.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/crate/copper/single" +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/flexcrate.json b/src/main/resources/assets/create/models/item/flexcrate.json index 90610cbde..2f1d31d32 100644 --- a/src/main/resources/assets/create/models/item/flexcrate.json +++ b/src/main/resources/assets/create/models/item/flexcrate.json @@ -1,3 +1,3 @@ { - "parent": "create:block/flexcrate/single" + "parent": "create:block/crate/brass/single" } \ No newline at end of file diff --git a/src/main/resources/assets/create/models/item/warehouse_crate.json b/src/main/resources/assets/create/models/item/warehouse_crate.json new file mode 100644 index 000000000..20c00f2c1 --- /dev/null +++ b/src/main/resources/assets/create/models/item/warehouse_crate.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/crate/andesite/single" +} \ No newline at end of file diff --git a/src/main/resources/assets/create/textures/block/brass_casing_14.png b/src/main/resources/assets/create/textures/block/brass_casing_14.png deleted file mode 100644 index 3f5d6ab98..000000000 Binary files a/src/main/resources/assets/create/textures/block/brass_casing_14.png and /dev/null differ diff --git a/src/main/resources/assets/create/textures/block/crate_andesite.png b/src/main/resources/assets/create/textures/block/crate_andesite.png new file mode 100644 index 000000000..666894277 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/crate_andesite.png differ diff --git a/src/main/resources/assets/create/textures/block/crate_andesite_side.png b/src/main/resources/assets/create/textures/block/crate_andesite_side.png new file mode 100644 index 000000000..b0b2a96bb Binary files /dev/null and b/src/main/resources/assets/create/textures/block/crate_andesite_side.png differ diff --git a/src/main/resources/assets/create/textures/block/crate_brass.png b/src/main/resources/assets/create/textures/block/crate_brass.png new file mode 100644 index 000000000..23309fb6f Binary files /dev/null and b/src/main/resources/assets/create/textures/block/crate_brass.png differ diff --git a/src/main/resources/assets/create/textures/block/crate_brass_side.png b/src/main/resources/assets/create/textures/block/crate_brass_side.png new file mode 100644 index 000000000..abe67bd3c Binary files /dev/null and b/src/main/resources/assets/create/textures/block/crate_brass_side.png differ diff --git a/src/main/resources/assets/create/textures/block/crate_copper.png b/src/main/resources/assets/create/textures/block/crate_copper.png new file mode 100644 index 000000000..291bafc0e Binary files /dev/null and b/src/main/resources/assets/create/textures/block/crate_copper.png differ diff --git a/src/main/resources/assets/create/textures/block/crate_copper_side.png b/src/main/resources/assets/create/textures/block/crate_copper_side.png new file mode 100644 index 000000000..8977a997a Binary files /dev/null and b/src/main/resources/assets/create/textures/block/crate_copper_side.png differ diff --git a/src/main/resources/assets/create/textures/block/crate_creative.png b/src/main/resources/assets/create/textures/block/crate_creative.png new file mode 100644 index 000000000..18803da26 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/crate_creative.png differ diff --git a/src/main/resources/assets/create/textures/block/crate_creative_side.png b/src/main/resources/assets/create/textures/block/crate_creative_side.png new file mode 100644 index 000000000..ba4103477 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/crate_creative_side.png differ diff --git a/src/main/resources/assets/create/textures/block/creative_crate_side.png b/src/main/resources/assets/create/textures/block/creative_crate_side.png deleted file mode 100644 index b5273f68d..000000000 Binary files a/src/main/resources/assets/create/textures/block/creative_crate_side.png and /dev/null differ diff --git a/src/main/resources/assets/create/textures/block/creative_crate_top.png b/src/main/resources/assets/create/textures/block/creative_crate_top.png deleted file mode 100644 index 525326b71..000000000 Binary files a/src/main/resources/assets/create/textures/block/creative_crate_top.png and /dev/null differ diff --git a/src/main/resources/assets/create/textures/block/double_flexcrate_bottom.png b/src/main/resources/assets/create/textures/block/double_flexcrate_bottom.png deleted file mode 100644 index 9b95e424b..000000000 Binary files a/src/main/resources/assets/create/textures/block/double_flexcrate_bottom.png and /dev/null differ diff --git a/src/main/resources/assets/create/textures/block/double_flexcrate_side.png b/src/main/resources/assets/create/textures/block/double_flexcrate_side.png deleted file mode 100644 index 0a8096235..000000000 Binary files a/src/main/resources/assets/create/textures/block/double_flexcrate_side.png and /dev/null differ diff --git a/src/main/resources/assets/create/textures/block/flex_crate.png b/src/main/resources/assets/create/textures/block/flex_crate.png deleted file mode 100644 index 27e78bb33..000000000 Binary files a/src/main/resources/assets/create/textures/block/flex_crate.png and /dev/null differ diff --git a/src/main/resources/assets/create/textures/gui/schematicannon.png b/src/main/resources/assets/create/textures/gui/schematicannon.png index 8a54fcfdf..cb838679c 100644 Binary files a/src/main/resources/assets/create/textures/gui/schematicannon.png and b/src/main/resources/assets/create/textures/gui/schematicannon.png differ diff --git a/src/main/resources/assets/create/textures/item/belt.png b/src/main/resources/assets/create/textures/item/belt.png index 772436f7e..483638b3a 100644 Binary files a/src/main/resources/assets/create/textures/item/belt.png and b/src/main/resources/assets/create/textures/item/belt.png differ diff --git a/src/main/resources/assets/create/textures/item/brass_ingot.png b/src/main/resources/assets/create/textures/item/brass_ingot.png index c7c3ab97f..ea33f846b 100644 Binary files a/src/main/resources/assets/create/textures/item/brass_ingot.png and b/src/main/resources/assets/create/textures/item/brass_ingot.png differ diff --git a/src/main/resources/data/create/advancements/andesite_alloy.json b/src/main/resources/data/create/advancements/andesite_alloy.json index 82a8a22b1..044362e9c 100644 --- a/src/main/resources/data/create/advancements/andesite_alloy.json +++ b/src/main/resources/data/create/advancements/andesite_alloy.json @@ -1,30 +1,35 @@ { - "display": { - "title": { - "translate": "advancement.create:andesite_alloy" - }, - "description": { - "translate": "advancement.create:andesite_alloy.desc" - }, - "icon": { + "parent": "create:root", + "display": { + "icon": { + "item": "create:andesite_alloy" + }, + "title": { + "translate": "advancement.create.andesite_alloy" + }, + "description": { + "translate": "advancement.create.andesite_alloy.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { "item": "create:andesite_alloy" - }, - "frame": "task", - "show_toast": true, - "announce_to_chat": false, - "hidden": true - }, - "criteria": { - "alloy": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "item": "create:andesite_alloy" - } - ] - } - } - }, - "parent": "create:root" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] } \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/andesite_casing.json b/src/main/resources/data/create/advancements/andesite_casing.json index 0d2396e9f..a0b4a7b9a 100644 --- a/src/main/resources/data/create/advancements/andesite_casing.json +++ b/src/main/resources/data/create/advancements/andesite_casing.json @@ -1,30 +1,35 @@ { - "display": { - "title": { - "translate": "advancement.create:andesite_casing" - }, - "description": { - "translate": "advancement.create:andesite_casing.desc" - }, - "icon": { + "parent": "create:andesite_alloy", + "display": { + "icon": { + "item": "create:andesite_casing" + }, + "title": { + "translate": "advancement.create.andesite_casing" + }, + "description": { + "translate": "advancement.create.andesite_casing.desc" + }, + "frame": "goal", + "show_toast": true, + "announce_to_chat": true, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { "item": "create:andesite_casing" - }, - "frame": "task", - "show_toast": true, - "announce_to_chat": false, - "hidden": false - }, - "criteria": { - "casing": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "item": "create:andesite_casing" - } - ] - } - } - }, - "parent": "create:andesite_alloy" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] } \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/basin.json b/src/main/resources/data/create/advancements/basin.json new file mode 100644 index 000000000..8d31e5f81 --- /dev/null +++ b/src/main/resources/data/create/advancements/basin.json @@ -0,0 +1,37 @@ +{ + "parent": "create:press", + "display": { + "icon": { + "item": "create:basin" + }, + "title": { + "translate": "advancement.create.basin" + }, + "description": { + "translate": "advancement.create.basin.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:placed_block", + "conditions": { + "block": "create:basin" + } + }, + "1": { + "trigger": "create:basin" + } + }, + "requirements": [ + [ + "0" + ], + [ + "1" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/belt.json b/src/main/resources/data/create/advancements/belt.json new file mode 100644 index 000000000..a19fd4674 --- /dev/null +++ b/src/main/resources/data/create/advancements/belt.json @@ -0,0 +1,28 @@ +{ + "parent": "create:its_alive", + "display": { + "icon": { + "item": "create:belt_connector" + }, + "title": { + "translate": "advancement.create.belt" + }, + "description": { + "translate": "advancement.create.belt.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "create:connect_belt" + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/brass.json b/src/main/resources/data/create/advancements/brass.json index b43592d94..105ed5831 100644 --- a/src/main/resources/data/create/advancements/brass.json +++ b/src/main/resources/data/create/advancements/brass.json @@ -1,31 +1,35 @@ { - "display": { - "title": { - "translate": "advancement.create:brass", - "color": "gold" - }, - "description": { - "translate": "advancement.create:brass.desc" - }, - "icon": { - "item": "create:crushed_brass" - }, - "frame": "task", - "show_toast": true, - "announce_to_chat": false, - "hidden": false + "parent": "create:mixer", + "display": { + "icon": { + "item": "create:brass_ingot" }, - "criteria": { - "brass": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "item": "create:crushed_brass" - } - ] - } - } + "title": { + "translate": "advancement.create.brass" }, - "parent": "create:mechanical_mixer" + "description": { + "translate": "advancement.create.brass.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "create:brass_ingot" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] } \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/brass_casing.json b/src/main/resources/data/create/advancements/brass_casing.json index a91749db6..f3161f63e 100644 --- a/src/main/resources/data/create/advancements/brass_casing.json +++ b/src/main/resources/data/create/advancements/brass_casing.json @@ -1,30 +1,35 @@ { - "display": { - "title": { - "translate": "advancement.create:brass_casing" - }, - "description": { - "translate": "advancement.create:brass_casing.desc" - }, - "icon": { + "parent": "create:brass", + "display": { + "icon": { + "item": "create:brass_casing" + }, + "title": { + "translate": "advancement.create.brass_casing" + }, + "description": { + "translate": "advancement.create.brass_casing.desc" + }, + "frame": "goal", + "show_toast": true, + "announce_to_chat": true, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { "item": "create:brass_casing" - }, - "frame": "task", - "show_toast": true, - "announce_to_chat": false, - "hidden": false - }, - "criteria": { - "casing": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "item": "create:brass_casing" - } - ] - } - } - }, - "parent": "create:brass" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] } \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/chromatic_compound.json b/src/main/resources/data/create/advancements/chromatic_compound.json index 65e496c4d..6091139ea 100644 --- a/src/main/resources/data/create/advancements/chromatic_compound.json +++ b/src/main/resources/data/create/advancements/chromatic_compound.json @@ -1,31 +1,35 @@ { - "display": { - "title": { - "translate": "advancement.create:chromatic_compound", - "color": "dark_purple" - }, - "description": { - "translate": "advancement.create:chromatic_compound.desc" - }, - "icon": { + "parent": "create:crushing_wheel", + "display": { + "icon": { + "item": "create:chromatic_compound" + }, + "title": { + "translate": "advancement.create.chromatic_compound" + }, + "description": { + "translate": "advancement.create.chromatic_compound.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { "item": "create:chromatic_compound" - }, - "frame": "task", - "show_toast": true, - "announce_to_chat": false, - "hidden": false - }, - "criteria": { - "alloy": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "item": "create:chromatic_compound" - } - ] - } - } - }, - "parent": "create:mechanical_mixer" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] } \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/compact.json b/src/main/resources/data/create/advancements/compact.json new file mode 100644 index 000000000..e83071815 --- /dev/null +++ b/src/main/resources/data/create/advancements/compact.json @@ -0,0 +1,28 @@ +{ + "parent": "create:basin", + "display": { + "icon": { + "item": "minecraft:iron_block" + }, + "title": { + "translate": "advancement.create.compact" + }, + "description": { + "translate": "advancement.create.compact.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "create:compact" + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/copper_casing.json b/src/main/resources/data/create/advancements/copper_casing.json new file mode 100644 index 000000000..bbe9ce860 --- /dev/null +++ b/src/main/resources/data/create/advancements/copper_casing.json @@ -0,0 +1,35 @@ +{ + "parent": "create:press", + "display": { + "icon": { + "item": "create:copper_casing" + }, + "title": { + "translate": "advancement.create.copper_casing" + }, + "description": { + "translate": "advancement.create.copper_casing.desc" + }, + "frame": "goal", + "show_toast": true, + "announce_to_chat": true, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "create:copper_casing" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/copper_end.json b/src/main/resources/data/create/advancements/copper_end.json new file mode 100644 index 000000000..26aadef85 --- /dev/null +++ b/src/main/resources/data/create/advancements/copper_end.json @@ -0,0 +1,35 @@ +{ + "parent": "create:copper_casing", + "display": { + "icon": { + "item": "minecraft:oak_sapling" + }, + "title": { + "translate": "advancement.create.eob" + }, + "description": { + "translate": "advancement.create.eob.desc" + }, + "frame": "challenge", + "show_toast": false, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "create:copper_casing" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/crafter.json b/src/main/resources/data/create/advancements/crafter.json new file mode 100644 index 000000000..24ef66ee9 --- /dev/null +++ b/src/main/resources/data/create/advancements/crafter.json @@ -0,0 +1,40 @@ +{ + "parent": "create:brass_casing", + "display": { + "icon": { + "item": "create:mechanical_crafter" + }, + "title": { + "translate": "advancement.create.crafter" + }, + "description": { + "translate": "advancement.create.crafter.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": true, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:placed_block", + "conditions": { + "block": "create:mechanical_crafter" + } + }, + "1": { + "trigger": "create:kinetic_block", + "conditions": { + "block": "create:mechanical_crafter" + } + } + }, + "requirements": [ + [ + "0" + ], + [ + "1" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/crushing_wheel.json b/src/main/resources/data/create/advancements/crushing_wheel.json index 26af94ec9..5660cae98 100644 --- a/src/main/resources/data/create/advancements/crushing_wheel.json +++ b/src/main/resources/data/create/advancements/crushing_wheel.json @@ -1,34 +1,35 @@ { - "display": { - "title": { - "translate": "advancement.create:crushing_wheel" - }, - "description": { - "translate": "advancement.create:crushing_wheel.desc" - }, - "icon": { + "parent": "create:crafter", + "display": { + "icon": { + "item": "create:crushing_wheel" + }, + "title": { + "translate": "advancement.create.crushing_wheel" + }, + "description": { + "translate": "advancement.create.crushing_wheel.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": true, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { "item": "create:crushing_wheel" - }, - "frame": "task", - "show_toast": true, - "announce_to_chat": false, - "hidden": false - }, - "criteria": { - "crushers": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "item": "create:crushing_wheel", - "count": { - "min": 2, - "max": 64 - } - } - ] - } - } - }, - "parent": "create:andesite_alloy" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] } \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/deforester.json b/src/main/resources/data/create/advancements/deforester.json new file mode 100644 index 000000000..55f8d4606 --- /dev/null +++ b/src/main/resources/data/create/advancements/deforester.json @@ -0,0 +1,35 @@ +{ + "parent": "create:refined_radiance", + "display": { + "icon": { + "item": "create:deforester" + }, + "title": { + "translate": "advancement.create.deforester" + }, + "description": { + "translate": "advancement.create.deforester.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "create:deforester" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/deployer.json b/src/main/resources/data/create/advancements/deployer.json index 88169d3a7..44b4cf6e6 100644 --- a/src/main/resources/data/create/advancements/deployer.json +++ b/src/main/resources/data/create/advancements/deployer.json @@ -1,30 +1,40 @@ { - "display": { - "title": { - "translate": "advancement.create:deployer" - }, - "description": { - "translate": "advancement.create:deployer.desc" - }, - "icon": { - "item": "create:deployer" - }, - "frame": "task", - "show_toast": true, - "announce_to_chat": false, - "hidden": false + "parent": "create:brass_casing", + "display": { + "icon": { + "item": "create:deployer" }, - "criteria": { - "deployer": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "item": "create:deployer" - } - ] - } - } + "title": { + "translate": "advancement.create.deployer" }, - "parent": "create:brass" + "description": { + "translate": "advancement.create.deployer.desc" + }, + "frame": "goal", + "show_toast": true, + "announce_to_chat": true, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:placed_block", + "conditions": { + "block": "create:deployer" + } + }, + "1": { + "trigger": "create:kinetic_block", + "conditions": { + "block": "create:deployer" + } + } + }, + "requirements": [ + [ + "0" + ], + [ + "1" + ] + ] } \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/deployer_secret.json b/src/main/resources/data/create/advancements/deployer_secret.json deleted file mode 100644 index b87806234..000000000 --- a/src/main/resources/data/create/advancements/deployer_secret.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "display": { - "title": { - "translate": "advancement.create:deployer_secret" - }, - "description": { - "translate": "advancement.create:deployer_secret.desc" - }, - "icon": { - "item": "create:deployer" - }, - "frame": "goal", - "show_toast": true, - "announce_to_chat": true, - "hidden": true - }, - "criteria": { - "touching": { - "trigger": "create:deployer" - } - }, - "parent": "create:deployer" -} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/drill.json b/src/main/resources/data/create/advancements/drill.json new file mode 100644 index 000000000..efae45af5 --- /dev/null +++ b/src/main/resources/data/create/advancements/drill.json @@ -0,0 +1,40 @@ +{ + "parent": "create:andesite_casing", + "display": { + "icon": { + "item": "create:drill" + }, + "title": { + "translate": "advancement.create.drill" + }, + "description": { + "translate": "advancement.create.drill.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:placed_block", + "conditions": { + "block": "create:drill" + } + }, + "1": { + "trigger": "create:kinetic_block", + "conditions": { + "block": "create:drill" + } + } + }, + "requirements": [ + [ + "0" + ], + [ + "1" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/electron_tube.json b/src/main/resources/data/create/advancements/electron_tube.json new file mode 100644 index 000000000..6070eb238 --- /dev/null +++ b/src/main/resources/data/create/advancements/electron_tube.json @@ -0,0 +1,35 @@ +{ + "parent": "create:polished_rose_quartz", + "display": { + "icon": { + "item": "create:electron_tube" + }, + "title": { + "translate": "advancement.create.electron_tube" + }, + "description": { + "translate": "advancement.create.electron_tube.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "create:electron_tube" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/fist_bump.json b/src/main/resources/data/create/advancements/fist_bump.json new file mode 100644 index 000000000..0e5b04869 --- /dev/null +++ b/src/main/resources/data/create/advancements/fist_bump.json @@ -0,0 +1,28 @@ +{ + "parent": "create:deployer", + "display": { + "icon": { + "item": "create:deployer" + }, + "title": { + "translate": "advancement.create.fist_bump" + }, + "description": { + "translate": "advancement.create.fist_bump.desc" + }, + "frame": "goal", + "show_toast": true, + "announce_to_chat": true, + "hidden": true + }, + "criteria": { + "0": { + "trigger": "create:deployer" + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/goggles.json b/src/main/resources/data/create/advancements/goggles.json new file mode 100644 index 000000000..e4c06682c --- /dev/null +++ b/src/main/resources/data/create/advancements/goggles.json @@ -0,0 +1,35 @@ +{ + "parent": "create:its_alive", + "display": { + "icon": { + "item": "create:goggles" + }, + "title": { + "translate": "advancement.create.goggles" + }, + "description": { + "translate": "advancement.create.goggles.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "create:goggles" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/its_alive.json b/src/main/resources/data/create/advancements/its_alive.json new file mode 100644 index 000000000..b826055f1 --- /dev/null +++ b/src/main/resources/data/create/advancements/its_alive.json @@ -0,0 +1,28 @@ +{ + "parent": "create:andesite_alloy", + "display": { + "icon": { + "item": "create:cogwheel" + }, + "title": { + "translate": "advancement.create.its_alive" + }, + "description": { + "translate": "advancement.create.its_alive.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "create:rotation" + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/lava_wheel.json b/src/main/resources/data/create/advancements/lava_wheel.json new file mode 100644 index 000000000..16aff1ad9 --- /dev/null +++ b/src/main/resources/data/create/advancements/lava_wheel.json @@ -0,0 +1,28 @@ +{ + "parent": "create:water_wheel", + "display": { + "icon": { + "item": "minecraft:lava_bucket" + }, + "title": { + "translate": "advancement.create.lava_wheel" + }, + "description": { + "translate": "advancement.create.lava_wheel.desc" + }, + "frame": "goal", + "show_toast": true, + "announce_to_chat": true, + "hidden": true + }, + "criteria": { + "0": { + "trigger": "create:lava_wheel" + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/mechanical_mixer.json b/src/main/resources/data/create/advancements/mechanical_mixer.json deleted file mode 100644 index 8c633569e..000000000 --- a/src/main/resources/data/create/advancements/mechanical_mixer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "display": { - "title": { - "translate": "advancement.create:mixer" - }, - "description": { - "translate": "advancement.create:mixer.desc" - }, - "icon": { - "item": "create:mechanical_mixer" - }, - "frame": "task", - "show_toast": true, - "announce_to_chat": false, - "hidden": false - }, - "criteria": { - "mixer": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "item": "create:mechanical_mixer" - } - ] - } - } - }, - "parent": "create:mechanical_press" -} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/mechanical_press.json b/src/main/resources/data/create/advancements/mechanical_press.json deleted file mode 100644 index aff99de88..000000000 --- a/src/main/resources/data/create/advancements/mechanical_press.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "display": { - "title": { - "translate": "advancement.create:press" - }, - "description": { - "translate": "advancement.create:press.desc" - }, - "icon": { - "item": "create:mechanical_press" - }, - "frame": "goal", - "show_toast": true, - "announce_to_chat": true, - "hidden": false - }, - "criteria": { - "press": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "item": "create:mechanical_press" - } - ] - } - }, - "plate": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "tag": "forge:plates" - } - ] - } - } - }, - "requirements": [ - [ - "press" - ], - [ - "plate" - ] - ], - "parent": "create:andesite_casing" -} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/millstone.json b/src/main/resources/data/create/advancements/millstone.json new file mode 100644 index 000000000..eaca3ad04 --- /dev/null +++ b/src/main/resources/data/create/advancements/millstone.json @@ -0,0 +1,40 @@ +{ + "parent": "create:andesite_alloy", + "display": { + "icon": { + "item": "create:millstone" + }, + "title": { + "translate": "advancement.create.millstone" + }, + "description": { + "translate": "advancement.create.millstone.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:placed_block", + "conditions": { + "block": "create:millstone" + } + }, + "1": { + "trigger": "create:kinetic_block", + "conditions": { + "block": "create:millstone" + } + } + }, + "requirements": [ + [ + "0" + ], + [ + "1" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/mixer.json b/src/main/resources/data/create/advancements/mixer.json new file mode 100644 index 000000000..5988c6b10 --- /dev/null +++ b/src/main/resources/data/create/advancements/mixer.json @@ -0,0 +1,46 @@ +{ + "parent": "create:basin", + "display": { + "icon": { + "item": "create:mechanical_mixer" + }, + "title": { + "translate": "advancement.create.mixer" + }, + "description": { + "translate": "advancement.create.mixer.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": true, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:placed_block", + "conditions": { + "block": "create:mechanical_mixer" + } + }, + "1": { + "trigger": "create:kinetic_block", + "conditions": { + "block": "create:mechanical_mixer" + } + }, + "2": { + "trigger": "create:mixer" + } + }, + "requirements": [ + [ + "0" + ], + [ + "1" + ], + [ + "2" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/overstressed.json b/src/main/resources/data/create/advancements/overstressed.json index 614d5d50c..54dc44251 100644 --- a/src/main/resources/data/create/advancements/overstressed.json +++ b/src/main/resources/data/create/advancements/overstressed.json @@ -1,24 +1,28 @@ { - "display": { - "title": { - "translate": "advancement.create:overstressed", - "color": "red" - }, - "description": { - "translate": "advancement.create:overstressed.desc" - }, - "icon": { - "item": "minecraft:barrier" - }, - "frame": "task", - "show_toast": true, - "announce_to_chat": false, - "hidden": true + "parent": "create:its_alive", + "display": { + "icon": { + "item": "minecraft:barrier" }, - "criteria": { - "alloy": { - "trigger": "create:overstressed" - } + "title": { + "translate": "advancement.create.overstressed" }, - "parent": "create:rotation" + "description": { + "translate": "advancement.create.overstressed.desc" + }, + "frame": "goal", + "show_toast": true, + "announce_to_chat": true, + "hidden": true + }, + "criteria": { + "0": { + "trigger": "create:overstressed" + } + }, + "requirements": [ + [ + "0" + ] + ] } \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/polished_rose_quartz.json b/src/main/resources/data/create/advancements/polished_rose_quartz.json index 1684697b4..b1decb17f 100644 --- a/src/main/resources/data/create/advancements/polished_rose_quartz.json +++ b/src/main/resources/data/create/advancements/polished_rose_quartz.json @@ -1,32 +1,35 @@ { - "display": { - "title": { - "translate": "advancement.create:polished_rose_quartz", - "color": "red" - }, - "description": { - "translate": "advancement.create:polished_rose_quartz.desc" - }, - "icon": { + "parent": "create:andesite_casing", + "display": { + "icon": { + "item": "create:polished_rose_quartz" + }, + "title": { + "translate": "advancement.create.polished_rose_quartz" + }, + "description": { + "translate": "advancement.create.polished_rose_quartz.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { "item": "create:polished_rose_quartz" - }, - "frame": "task", - "show_toast": true, - "announce_to_chat": false, - "hidden": true - }, - "criteria": { - "quartz": { - "trigger": "create:sandpaper_use", - "conditions": { - "target": { - "item": "create:rose_quartz" - }, - "result": { - "item": "create:polished_rose_quartz" - } - } - } - }, - "parent": "create:sand_paper" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] } \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/press.json b/src/main/resources/data/create/advancements/press.json new file mode 100644 index 000000000..500a857a2 --- /dev/null +++ b/src/main/resources/data/create/advancements/press.json @@ -0,0 +1,28 @@ +{ + "parent": "create:andesite_casing", + "display": { + "icon": { + "item": "create:mechanical_press" + }, + "title": { + "translate": "advancement.create.press" + }, + "description": { + "translate": "advancement.create.press.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": true, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "create:bonk" + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/refined_radiance.json b/src/main/resources/data/create/advancements/refined_radiance.json index 6b3a5adfe..ade3d9379 100644 --- a/src/main/resources/data/create/advancements/refined_radiance.json +++ b/src/main/resources/data/create/advancements/refined_radiance.json @@ -1,31 +1,35 @@ { - "display": { - "title": { - "translate": "advancement.create:refined_radiance", - "color": "white" - }, - "description": { - "translate": "advancement.create:refined_radiance.desc" - }, - "icon": { + "parent": "create:chromatic_compound", + "display": { + "icon": { + "item": "create:refined_radiance" + }, + "title": { + "translate": "advancement.create.refined_radiance" + }, + "description": { + "translate": "advancement.create.refined_radiance.desc" + }, + "frame": "goal", + "show_toast": true, + "announce_to_chat": true, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { "item": "create:refined_radiance" - }, - "frame": "goal", - "show_toast": true, - "announce_to_chat": true, - "hidden": false - }, - "criteria": { - "radiance": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "item": "create:refined_radiance" - } - ] - } - } - }, - "parent": "create:chromatic_compound" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] } \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/refined_radiance_secret.json b/src/main/resources/data/create/advancements/refined_radiance_secret.json deleted file mode 100644 index 02272aa91..000000000 --- a/src/main/resources/data/create/advancements/refined_radiance_secret.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "display": { - "title": { - "translate": "advancement.create:refined_radiance_secret", - "color": "white" - }, - "description": { - "translate": "advancement.create:refined_radiance_secret.desc" - }, - "icon": { - "item": "create:refined_radiance" - }, - "frame": "challenge", - "show_toast": true, - "announce_to_chat": true, - "hidden": true - }, - "criteria": { - "ritual": { - "trigger": "create:light_absorbed" - } - }, - "parent": "create:chromatic_compound" -} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/root.json b/src/main/resources/data/create/advancements/root.json index bb037c316..8242acf23 100644 --- a/src/main/resources/data/create/advancements/root.json +++ b/src/main/resources/data/create/advancements/root.json @@ -1,21 +1,29 @@ { "display": { "icon": { - "item": "create:brass_ingot" + "item": "create:brass_hand" }, "title": { - "translate": "advancement.create:root" + "translate": "advancement.create.root" }, "description": { - "translate": "advancement.create:root.desc" + "translate": "advancement.create.root.desc" }, - "background": "create:textures/block/scoria_bricks.png", + "frame": "task", "show_toast": false, - "announce_to_chat": false + "announce_to_chat": false, + "hidden": false, + "background": "create:textures/block/scoria_bricks.png" }, "criteria": { - "flower": { - "trigger": "minecraft:inventory_changed" + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": {} } - } + }, + "requirements": [ + [ + "0" + ] + ] } \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/rotation.json b/src/main/resources/data/create/advancements/rotation.json deleted file mode 100644 index 5f987ec18..000000000 --- a/src/main/resources/data/create/advancements/rotation.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "display": { - "title": { - "translate": "advancement.create:rotation" - }, - "description": { - "translate": "advancement.create:rotation.desc" - }, - "icon": { - "item": "create:cogwheel" - }, - "frame": "task", - "show_toast": true, - "announce_to_chat": true, - "hidden": true - }, - "criteria": { - "alloy": { - "trigger": "create:rotation" - } - }, - "parent": "create:andesite_alloy" -} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/sand_paper.json b/src/main/resources/data/create/advancements/sand_paper.json deleted file mode 100644 index fd289f9dd..000000000 --- a/src/main/resources/data/create/advancements/sand_paper.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "display": { - "title": { - "translate": "advancement.create:sand_paper", - "color": "yellow" - }, - "description": { - "translate": "advancement.create:sand_paper.desc" - }, - "icon": { - "item": "create:sand_paper" - }, - "frame": "task", - "show_toast": true, - "announce_to_chat": false, - "hidden": true - }, - "criteria": { - "paperNormal": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "item": "create:sand_paper" - } - ] - } - }, - "paperRed": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "item": "create:red_sand_paper" - } - ] - } - } - }, - "requirements": [ - [ - "paperNormal", - "paperRed" - ] - ], - "parent": "create:root" -} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/sand_paper_secret.json b/src/main/resources/data/create/advancements/sand_paper_secret.json deleted file mode 100644 index 79097b1a2..000000000 --- a/src/main/resources/data/create/advancements/sand_paper_secret.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "display": { - "title": { - "translate": "advancement.create:sand_paper_secret", - "color": "yellow" - }, - "description": { - "translate": "advancement.create:sand_paper_secret.desc" - }, - "icon": { - "item": "create:red_sand_paper" - }, - "frame": "goal", - "show_toast": true, - "announce_to_chat": true, - "hidden": true - }, - "criteria": { - "normal": { - "trigger": "create:sandpaper_use", - "conditions": { - "result": { - "item": "create:sand_paper" - } - } - }, - "red": { - "trigger": "create:sandpaper_use", - "conditions": { - "result": { - "item": "create:red_sand_paper" - } - } - } - }, - "requirements": [ - [ - "normal", - "red" - ] - ], - "parent": "create:sand_paper" -} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/saw.json b/src/main/resources/data/create/advancements/saw.json new file mode 100644 index 000000000..575553fc8 --- /dev/null +++ b/src/main/resources/data/create/advancements/saw.json @@ -0,0 +1,40 @@ +{ + "parent": "create:press", + "display": { + "icon": { + "item": "create:saw" + }, + "title": { + "translate": "advancement.create.saw" + }, + "description": { + "translate": "advancement.create.saw.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:placed_block", + "conditions": { + "block": "create:saw" + } + }, + "1": { + "trigger": "create:kinetic_block", + "conditions": { + "block": "create:saw" + } + } + }, + "requirements": [ + [ + "0" + ], + [ + "1" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/shadow_end.json b/src/main/resources/data/create/advancements/shadow_end.json new file mode 100644 index 000000000..0926bf69f --- /dev/null +++ b/src/main/resources/data/create/advancements/shadow_end.json @@ -0,0 +1,35 @@ +{ + "parent": "create:shadow_steel", + "display": { + "icon": { + "item": "minecraft:oak_sapling" + }, + "title": { + "translate": "advancement.create.eob" + }, + "description": { + "translate": "advancement.create.eob.desc" + }, + "frame": "challenge", + "show_toast": false, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "create:shadow_steel" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/shadow_steel.json b/src/main/resources/data/create/advancements/shadow_steel.json index 8c4f7b7a1..a9df6c1c0 100644 --- a/src/main/resources/data/create/advancements/shadow_steel.json +++ b/src/main/resources/data/create/advancements/shadow_steel.json @@ -1,30 +1,35 @@ { - "display": { - "title": { - "translate": "advancement.create:shadow_steel" - }, - "description": { - "translate": "advancement.create:shadow_steel.desc" - }, - "icon": { + "parent": "create:chromatic_compound", + "display": { + "icon": { + "item": "create:shadow_steel" + }, + "title": { + "translate": "advancement.create.shadow_steel" + }, + "description": { + "translate": "advancement.create.shadow_steel.desc" + }, + "frame": "goal", + "show_toast": true, + "announce_to_chat": true, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { "item": "create:shadow_steel" - }, - "frame": "goal", - "show_toast": true, - "announce_to_chat": true, - "hidden": false - }, - "criteria": { - "alloy": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "item": "create:shadow_steel" - } - ] - } - } - }, - "parent": "create:chromatic_compound" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] } \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/shifting_gears.json b/src/main/resources/data/create/advancements/shifting_gears.json new file mode 100644 index 000000000..5c1039659 --- /dev/null +++ b/src/main/resources/data/create/advancements/shifting_gears.json @@ -0,0 +1,28 @@ +{ + "parent": "create:its_alive", + "display": { + "icon": { + "item": "create:large_cogwheel" + }, + "title": { + "translate": "advancement.create.shifting_gears" + }, + "description": { + "translate": "advancement.create.shifting_gears.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "create:shifting_gears" + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/speed_gauge.json b/src/main/resources/data/create/advancements/speed_gauge.json new file mode 100644 index 000000000..3b738054c --- /dev/null +++ b/src/main/resources/data/create/advancements/speed_gauge.json @@ -0,0 +1,40 @@ +{ + "parent": "create:goggles", + "display": { + "icon": { + "item": "create:speed_gauge" + }, + "title": { + "translate": "advancement.create.speed_gauge" + }, + "description": { + "translate": "advancement.create.speed_gauge.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:placed_block", + "conditions": { + "block": "create:speed_gauge" + } + }, + "1": { + "trigger": "create:kinetic_block", + "conditions": { + "block": "create:speed_gauge" + } + } + }, + "requirements": [ + [ + "0" + ], + [ + "1" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/speed_secret.json b/src/main/resources/data/create/advancements/speed_secret.json deleted file mode 100644 index d867129ad..000000000 --- a/src/main/resources/data/create/advancements/speed_secret.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "display": { - "title": { - "translate": "advancement.create:speed_secret", - "color": "red" - }, - "description": { - "translate": "advancement.create:speed_secret.desc" - }, - "icon": { - "item": "create:speed_gauge" - }, - "frame": "goal", - "show_toast": true, - "announce_to_chat": true, - "hidden": true - }, - "criteria": { - "alloy": { - "trigger": "create:speed_read" - } - }, - "parent": "create:root" -} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/stress_gauge.json b/src/main/resources/data/create/advancements/stress_gauge.json new file mode 100644 index 000000000..cb6bd9b88 --- /dev/null +++ b/src/main/resources/data/create/advancements/stress_gauge.json @@ -0,0 +1,40 @@ +{ + "parent": "create:goggles", + "display": { + "icon": { + "item": "create:stress_gauge" + }, + "title": { + "translate": "advancement.create.stress_gauge" + }, + "description": { + "translate": "advancement.create.stress_gauge.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:placed_block", + "conditions": { + "block": "create:stress_gauge" + } + }, + "1": { + "trigger": "create:kinetic_block", + "conditions": { + "block": "create:stress_gauge" + } + } + }, + "requirements": [ + [ + "0" + ], + [ + "1" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/symmetry_wand.json b/src/main/resources/data/create/advancements/symmetry_wand.json new file mode 100644 index 000000000..4a8ace7f4 --- /dev/null +++ b/src/main/resources/data/create/advancements/symmetry_wand.json @@ -0,0 +1,35 @@ +{ + "parent": "create:refined_radiance", + "display": { + "icon": { + "item": "create:symmetry_wand" + }, + "title": { + "translate": "advancement.create.symmetry_wand" + }, + "description": { + "translate": "advancement.create.symmetry_wand.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "create:symmetry_wand" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/upgraded_zapper.json b/src/main/resources/data/create/advancements/upgraded_zapper.json new file mode 100644 index 000000000..283a70ea8 --- /dev/null +++ b/src/main/resources/data/create/advancements/upgraded_zapper.json @@ -0,0 +1,29 @@ +{ + "parent": "create:zapper", + "display": { + "icon": { + "item": "create:placement_handgun", + "nbt": "{Retriever:\"Chromatic\",Scope:\"Chromatic\",Amplifier:\"Chromatic\",Body:\"Chromatic\",Accelerator:\"Chromatic\"}" + }, + "title": { + "translate": "advancement.create.upgraded_zapper" + }, + "description": { + "translate": "advancement.create.upgraded_zapper.desc" + }, + "frame": "challenge", + "show_toast": true, + "announce_to_chat": true, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "create:upgraded_zapper" + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/water_wheel.json b/src/main/resources/data/create/advancements/water_wheel.json new file mode 100644 index 000000000..e5f32c139 --- /dev/null +++ b/src/main/resources/data/create/advancements/water_wheel.json @@ -0,0 +1,37 @@ +{ + "parent": "create:andesite_alloy", + "display": { + "icon": { + "item": "create:water_wheel" + }, + "title": { + "translate": "advancement.create.water_wheel" + }, + "description": { + "translate": "advancement.create.water_wheel.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:placed_block", + "conditions": { + "block": "create:water_wheel" + } + }, + "1": { + "trigger": "create:water_wheel" + } + }, + "requirements": [ + [ + "0" + ], + [ + "1" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/wrench.json b/src/main/resources/data/create/advancements/wrench.json new file mode 100644 index 000000000..9c50bf400 --- /dev/null +++ b/src/main/resources/data/create/advancements/wrench.json @@ -0,0 +1,35 @@ +{ + "parent": "create:its_alive", + "display": { + "icon": { + "item": "create:wrench" + }, + "title": { + "translate": "advancement.create.wrench" + }, + "description": { + "translate": "advancement.create.wrench.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "create:wrench" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/zapper.json b/src/main/resources/data/create/advancements/zapper.json new file mode 100644 index 000000000..8fd2c563c --- /dev/null +++ b/src/main/resources/data/create/advancements/zapper.json @@ -0,0 +1,35 @@ +{ + "parent": "create:refined_radiance", + "display": { + "icon": { + "item": "create:placement_handgun" + }, + "title": { + "translate": "advancement.create.zapper" + }, + "description": { + "translate": "advancement.create.zapper.desc" + }, + "frame": "task", + "show_toast": true, + "announce_to_chat": false, + "hidden": false + }, + "criteria": { + "0": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "create:placement_handgun" + } + ] + } + } + }, + "requirements": [ + [ + "0" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/recipes/mixing/blazing_axe.json b/src/main/resources/data/create/recipes/mixing/blazing_axe.json index 772532f0a..c5bbc965e 100644 --- a/src/main/resources/data/create/recipes/mixing/blazing_axe.json +++ b/src/main/resources/data/create/recipes/mixing/blazing_axe.json @@ -8,16 +8,8 @@ "item": "create:obsidian_dust" }, { - "item": "minecraft:blaze_powder" - }, - { - "item": "minecraft:blaze_powder" - }, - { - "item": "minecraft:blaze_powder" - }, - { - "item": "minecraft:blaze_powder" + "item": "minecraft:blaze_powder", + "count": 4 } ], "results": [ diff --git a/src/main/resources/data/create/recipes/mixing/blazing_pickaxe.json b/src/main/resources/data/create/recipes/mixing/blazing_pickaxe.json index d80db6c1a..1f8c33066 100644 --- a/src/main/resources/data/create/recipes/mixing/blazing_pickaxe.json +++ b/src/main/resources/data/create/recipes/mixing/blazing_pickaxe.json @@ -8,16 +8,8 @@ "item": "create:obsidian_dust" }, { - "item": "minecraft:blaze_powder" - }, - { - "item": "minecraft:blaze_powder" - }, - { - "item": "minecraft:blaze_powder" - }, - { - "item": "minecraft:blaze_powder" + "item": "minecraft:blaze_powder", + "count": 4 } ], "results": [ diff --git a/src/main/resources/data/create/recipes/mixing/blazing_shovel.json b/src/main/resources/data/create/recipes/mixing/blazing_shovel.json index dbce999c7..a65673c19 100644 --- a/src/main/resources/data/create/recipes/mixing/blazing_shovel.json +++ b/src/main/resources/data/create/recipes/mixing/blazing_shovel.json @@ -8,16 +8,8 @@ "item": "create:obsidian_dust" }, { - "item": "minecraft:blaze_powder" - }, - { - "item": "minecraft:blaze_powder" - }, - { - "item": "minecraft:blaze_powder" - }, - { - "item": "minecraft:blaze_powder" + "item": "minecraft:blaze_powder", + "count": 4 } ], "results": [ diff --git a/src/main/resources/data/create/recipes/mixing/blazing_sword.json b/src/main/resources/data/create/recipes/mixing/blazing_sword.json index 8b8785f59..99f9051d9 100644 --- a/src/main/resources/data/create/recipes/mixing/blazing_sword.json +++ b/src/main/resources/data/create/recipes/mixing/blazing_sword.json @@ -8,16 +8,8 @@ "item": "create:obsidian_dust" }, { - "item": "minecraft:blaze_powder" - }, - { - "item": "minecraft:blaze_powder" - }, - { - "item": "minecraft:blaze_powder" - }, - { - "item": "minecraft:blaze_powder" + "item": "minecraft:blaze_powder", + "count": 4 } ], "results": [ diff --git a/src/main/resources/data/create/recipes/mixing/chromatic_compound.json b/src/main/resources/data/create/recipes/mixing/chromatic_compound.json index 92f30a818..827e3a3c7 100644 --- a/src/main/resources/data/create/recipes/mixing/chromatic_compound.json +++ b/src/main/resources/data/create/recipes/mixing/chromatic_compound.json @@ -2,25 +2,15 @@ "type": "create:mixing", "ingredients": [ { - "tag": "forge:dusts/glowstone" - }, - { - "tag": "forge:dusts/glowstone" - }, - { - "tag": "forge:dusts/glowstone" + "tag": "forge:dusts/glowstone", + "count": 3 }, { "item": "create:polished_rose_quartz" }, { - "item": "create:obsidian_dust" - }, - { - "item": "create:obsidian_dust" - }, - { - "item": "create:obsidian_dust" + "item": "create:obsidian_dust", + "count": 3 }, { "item": "minecraft:dragon_breath", diff --git a/src/main/resources/data/create/recipes/stonecutting/polished_dark_scoria.json b/src/main/resources/data/create/recipes/stonecutting/polished_dark_scoria.json new file mode 100644 index 000000000..36ac32453 --- /dev/null +++ b/src/main/resources/data/create/recipes/stonecutting/polished_dark_scoria.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:stonecutting", + "ingredient": { + "item": "create:dark_scoria" + }, + "result": "create:polished_dark_scoria", + "count": 1, + "conditions": [ + { + "type": "create:module", + "module": "palettes" + } + ] +} \ No newline at end of file