From dccd02c40d916b51b23eaf83e31913a87343b1fa Mon Sep 17 00:00:00 2001 From: stfwi Date: Fri, 28 Aug 2020 21:31:38 +0200 Subject: [PATCH] Localization functionality cleanup. Milker fluid transfer added. Sandstone Ornamented Clinker added. --- gradle.properties | 2 +- readme.md | 3 + .../java/wile/engineersdecor/ModContent.java | 9 ++- .../wile/engineersdecor/blocks/EdBreaker.java | 2 +- .../blocks/EdCornerOrnamentedBlock.java | 69 ++++++++++++++++++ .../engineersdecor/blocks/EdFluidBarrel.java | 8 +- .../engineersdecor/blocks/EdLabeledCrate.java | 2 +- .../wile/engineersdecor/blocks/EdMilker.java | 32 ++++++-- .../engineersdecor/blocks/EdSolarPanel.java | 2 +- .../engineersdecor/blocks/EdTreeCutter.java | 2 +- .../libmc/detail/Auxiliaries.java | 13 ++-- .../engineersdecor/libmc/detail/Fluidics.java | 16 +++- .../engineersdecor/libmc/detail/Overlay.java | 20 ++--- .../clinker_brick_sastor_corner_block.json | 10 +++ .../assets/engineersdecor/lang/en_us.json | 2 + .../clinker_brick_sastor_corner_model.json | 24 ++++++ .../clinker_brick_sastor_down_model.json | 12 +++ .../brick/clinker_brick_sastor_up_model.json | 12 +++ .../clinker_brick_sastor_corner_block.json | 1 + ...inker_brick_sastor_corner_down_texture.png | Bin 0 -> 748 bytes ...inker_brick_sastor_corner_side_texture.png | Bin 0 -> 726 bytes ...clinker_brick_sastor_corner_up_texture.png | Bin 0 -> 746 bytes ...er_brick_sastor_downplate_side_texture.png | Bin 0 -> 734 bytes ...nker_brick_sastor_upplate_side_texture.png | Bin 0 -> 699 bytes ...inker_brick_sastor_upplate_top_texture.png | Bin 0 -> 515 bytes .../clinker_brick_sastor_corner_block.json | 21 ++++++ ...nker_brick_sastor_corner_block_recipe.json | 29 ++++++++ 27 files changed, 255 insertions(+), 36 deletions(-) create mode 100644 src/main/java/wile/engineersdecor/blocks/EdCornerOrnamentedBlock.java create mode 100644 src/main/resources/assets/engineersdecor/blockstates/clinker_brick_sastor_corner_block.json create mode 100644 src/main/resources/assets/engineersdecor/models/block/brick/clinker_brick_sastor_corner_model.json create mode 100644 src/main/resources/assets/engineersdecor/models/block/brick/clinker_brick_sastor_down_model.json create mode 100644 src/main/resources/assets/engineersdecor/models/block/brick/clinker_brick_sastor_up_model.json create mode 100644 src/main/resources/assets/engineersdecor/models/item/clinker_brick_sastor_corner_block.json create mode 100644 src/main/resources/assets/engineersdecor/textures/block/clinker_brick/clinker_brick_sastor_corner_down_texture.png create mode 100644 src/main/resources/assets/engineersdecor/textures/block/clinker_brick/clinker_brick_sastor_corner_side_texture.png create mode 100644 src/main/resources/assets/engineersdecor/textures/block/clinker_brick/clinker_brick_sastor_corner_up_texture.png create mode 100644 src/main/resources/assets/engineersdecor/textures/block/clinker_brick/clinker_brick_sastor_downplate_side_texture.png create mode 100644 src/main/resources/assets/engineersdecor/textures/block/clinker_brick/clinker_brick_sastor_upplate_side_texture.png create mode 100644 src/main/resources/assets/engineersdecor/textures/block/clinker_brick/clinker_brick_sastor_upplate_top_texture.png create mode 100644 src/main/resources/data/engineersdecor/loot_tables/blocks/clinker_brick_sastor_corner_block.json create mode 100644 src/main/resources/data/engineersdecor/recipes/independent/clinker_brick_sastor_corner_block_recipe.json diff --git a/gradle.properties b/gradle.properties index 36e5d7d..158afde 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,4 +5,4 @@ version_minecraft=1.16.2 version_forge_minecraft=1.16.2-33.0.22 version_fml_mappings=20200723-1.16.1 version_jei=1.16.2:7.1.3.19 -version_engineersdecor=1.1.2-b4 +version_engineersdecor=1.1.2-b5 diff --git a/readme.md b/readme.md index 75ef28c..a119249 100644 --- a/readme.md +++ b/readme.md @@ -11,6 +11,9 @@ Mod sources for Minecraft version 1.16.2. ## Version history + ~ v1.1.2-b5 [A] Sandstone Ornamented Clinker Brick added. + [F] Milking Machine fluid transfer re-added (thx gebcrafter). + - v1.1.2-b4 [F] Mapping adaption to Forge 1.16.2-33.0.22/20200723-1.16.1. [F] Fixed conditional recipe tag dependency (thx Blu, Cyborgmas). diff --git a/src/main/java/wile/engineersdecor/ModContent.java b/src/main/java/wile/engineersdecor/ModContent.java index 288fa52..cd57b4e 100644 --- a/src/main/java/wile/engineersdecor/ModContent.java +++ b/src/main/java/wile/engineersdecor/ModContent.java @@ -82,8 +82,6 @@ public class ModContent Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_wall")); - // ------------------------------------------------------------------------------------------------------------------- - public static final DecorBlock.Normal CLINKER_BRICK_STAINED_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal( DecorBlock.CFG_DEFAULT, Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) @@ -100,6 +98,12 @@ public class ModContent Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE) )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_stained_stairs")); + public static final EdCornerOrnamentedBlock CLINKER_BRICK_SASTOR_CORNER = (EdCornerOrnamentedBlock)(new EdCornerOrnamentedBlock( + DecorBlock.CFG_DEFAULT, + Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 50f).sound(SoundType.STONE), + new Block[]{CLINKER_BRICK_BLOCK, CLINKER_BRICK_STAINED_BLOCK, CLINKER_BRICK_SLAB, CLINKER_BRICK_STAIRS, CLINKER_BRICK_STAINED_SLAB, CLINKER_BRICK_STAINED_STAIRS} + )).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "clinker_brick_sastor_corner_block")); + // ------------------------------------------------------------------------------------------------------------------- public static final DecorBlock.Normal SLAG_BRICK_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal( @@ -784,6 +788,7 @@ public class ModContent CLINKER_BRICK_SLAB, CLINKER_BRICK_STAIRS, CLINKER_BRICK_WALL, + CLINKER_BRICK_SASTOR_CORNER, CLINKER_BRICK_STAINED_BLOCK, CLINKER_BRICK_STAINED_SLAB, CLINKER_BRICK_STAINED_STAIRS, diff --git a/src/main/java/wile/engineersdecor/blocks/EdBreaker.java b/src/main/java/wile/engineersdecor/blocks/EdBreaker.java index b6865d2..0cee872 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdBreaker.java +++ b/src/main/java/wile/engineersdecor/blocks/EdBreaker.java @@ -185,7 +185,7 @@ public class EdBreaker progress = Integer.toString((int)MathHelper.clamp((((double)proc_time_elapsed_) / ((double)time_needed_) * 100), 0, 100)); } String soc = Integer.toString(MathHelper.clamp((energy_*100/energy_max),0,100)); - Overlay.show(player, Auxiliaries.localizable("block.engineersdecor.small_block_breaker.status", null, new Object[]{soc, energy_max, progress })); + Overlay.show(player, Auxiliaries.localizable("block.engineersdecor.small_block_breaker.status", new Object[]{soc, energy_max, progress })); } // TileEntity ------------------------------------------------------------------------------ diff --git a/src/main/java/wile/engineersdecor/blocks/EdCornerOrnamentedBlock.java b/src/main/java/wile/engineersdecor/blocks/EdCornerOrnamentedBlock.java new file mode 100644 index 0000000..37eb321 --- /dev/null +++ b/src/main/java/wile/engineersdecor/blocks/EdCornerOrnamentedBlock.java @@ -0,0 +1,69 @@ +/* + * @file EdCornerOrnamentedBlock.java + * @author Stefan Wilhelm (wile) + * @copyright (C) 2019 Stefan Wilhelm + * @license MIT (see https://opensource.org/licenses/MIT) + * + * Block for corner/quoin ornamentation. + */ +package wile.engineersdecor.blocks; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.vector.Vector2f; +import net.minecraft.world.World; +import wile.engineersdecor.libmc.detail.Auxiliaries; + +import javax.annotation.Nullable; +import java.util.*; + + +public class EdCornerOrnamentedBlock extends DecorBlock.Directed +{ + protected final HashSet compatible_blocks; + + public EdCornerOrnamentedBlock(long config, Block.Properties properties, Block[] assigned_wall_blocks) + { + super(config, properties, Auxiliaries.getPixeledAABB(0,0,0,16,16,16)); + compatible_blocks = new HashSet(Arrays.asList(assigned_wall_blocks)); + } + + @Override + @Nullable + public BlockState getStateForPlacement(BlockItemUseContext context) + { + final World world = context.getWorld(); + final BlockPos pos = context.getPos(); + // 1. Placement as below/above for corners, or placement adjacent horizontally if up/down facing. + for(Direction adj: Direction.values()) { + BlockState state = world.getBlockState(pos.offset(adj)); + if(state.getBlock() != this) continue; + Direction facing = state.get(FACING); + if(facing.getAxis().isHorizontal() == (adj.getAxis().isVertical())) { + return super.getStateForPlacement(context).with(FACING, state.get(FACING)); + } + } + // 2. By Player look angles with minimum horizontal diagonal deviation. + { + Direction facing = Direction.WEST; + final Vector2f look = context.getPlayer().getPitchYaw(); + final Direction hit_face = context.getFace(); + if((context.getFace()==Direction.DOWN) && (look.x <= -60)) { + facing = Direction.DOWN; + } else if((context.getFace()==Direction.UP) && (look.x >= 60)) { + facing = Direction.UP; + } else if(MathHelper.degreesDifferenceAbs(look.y, 45) <= 45) { + facing = Direction.NORTH; + } else if(MathHelper.degreesDifferenceAbs(look.y, 45+90) <= 45) { + facing = Direction.EAST; + } else if(MathHelper.degreesDifferenceAbs(look.y, 45+180) <= 45) { + facing = Direction.SOUTH; + } + return super.getStateForPlacement(context).with(FACING, facing); + } + } +} diff --git a/src/main/java/wile/engineersdecor/blocks/EdFluidBarrel.java b/src/main/java/wile/engineersdecor/blocks/EdFluidBarrel.java index 3dd4ed8..439420e 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdFluidBarrel.java +++ b/src/main/java/wile/engineersdecor/blocks/EdFluidBarrel.java @@ -130,13 +130,13 @@ public class EdFluidBarrel } FluidStack fs = FluidBarrelItem.getFluid(stack); if(!fs.isEmpty()) { - tooltip.add(Auxiliaries.localizable(getTranslationKey()+".status.tip", null, new Object[] { + tooltip.add(Auxiliaries.localizable(getTranslationKey()+".status.tip", new Object[] { Integer.toString(fs.getAmount()), Integer.toString(capacity_), new TranslationTextComponent(fs.getTranslationKey()) })); } else { - tooltip.add(Auxiliaries.localizable(getTranslationKey()+".status.tip.empty", null, new Object[] { + tooltip.add(Auxiliaries.localizable(getTranslationKey()+".status.tip.empty", new Object[] { "0", Integer.toString(capacity_), })); @@ -241,11 +241,11 @@ public class EdFluidBarrel int cap = tank_.getCapacity(); String name = Auxiliaries.localizable(tank_.getFluid().getTranslationKey()).getString(); if((vol>0) && (cap>0)) { - Overlay.show(player, Auxiliaries.localizable("block.engineersdecor.fluid_barrel.status", null, new Object[]{ + Overlay.show(player, Auxiliaries.localizable("block.engineersdecor.fluid_barrel.status", new Object[]{ Integer.toString(vol), Integer.toString(cap), name })); } else { - Overlay.show(player, Auxiliaries.localizable("block.engineersdecor.fluid_barrel.status.empty", null, new Object[]{ + Overlay.show(player, Auxiliaries.localizable("block.engineersdecor.fluid_barrel.status.empty", new Object[]{ Integer.toString(vol), Integer.toString(cap) })); } diff --git a/src/main/java/wile/engineersdecor/blocks/EdLabeledCrate.java b/src/main/java/wile/engineersdecor/blocks/EdLabeledCrate.java index e09dd40..d5c520a 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdLabeledCrate.java +++ b/src/main/java/wile/engineersdecor/blocks/EdLabeledCrate.java @@ -185,7 +185,7 @@ public class EdLabeledCrate } int num_free_slots = LabeledCrateTileEntity.ITEMFRAME_SLOTNO - num_used_slots; ItemStack frameStack = items.get(LabeledCrateTileEntity.ITEMFRAME_SLOTNO); - tooltip.add(Auxiliaries.localizable(getTranslationKey()+".tip", null, new Object[] { + tooltip.add(Auxiliaries.localizable(getTranslationKey()+".tip", new Object[] { (frameStack.isEmpty() ? (new StringTextComponent("-/-")) : (new TranslationTextComponent(frameStack.getTranslationKey()))), num_used_slots, num_free_slots, diff --git a/src/main/java/wile/engineersdecor/blocks/EdMilker.java b/src/main/java/wile/engineersdecor/blocks/EdMilker.java index d2597d7..88d63a4 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdMilker.java +++ b/src/main/java/wile/engineersdecor/blocks/EdMilker.java @@ -14,6 +14,7 @@ import wile.engineersdecor.libmc.detail.Inventories; import wile.engineersdecor.ModEngineersDecor; import wile.engineersdecor.ModContent; import wile.engineersdecor.detail.ExternalObjects; +import wile.engineersdecor.libmc.detail.Overlay; import net.minecraft.world.World; import net.minecraft.world.IWorldReader; import net.minecraft.world.IBlockReader; @@ -51,7 +52,7 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; -import wile.engineersdecor.libmc.detail.Overlay; +import net.minecraftforge.registries.ForgeRegistries; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -186,8 +187,11 @@ public class EdMilker energy_consumption = MathHelper.clamp(energy_consumption_per_tick, 0, 1024); min_milking_delay_per_cow_ticks = MathHelper.clamp(min_milking_delay_per_cow, 1000, 24000); { - Fluid milk = null; // FluidRe.getFluid("milk"); - if(milk != null) milk_fluid_ = new FluidStack(milk, BUCKET_SIZE); + ResourceLocation milk_rl = ForgeRegistries.FLUIDS.getKeys().stream().filter(rl->rl.getPath().equals("milk")).findFirst().orElse(null); + if(milk_rl != null) { + Fluid milk = ForgeRegistries.FLUIDS.getValue(milk_rl); + if(milk != null) milk_fluid_ = new FluidStack(milk, BUCKET_SIZE); + } } { milk_containers_.put(new ItemStack(Items.BUCKET), new ItemStack(Items.MILK_BUCKET)); @@ -195,7 +199,7 @@ public class EdMilker } ModEngineersDecor.logger().info( "Config milker: energy consumption:" + energy_consumption + "rf/t" - + ((milk_fluid_==null)?"":" [milk fluid available]") + + ((milk_fluid_==NO_MILK_FLUID)?"":" [milk fluid available]") + ((ExternalObjects.BOTTLED_MILK_BOTTLE_DRINKLABLE==null)?"":" [bottledmilk mod available]") ); } @@ -249,8 +253,8 @@ public class EdMilker public void state_message(PlayerEntity player) { - ITextComponent rf = (energy_consumption <= 0) ? (new StringTextComponent("")) : (Auxiliaries.localizable("block.engineersdecor.small_milking_machine.status.rf", null, new Object[]{energy_stored_})); - Overlay.show(player, Auxiliaries.localizable("block.engineersdecor.small_milking_machine.status", null, new Object[]{tank_level_, rf})); + ITextComponent rf = (energy_consumption <= 0) ? (new StringTextComponent("")) : (Auxiliaries.localizable("block.engineersdecor.small_milking_machine.status.rf", new Object[]{energy_stored_})); + Overlay.show(player, Auxiliaries.localizable("block.engineersdecor.small_milking_machine.status", new Object[]{tank_level_, rf})); } // TileEntity ------------------------------------------------------------------------------ @@ -381,6 +385,20 @@ public class EdMilker return dirty; } + private boolean fill_adjacent_tank() + { + if((fluid_level()<=0) || (!has_milk_fluid())) return false; + final FluidStack fs = new FluidStack(milk_fluid_, Math.max(fluid_level(), BUCKET_SIZE)); + for(Direction dir:Direction.values()) { + int amount = Fluidics.fill(getWorld(), getPos().offset(dir), dir.getOpposite(), fs); + if(amount > 0) { + tank_level_ = Math.max(fluid_level() - amount, 0); + return true; + } + } + return false; + } + private void release_cow(CowEntity cow) { log("release cow"); @@ -565,7 +583,7 @@ public class EdMilker // Adjacent inventory update, only done just after milking to prevent waste of server cpu. if((!dirty) && (fluid_level() >= BUCKET_SIZE)) { log("Try item transfer"); - if(fill_adjacent_inventory_item_containers(block_state.get(MilkerBlock.HORIZONTAL_FACING))) dirty = true; + if(fill_adjacent_tank() || fill_adjacent_inventory_item_containers(block_state.get(MilkerBlock.HORIZONTAL_FACING))) dirty = true; } } // State update diff --git a/src/main/java/wile/engineersdecor/blocks/EdSolarPanel.java b/src/main/java/wile/engineersdecor/blocks/EdSolarPanel.java index 08a31c3..9f51383 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdSolarPanel.java +++ b/src/main/java/wile/engineersdecor/blocks/EdSolarPanel.java @@ -119,7 +119,7 @@ public class EdSolarPanel public void state_message(PlayerEntity player) { String soc = Integer.toString(MathHelper.clamp((accumulated_power_*100/max_power_storage_),0,100)); - Overlay.show(player, Auxiliaries.localizable("block.engineersdecor.small_solar_panel.status", null, new Object[]{soc, max_power_storage_, current_production_, current_feedin_ })); + Overlay.show(player, Auxiliaries.localizable("block.engineersdecor.small_solar_panel.status", new Object[]{soc, max_power_storage_, current_production_, current_feedin_ })); } // IEnergyStorage -------------------------------------------------------------------------- diff --git a/src/main/java/wile/engineersdecor/blocks/EdTreeCutter.java b/src/main/java/wile/engineersdecor/blocks/EdTreeCutter.java index e349e58..4053bf1 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdTreeCutter.java +++ b/src/main/java/wile/engineersdecor/blocks/EdTreeCutter.java @@ -145,7 +145,7 @@ public class EdTreeCutter progress = Integer.toString((int)MathHelper.clamp((((double)proc_time_elapsed_) / ((double)cutting_time_needed) * 100), 0, 100)); } String soc = Integer.toString(MathHelper.clamp((energy_*100/energy_max),0,100)); - Overlay.show(player, Auxiliaries.localizable("block.engineersdecor.small_tree_cutter.status", null, new Object[]{soc, energy_max, progress, (cutting_time_needed/20) })); + Overlay.show(player, Auxiliaries.localizable("block.engineersdecor.small_tree_cutter.status", new Object[]{soc, energy_max, progress, (cutting_time_needed/20) })); } // TileEntity ------------------------------------------------------------------------------ diff --git a/src/main/java/wile/engineersdecor/libmc/detail/Auxiliaries.java b/src/main/java/wile/engineersdecor/libmc/detail/Auxiliaries.java index 3843135..aa6f412 100644 --- a/src/main/java/wile/engineersdecor/libmc/detail/Auxiliaries.java +++ b/src/main/java/wile/engineersdecor/libmc/detail/Auxiliaries.java @@ -113,15 +113,13 @@ public class Auxiliaries * Text localisation wrapper, implicitly prepends `MODID` to the * translation keys. Forces formatting argument, nullable if no special formatting shall be applied.. */ - public static TranslationTextComponent localizable(String modtrkey, @Nullable TextFormatting color, Object... args) + public static TranslationTextComponent localizable(String modtrkey, Object... args) { - TranslationTextComponent tr = new TranslationTextComponent((modtrkey.startsWith("block.") || (modtrkey.startsWith("item."))) ? (modtrkey) : (modid+"."+modtrkey), args); - if(color!=null) tr.mergeStyle(color); - return tr; + return new TranslationTextComponent((modtrkey.startsWith("block.") || (modtrkey.startsWith("item."))) ? (modtrkey) : (modid+"."+modtrkey), args); } public static TranslationTextComponent localizable(String modtrkey) - { return localizable(modtrkey, null); } + { return localizable(modtrkey, new Object[]{}); } public static TranslationTextComponent localizable_block_key(String blocksubkey) { return new TranslationTextComponent("block."+modid+"."+blocksubkey); } @@ -187,8 +185,7 @@ public class Auxiliaries @OnlyIn(Dist.CLIENT) public static boolean addInformation(@Nullable String advancedTooltipTranslationKey, @Nullable String helpTranslationKey, List tooltip, ITooltipFlag flag, boolean addAdvancedTooltipHints) { - // Note: intentionally not using keybinding here, this must be `control` or `shift`. MC uses lwjgl Keyboard, - // so using this also here should be ok. + // Note: intentionally not using keybinding here, this must be `control` or `shift`. final boolean help_available = (helpTranslationKey != null) && Auxiliaries.hasTranslation(helpTranslationKey + ".help"); final boolean tip_available = (advancedTooltipTranslationKey != null) && Auxiliaries.hasTranslation(helpTranslationKey + ".tip"); if((!help_available) && (!tip_available)) return false; @@ -196,7 +193,7 @@ public class Auxiliaries if(!help_available) return false; String s = localize(helpTranslationKey + ".help"); if(s.isEmpty()) return false; - tooltip.add(new StringTextComponent(s)); // @todo: check how to optimise that (to use TranslationTextComponent directly without compat losses) + tooltip.add(new StringTextComponent(s)); return true; } else if(extendedTipCondition()) { if(!tip_available) return false; diff --git a/src/main/java/wile/engineersdecor/libmc/detail/Fluidics.java b/src/main/java/wile/engineersdecor/libmc/detail/Fluidics.java index d4508a5..86e173e 100644 --- a/src/main/java/wile/engineersdecor/libmc/detail/Fluidics.java +++ b/src/main/java/wile/engineersdecor/libmc/detail/Fluidics.java @@ -72,9 +72,15 @@ public class Fluidics public Tank readnbt(CompoundNBT nbt) { setFluid(FluidStack.loadFluidStackFromNBT(nbt)); return this; } + public CompoundNBT writenbt() + { return writenbt(new CompoundNBT()); } + public CompoundNBT writenbt(CompoundNBT nbt) { fluid_.writeToNBT(nbt); return nbt; } + public void reset() + { setFluid(null); } + public int getCapacity() { return capacity_; } @@ -150,7 +156,6 @@ public class Fluidics } } - /** * Fills or drains items with fluid handlers from or into tile blocks with fluid handlers. */ @@ -191,6 +196,15 @@ public class Fluidics return null; } + public static int fill(World world, BlockPos pos, Direction side, FluidStack fs, FluidAction action) + { + IFluidHandler fh = FluidUtil.getFluidHandler(world, pos, side).orElse(null); + return (fh==null) ? (0) : (fh.fill(fs, action)); + } + + public static int fill(World world, BlockPos pos, Direction side, FluidStack fs) + { return fill(world, pos, side, fs, FluidAction.EXECUTE); } + /** * Fluid tank access when itemized. */ diff --git a/src/main/java/wile/engineersdecor/libmc/detail/Overlay.java b/src/main/java/wile/engineersdecor/libmc/detail/Overlay.java index 7ee661d..5ea14c0 100644 --- a/src/main/java/wile/engineersdecor/libmc/detail/Overlay.java +++ b/src/main/java/wile/engineersdecor/libmc/detail/Overlay.java @@ -15,6 +15,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.text.ITextComponent; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.AbstractGui; +import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.api.distmarker.Dist; @@ -46,6 +47,7 @@ public class Overlay @OnlyIn(Dist.CLIENT) public static class TextOverlayGui extends AbstractGui { + private static final ITextComponent EMPTY_TEXT = new StringTextComponent(""); private static double overlay_y_ = 0.75; private static int text_color_ = 0x00ffaa00; private static int border_color_ = 0xaa333333; @@ -53,7 +55,7 @@ public class Overlay private static int background_color2_ = 0xaa444444; private final Minecraft mc; private static long deadline_; - private static String text_; + private static ITextComponent text_; public static void on_config(double overlay_y) { @@ -65,20 +67,20 @@ public class Overlay background_color2_ = 0xaa444444; } - public static synchronized String text() + public static synchronized ITextComponent text() { return text_; } public static synchronized long deadline() { return deadline_; } public static synchronized void hide() - { deadline_ = 0; text_ = ""; } + { deadline_ = 0; text_ = EMPTY_TEXT; } public static synchronized void show(ITextComponent s, int displayTimeoutMs) - { text_ = (s==null)?(""):(s.getString()); deadline_ = System.currentTimeMillis() + displayTimeoutMs; } + { text_ = (s==null)?(EMPTY_TEXT):(s.deepCopy()); deadline_ = System.currentTimeMillis() + displayTimeoutMs; } public static synchronized void show(String s, int displayTimeoutMs) - { text_ = (s == null) ? ("") : (s); deadline_ = System.currentTimeMillis() + displayTimeoutMs; } + { text_ = ((s==null)||(s.isEmpty()))?(EMPTY_TEXT):(new StringTextComponent(s)); deadline_ = System.currentTimeMillis() + displayTimeoutMs; } TextOverlayGui() { super(); mc = SidedProxy.mc(); } @@ -88,9 +90,10 @@ public class Overlay { if(event.getType() != RenderGameOverlayEvent.ElementType.CHAT) return; if(deadline() < System.currentTimeMillis()) return; - String txt = text(); - MatrixStack mxs = event.getMatrixStack(); + if(text()==EMPTY_TEXT) return; + String txt = text().getString(); if(txt.isEmpty()) return; + MatrixStack mxs = event.getMatrixStack(); final MainWindow win = mc.getMainWindow(); final FontRenderer fr = mc.fontRenderer; final boolean was_unicode = fr.getBidiFlag(); @@ -104,12 +107,11 @@ public class Overlay hLine(mxs, cx-(w/2)-3, cx+(w/2)+2, cy+h+2, 0xaa333333); vLine(mxs, cx-(w/2)-3, cy-2, cy+h+2, 0xaa333333); vLine(mxs, cx+(w/2)+2, cy-2, cy+h+2, 0xaa333333); - drawCenteredString(mxs, fr, txt, cx , cy+1, 0x00ffaa00); + drawCenteredString(mxs, fr, text(), cx , cy+1, 0x00ffaa00); } finally { ; // fr.setBidiFlag(was_unicode); } } - } } diff --git a/src/main/resources/assets/engineersdecor/blockstates/clinker_brick_sastor_corner_block.json b/src/main/resources/assets/engineersdecor/blockstates/clinker_brick_sastor_corner_block.json new file mode 100644 index 0000000..11ec637 --- /dev/null +++ b/src/main/resources/assets/engineersdecor/blockstates/clinker_brick_sastor_corner_block.json @@ -0,0 +1,10 @@ +{ + "variants": { + "facing=north": { "model": "engineersdecor:block/brick/clinker_brick_sastor_corner_model" }, + "facing=south": { "model": "engineersdecor:block/brick/clinker_brick_sastor_corner_model", "y":180 }, + "facing=west": { "model": "engineersdecor:block/brick/clinker_brick_sastor_corner_model", "y":270 }, + "facing=east": { "model": "engineersdecor:block/brick/clinker_brick_sastor_corner_model", "y":90 }, + "facing=up": { "model": "engineersdecor:block/brick/clinker_brick_sastor_up_model" }, + "facing=down": { "model": "engineersdecor:block/brick/clinker_brick_sastor_down_model" } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/engineersdecor/lang/en_us.json b/src/main/resources/assets/engineersdecor/lang/en_us.json index f0d010e..4ed6719 100644 --- a/src/main/resources/assets/engineersdecor/lang/en_us.json +++ b/src/main/resources/assets/engineersdecor/lang/en_us.json @@ -196,6 +196,8 @@ "block.engineersdecor.slag_brick_stairs.help": "§6Gray-brown brick stairs.", "block.engineersdecor.slag_brick_wall": "Slag Brick Wall", "block.engineersdecor.slag_brick_wall.help": "§6Simplistic Slag Brick Wall.", + "block.engineersdecor.clinker_brick_sastor_corner_block": "Sandstone Ornamented Clinker Brick Corner", + "block.engineersdecor.clinker_brick_sastor_corner_block.help": "§6Quoin decoration for clinker wall accentuation.", "block.engineersdecor.small_block_breaker": "Small Block Breaker", "block.engineersdecor.small_block_breaker.help": "§6Breaks blocks in front of it.§r\nCan be disabled by applying a redstone signal. The time needed to destroy a block depends on the hardness of that block. ${!block_breaker_requires_power?engineersdecor.tooltip.massive_speed_boost_with_rf_power} ${block_breaker_requires_power?engineersdecor.tooltip.requires_rf_power}", "block.engineersdecor.small_block_breaker.status": "SOC: %1$s%% of %2$sRF§r | progress: %3$s%%", diff --git a/src/main/resources/assets/engineersdecor/models/block/brick/clinker_brick_sastor_corner_model.json b/src/main/resources/assets/engineersdecor/models/block/brick/clinker_brick_sastor_corner_model.json new file mode 100644 index 0000000..cd243ab --- /dev/null +++ b/src/main/resources/assets/engineersdecor/models/block/brick/clinker_brick_sastor_corner_model.json @@ -0,0 +1,24 @@ +{ + "parent": "block/block", + "textures": { + "d": "engineersdecor:block/clinker_brick/clinker_brick_sastor_corner_down_texture", + "n": "engineersdecor:block/clinker_brick/clinker_brick_sastor_corner_side_texture", + "particle": "engineersdecor:block/clinker_brick/clinker_brick_texture0", + "s": "engineersdecor:block/clinker_brick/clinker_brick_texture0", + "u": "engineersdecor:block/clinker_brick/clinker_brick_sastor_corner_up_texture" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [16, 0, 0, 16], "texture": "#n", "cullface": "north"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#n", "cullface": "east"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#s", "cullface": "south"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#s", "cullface": "west"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#u", "cullface": "up"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#d", "cullface": "down"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/engineersdecor/models/block/brick/clinker_brick_sastor_down_model.json b/src/main/resources/assets/engineersdecor/models/block/brick/clinker_brick_sastor_down_model.json new file mode 100644 index 0000000..242a728 --- /dev/null +++ b/src/main/resources/assets/engineersdecor/models/block/brick/clinker_brick_sastor_down_model.json @@ -0,0 +1,12 @@ +{ + "parent": "block/cube", + "textures": { + "particle": "engineersdecor:block/clinker_brick/clinker_brick_texture0", + "down": "engineersdecor:block/clinker_brick/clinker_brick_sastor_upplate_top_texture", + "up": "engineersdecor:block/clinker_brick/clinker_brick_texture0", + "north": "engineersdecor:block/clinker_brick/clinker_brick_sastor_downplate_side_texture", + "south": "engineersdecor:block/clinker_brick/clinker_brick_sastor_downplate_side_texture", + "west": "engineersdecor:block/clinker_brick/clinker_brick_sastor_downplate_side_texture", + "east": "engineersdecor:block/clinker_brick/clinker_brick_sastor_downplate_side_texture" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/engineersdecor/models/block/brick/clinker_brick_sastor_up_model.json b/src/main/resources/assets/engineersdecor/models/block/brick/clinker_brick_sastor_up_model.json new file mode 100644 index 0000000..2bb22f4 --- /dev/null +++ b/src/main/resources/assets/engineersdecor/models/block/brick/clinker_brick_sastor_up_model.json @@ -0,0 +1,12 @@ +{ + "parent": "block/cube", + "textures": { + "particle": "engineersdecor:block/clinker_brick/clinker_brick_texture0", + "down": "engineersdecor:block/clinker_brick/clinker_brick_texture0", + "up": "engineersdecor:block/clinker_brick/clinker_brick_sastor_upplate_top_texture", + "north": "engineersdecor:block/clinker_brick/clinker_brick_sastor_upplate_side_texture", + "south": "engineersdecor:block/clinker_brick/clinker_brick_sastor_upplate_side_texture", + "west": "engineersdecor:block/clinker_brick/clinker_brick_sastor_upplate_side_texture", + "east": "engineersdecor:block/clinker_brick/clinker_brick_sastor_upplate_side_texture" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/engineersdecor/models/item/clinker_brick_sastor_corner_block.json b/src/main/resources/assets/engineersdecor/models/item/clinker_brick_sastor_corner_block.json new file mode 100644 index 0000000..db4c221 --- /dev/null +++ b/src/main/resources/assets/engineersdecor/models/item/clinker_brick_sastor_corner_block.json @@ -0,0 +1 @@ +{ "parent": "engineersdecor:block/brick/clinker_brick_sastor_corner_model" } \ No newline at end of file diff --git a/src/main/resources/assets/engineersdecor/textures/block/clinker_brick/clinker_brick_sastor_corner_down_texture.png b/src/main/resources/assets/engineersdecor/textures/block/clinker_brick/clinker_brick_sastor_corner_down_texture.png new file mode 100644 index 0000000000000000000000000000000000000000..b0d058fadb68e0590805f3a3951cbf47ebbbfdb4 GIT binary patch literal 748 zcmV_xOokwO#$Lf*hq2ncCK@Q)xEVv`6yg@uCR1qmbsqTo3(XYafB z+H0*jEl!h+7Z~FkeDdkrCtl}?Ron8~dsjKV^DX;1VGhH*P^@AGZ4A8i@hANH-Is_6 z3qovKqLj?M6hwse(VE?q$kniF7_jMj#+>6%D3XP#$jsdzP1 z;C$bKErfi=u^Ir>!m5jyJ8cZe*PnmpZcc0>M@L5hoDBm28YBNce1L{XY&)*J{0h@J zQcA%b5Qq=&-zDeFlrq(gAPOo7aPq-*PJg~fnr0de{3gQs(k1G6hGU$3bc2|4VMq%> z6)%u68V^)=07L`gP-{g(;MtSEQB@o#Gy!!t5D-9u(uPPX1r32VM(WvwilQQTH6#Sg zoe%=GROI%pn};gEfMs4-o$GNk)|(CEeosn?YEDq$`CPnwnfU1b9k$#5Fn8X(euH1` ze!)_WAVRGL7bS`yBD`_!L;m>wEA~^OkC8ufA#TSRYg+0&W5p=d@M;uw%)!kN72KiZ zf*_a~W6lVmxM68V#Ci7QF--`>pj3le4Hw8}R1ty(rkv@z7Bd6n@WDTSouaB-cFm)4X?g?mEV8(2Fxk$ z2=Mwl@6)f3>HD5xwh>_U$J;Rb{QR>Xw>0000v6KI6f?yIf2S54fCWx*P8B#)r3X>xe3Ij-7IWMj2M)u?aapiFQ^ySf2$1W5n~@`6D4E5BX_~NZga<0{^f=I$ ziL{&u4@8xuiiiTBs>nBAd>Ro!E}8v)55U#s<+_kFfB*3tnlguL*Qn!`2>*|qK$ZN< zy>A(Frp+A-Cy9az0=#nTHV^LqKs!woO{>l8*SYc5O;XNmc2A)y%GJDp3K6h`Lx6bz zAexW>Gs7Zy^zbk0I3k)zC7~V;vIZkbsVUQXM^mEaj9r~jQB;I5M^fT3tQ+#(SD(k@ zfdlh2v)PV>JG;YyqqpAc@>VN|DTrdy3JKdZxr+dc&%p7xvScRsXspAGBP*rkLAzDKuc=Yg3 zN=gXO%y4rgDT}Yt>$t()i3l`hmU$*W^ZJ|g(-o?Umck3~o^d=L`9FqX01@Wt^u&UQ zBC6!yfBF#-VH`%zYsF4SRD_`xp1pa-uixJR4|>GgsrEq!v59UEctQ{Bz+yk2?N*$29 zUw#(L(phYw)(Y;R%1{cs!-3WseV&wih`*IhN1?e82AK=2pSBcj2KLyM*0YfDC)p~CORV`IM1LkfvJh0U}hi)A}!N( ztL~|D_TC27f$Iepd~3=3&piytI-`${v%&2eBeE|^+FQ(|1L2s4IK@CbVEj>F=Lo{;;YWD(l~)O%)*1Qw;}0St$V2Aj-Wxe3Bn-92{-3|mr1aiU6=how zph5(+a0oDuBbX)t%nXa5?RI$G6A=t$Bzrgr$ffQe%G?@bDU_VC-5wQ12;3YIAtLzk z#;2sk68ZMCkB(J<1Bdy*a7Z=o8F%Oao0HqWZ*qogq?>zl@6f-=6XRg1? z&$qthU``UjtP`SS5k!P1Uw@0=zWa)cePxj|yVl77J``-8@$PhU!kn&w2ZTFv>C;AUFFyBZ-ECr z;&=E*EB$c51KOdYs+WLp c-{~3u0pW&i3FaFAIsgCw07*qoM6N<$f@M%uAOHXW literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/engineersdecor/textures/block/clinker_brick/clinker_brick_sastor_downplate_side_texture.png b/src/main/resources/assets/engineersdecor/textures/block/clinker_brick/clinker_brick_sastor_downplate_side_texture.png new file mode 100644 index 0000000000000000000000000000000000000000..e03d57c02ece41fdfb578dfc90fa873b46338442 GIT binary patch literal 734 zcmV<40wMj0P)GS@E5dEr-FaLcyxr(2?PxcObr!5P(ein9mK#9jV2om4Fn?t%{4NZX{oAP_ulVu zjzJHiE8c9_Ys=fuUwWTLnmHFYZ}a=Nclm2~AZQ>6gdp_ptaIYx)~o#b^%sZ;1tDl4 zN~`R~nHZGK$%frrsNJcpf`U}RaV$gtuBHNJG;Z9 z58iVgV?db-tMw8$W3$~d?Dx#`OgAT}@L!%fJ0t#i|2vLzqnq*U%XfJ2*}LRLMu5p3 z0TMzt^|X=Yf?bcY~d0zMZeAZVcUYY(d!06{)_>kV(?5mn{J)8{NtZ!iqQ z|F$j`3k=w9w;c8dG$_MiV7*!rAO8Fk?uJR=DrfpQpdu`C;+Yq2^4q<;U`~7NLvVDp zp__5}(rx0{I^u>%XPhTgu1ycM0Wgju)xiZoP(bUBpu#xM$Pb@?>}H0lA|kjuAq0Bw zs44*Nj))*4^xgsf&BpzHN2{IMD>-K{1J&z`QpU`1>wr+pjH(i2x-JRIKk7GPG9QWN Q)Bpeg07*qoM6N<$f-8eZm;e9( literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/engineersdecor/textures/block/clinker_brick/clinker_brick_sastor_upplate_side_texture.png b/src/main/resources/assets/engineersdecor/textures/block/clinker_brick/clinker_brick_sastor_upplate_side_texture.png new file mode 100644 index 0000000000000000000000000000000000000000..5d9fc5c1ab54ead61210a52b3c32ed3f51ff0502 GIT binary patch literal 699 zcmV;s0!00ZP)mY%Eh(%)MLj;SELNE|W5fI;x^j0QHB9TKGcW+*k|@U5LGM;RIqM{2d1b&Lq&bN){M$ z##^Uv4QmbC8lnmUdVB2G&z{EZcO2N(jl-RZaOdiHWWK(p){1$MbQdxV0}32ZC*;ZJ zpT%H?NASgW-}Cm>&ur!-5zIOvN)|yxxcBfI-oE^a+B#Q<12?Vj9C#V9b;Y~W%?We5 z1|AUZhzb$VTi;g|VQ%g64Hdkuhy?Hd`J0jwIVt8~=7d0V$3#e)a9}!2xH}-o^B*2Z zUv5xUP9J~5boazO&-_2eam0b+@yPl5j3#A1&)hjobt@Ux5cbV#k+24_BBw_rHEbUb-RSh!{&<(Ti#3i{52fXaOO+0~FBqo}|K3D>;`! zt1Crz`m!qK&Y(&ug>6}h4~7%GjF5zMVN+f|dm8Jy(X25H1Gs}KV<}u6kJMV}+lI#u hn5te52p`=&@gKY9WLXbZ4+a1L002ovPDHLkV1nF1Hk$wd literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/engineersdecor/textures/block/clinker_brick/clinker_brick_sastor_upplate_top_texture.png b/src/main/resources/assets/engineersdecor/textures/block/clinker_brick/clinker_brick_sastor_upplate_top_texture.png new file mode 100644 index 0000000000000000000000000000000000000000..9a77b7c913aaf71d1ef71f99ce05d4b8c9f253db GIT binary patch literal 515 zcmV+e0{s1nP)i`uRf{QmqTGm(Lt zanFUj@5d6YNoIl>;l}-SbA5auHLg?9+z1cmJu$!z0!g?TwH5&Lo`gF!Ctx_?L?&iN zRblSrNUHupeH(=D%I>Vw*i}uhg(TFCov!M}%r+GXwU}Qw2DlprWCp2j1gyERXNc{% zJ7%_jcL3H}Afe5MwF<|KI0Mp|>@(r+X01hpo(MliCs>fW#= z%nV7dnW}12-9a<1u`jES54I8R`+k$nj5i)l`$hZ zFjp1Kx%Z)J^UDN@`_I>ZrotV%u?W%*$48b2eqI-X4f#m>z^Pr9s literal 0 HcmV?d00001 diff --git a/src/main/resources/data/engineersdecor/loot_tables/blocks/clinker_brick_sastor_corner_block.json b/src/main/resources/data/engineersdecor/loot_tables/blocks/clinker_brick_sastor_corner_block.json new file mode 100644 index 0000000..8b71ae2 --- /dev/null +++ b/src/main/resources/data/engineersdecor/loot_tables/blocks/clinker_brick_sastor_corner_block.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "name": "clinker_brick_sastor_corner_block_dlt", + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + } + ], + "name": "engineersdecor:clinker_brick_sastor_corner_block" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/engineersdecor/recipes/independent/clinker_brick_sastor_corner_block_recipe.json b/src/main/resources/data/engineersdecor/recipes/independent/clinker_brick_sastor_corner_block_recipe.json new file mode 100644 index 0000000..086cf59 --- /dev/null +++ b/src/main/resources/data/engineersdecor/recipes/independent/clinker_brick_sastor_corner_block_recipe.json @@ -0,0 +1,29 @@ +{ + "type": "forge:conditional", + "recipes": [ + { + "conditions": [ + { + "type": "engineersdecor:optional", + "result": "engineersdecor:clinker_brick_sastor_corner_block", + "required": ["engineersdecor:clinker_brick_block"] + } + ], + "recipe": { + "type": "minecraft:crafting_shaped", + "pattern": [ + "BS", + "SB" + ], + "key": { + "B": { "item": "engineersdecor:clinker_brick_block" }, + "S": { "item": "minecraft:sandstone_stairs" } + }, + "result": { + "item": "engineersdecor:clinker_brick_sastor_corner_block", + "count": 4 + } + } + } + ] +} \ No newline at end of file