Fluid Barrel container item defined. DataFixing added.
This commit is contained in:
parent
48748a25c5
commit
43687d835b
6 changed files with 139 additions and 3 deletions
|
@ -5,4 +5,4 @@ version_minecraft=1.16.3
|
|||
version_forge_minecraft=1.16.3-34.1.0
|
||||
version_fml_mappings=20200723-1.16.1
|
||||
version_jei=1.16.3:7.3.2.36
|
||||
version_engineersdecor=1.1.3-b3
|
||||
version_engineersdecor=1.1.3
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
||||
"1.16.3": {
|
||||
"1.1.3": "[R] Release build v1.1.3.",
|
||||
"1.1.3-b3": "[A] Metal Sliding Door added (double door wing style).\n[A] Doors implicitly open/close adjacent wings of double doors.\n[A] Disabled injected buttons from other mods in container GUIs.\n[A] Mob spawning on Rebar/Gas Concrete inhibited (IE Concrete Compliancy).\n[M] Small Tree Cutter chopping improved (loosened tree volume search restrictions).",
|
||||
"1.1.3-b2": "[A] Crafting table shift/ctrl click item move actions tweaked to new metal slot design.\n[A] Factory Dropper and Block Placer now also support quick-move-all (shift-ctrl-click).\n[F] Fixed Small Lab Furnace speed boost factor (with IE Heater in aux slot).",
|
||||
"1.1.3-b1": "[A] The Factory Block Breaker can insert items into Hoppers underneath it (issue #121, winsrp).\n[F] Help tooltips manually wrapped.\n[F] Fixed Labeled Crate item name persistence (issue #127, ty inqie).\n[F] Help text typo fixed (issue #129, ty Smollet777).",
|
||||
|
@ -15,7 +16,7 @@
|
|||
"1.1.2-b1": "[U] Ported to MC1.16.2."
|
||||
},
|
||||
"promos": {
|
||||
"1.16.3-recommended": "1.1.2",
|
||||
"1.16.3-latest": "1.1.3-b3"
|
||||
"1.16.3-recommended": "1.1.3",
|
||||
"1.16.3-latest": "1.1.3"
|
||||
}
|
||||
}
|
|
@ -11,6 +11,8 @@ Mod sources for Minecraft version 1.16.3.
|
|||
|
||||
## Version history
|
||||
|
||||
- v1.1.3 [R] Release build v1.1.3.
|
||||
|
||||
- v1.1.3-b3 [A] Metal Sliding Door added (double door wing style).
|
||||
[A] Doors implicitly open/close adjacent wings of double doors.
|
||||
[A] Disabled injected buttons from other mods in container GUIs.
|
||||
|
|
|
@ -387,6 +387,9 @@ public class EdFluidBarrel
|
|||
return (nbt.isEmpty()) ? (FluidStack.EMPTY) : (FluidStack.loadFluidStackFromNBT(nbt));
|
||||
}
|
||||
|
||||
public static ItemStack setFluid(ItemStack stack, FluidStack fs)
|
||||
{ write_fluid_nbt(stack, fs.writeToNBT(new CompoundNBT())); return stack; }
|
||||
|
||||
@Override
|
||||
public int getItemStackLimit(ItemStack stack)
|
||||
{ return (!getFluid(stack).isEmpty()) ? 1 : super.getItemStackLimit(stack); }
|
||||
|
@ -406,6 +409,18 @@ public class EdFluidBarrel
|
|||
@Override
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt)
|
||||
{ return new Fluidics.FluidContainerItemCapabilityWrapper(stack, capacity_, item_fluid_handler_transfer_rate_, (s)->read_fluid_nbt(s), (s,n)->write_fluid_nbt(s,n), e->true); }
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem(ItemStack stack)
|
||||
{ return true; }
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem(ItemStack stack)
|
||||
{
|
||||
FluidStack fs = getFluid(stack);
|
||||
fs.shrink(1000);
|
||||
return setFluid(stack, fs);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* @file DataFixing.java
|
||||
* @author Stefan Wilhelm (wile)
|
||||
* @copyright (C) 2020 Stefan Wilhelm
|
||||
* @license MIT (see https://opensource.org/licenses/MIT)
|
||||
*
|
||||
* Data fixing and mapping correction functionality encapsulation.
|
||||
*/
|
||||
package wile.engineersdecor.libmc.detail;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.event.RegistryEvent.MissingMappings.Mapping;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class DataFixing
|
||||
{
|
||||
private static String modid = "";
|
||||
private static Map<String, String> item_registry_renaming = new HashMap<>();
|
||||
private static Map<String, String> block_registry_renaming = new HashMap<>();
|
||||
|
||||
public static void init(String mod_id, @Nullable Map<String, String> item_renaming, @Nullable Map<String, String> block_renaming)
|
||||
{
|
||||
modid = mod_id;
|
||||
block_registry_renaming = new HashMap<>();
|
||||
item_registry_renaming = new HashMap<>();
|
||||
if(item_renaming!=null) item_registry_renaming.putAll(item_renaming);
|
||||
if(block_renaming!=null) { block_registry_renaming.putAll(block_renaming); item_registry_renaming.putAll(block_renaming); }
|
||||
}
|
||||
|
||||
public static void onDataFixMissingItemMapping(net.minecraftforge.event.RegistryEvent.MissingMappings<Item> event)
|
||||
{
|
||||
// Handler registered in main mod event subscription.
|
||||
for(Mapping<Item> mapping: event.getMappings()) {
|
||||
if(mapping.key.getNamespace() != modid) continue;
|
||||
final String rm = item_registry_renaming.getOrDefault(mapping.key.getPath(), "");
|
||||
if(rm.isEmpty()) continue;
|
||||
final Item item = ForgeRegistries.ITEMS.getValue(new ResourceLocation(modid, rm));
|
||||
if((item==null) || (item==Items.AIR)) continue;
|
||||
mapping.remap(item);
|
||||
}
|
||||
}
|
||||
|
||||
public static void onDataFixMissingBlockMapping(net.minecraftforge.event.RegistryEvent.MissingMappings<Block> event)
|
||||
{
|
||||
// Handler registered in main mod event subscription.
|
||||
for(Mapping<Block> mapping: event.getMappings()) {
|
||||
if(mapping.key.getNamespace() != modid) continue;
|
||||
final String rm = block_registry_renaming.getOrDefault(mapping.key.getPath(), "");
|
||||
if(rm.isEmpty()) continue;
|
||||
final Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(modid, rm));
|
||||
if((block==null) || (block==Blocks.AIR)) continue;
|
||||
mapping.remap(block);
|
||||
}
|
||||
}
|
||||
|
||||
// @todo: Find a way to register blockstate data fixing.
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"type": "forge:conditional",
|
||||
"recipes": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"type": "engineersdecor:optional",
|
||||
"result": "engineersdecor:old_industrial_wood_planks",
|
||||
"required": ["#forge:treated_wood"]
|
||||
}
|
||||
],
|
||||
"recipe": {
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"WW",
|
||||
"WC"
|
||||
],
|
||||
"key": {
|
||||
"C": { "item": "minecraft:charcoal" },
|
||||
"W": { "tag" : "forge:treated_wood" }
|
||||
},
|
||||
"result": {
|
||||
"item": "engineersdecor:old_industrial_wood_planks",
|
||||
"count": 4
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"type": "engineersdecor:optional",
|
||||
"result": "engineersdecor:old_industrial_wood_planks"
|
||||
}
|
||||
],
|
||||
"recipe": {
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"WW",
|
||||
"WC"
|
||||
],
|
||||
"key": {
|
||||
"C": { "item": "minecraft:charcoal" },
|
||||
"W": { "tag": "minecraft:planks" }
|
||||
},
|
||||
"result": {
|
||||
"item": "engineersdecor:old_industrial_wood_planks",
|
||||
"count": 4
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue