Factory Hopper entity insertion/extraction added (issue #125). Re-enabled JEI. Forge dependency updated to 1.16.3-34.1.0.
This commit is contained in:
parent
16ad286f59
commit
1753624e2a
10 changed files with 87 additions and 53 deletions
|
@ -65,8 +65,8 @@ minecraft {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "net.minecraftforge:forge:${version_forge_minecraft}"
|
minecraft "net.minecraftforge:forge:${version_forge_minecraft}"
|
||||||
//compileOnly fg.deobf("mezz.jei:jei-${version_jei}:api")
|
compileOnly fg.deobf("mezz.jei:jei-${version_jei}:api")
|
||||||
//runtimeOnly fg.deobf("mezz.jei:jei-${version_jei}")
|
runtimeOnly fg.deobf("mezz.jei:jei-${version_jei}")
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
org.gradle.daemon=false
|
org.gradle.daemon=false
|
||||||
org.gradle.jvmargs=-Xmx8G
|
org.gradle.jvmargs=-Xmx8G
|
||||||
version_minecraft=1.16.3
|
version_minecraft=1.16.3
|
||||||
version_forge_minecraft=1.16.3-34.0.1
|
version_forge_minecraft=1.16.3-34.1.0
|
||||||
version_fml_mappings=20200723-1.16.1
|
version_fml_mappings=20200723-1.16.1
|
||||||
version_jei=1.16.3:7.1.3.19
|
version_jei=1.16.3:7.3.2.36
|
||||||
version_engineersdecor=1.1.2-b8
|
version_engineersdecor=1.1.2
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
||||||
"1.16.3": {
|
"1.16.3": {
|
||||||
|
"1.1.2": "[U] Updated to Forge 1.16.3-34.1.0.\n[A] Added Factory Hopper insertion/extraction for entities like Minecarts (issue #125, ty boneskull).",
|
||||||
"1.1.2-b8": "[F] Fixed Double-T support thick steel pole connection (thx @CastCrafter).\n[A] Concrete and Clinker walls connect to windows and glass panes.",
|
"1.1.2-b8": "[F] Fixed Double-T support thick steel pole connection (thx @CastCrafter).\n[A] Concrete and Clinker walls connect to windows and glass panes.",
|
||||||
"1.1.2-b7": "[U] Ported to MC1.16.3.\n[F] Roof lighting improved.",
|
"1.1.2-b7": "[U] Ported to MC1.16.3.\n[F] Roof lighting improved.",
|
||||||
"1.1.2-b6": "[A] Signs added: Generic Caution, Magical Hazard, Radioactive Hazard, Laser Hazard, Fire Hazard, Caution Hot Surface, Magnetic Field Caution, Frost Warning.\n[A] Water Freezer added (generates Ice, Packed Ice, Blue Ice from water).\n[F] Mineral Smelter GUI model facing fixed.\n[M] Hatch handling improved.\n[M] Ladder fast-move improved.\n[F] Roof Chimney Trunk shape hollow to allow feeding IE Wire power over the roof into the building.\n[A] Roof Chimney added (smoking offset for Dark Shingle Roof Chimney Trunk block).\n[A] Metal Bar (ingredient item) added to circumvent recipe collisions with other mods.\n[M] Recipes for metallic blocks modified accordingly to depend on Metal Bars.",
|
"1.1.2-b6": "[A] Signs added: Generic Caution, Magical Hazard, Radioactive Hazard, Laser Hazard, Fire Hazard, Caution Hot Surface, Magnetic Field Caution, Frost Warning.\n[A] Water Freezer added (generates Ice, Packed Ice, Blue Ice from water).\n[F] Mineral Smelter GUI model facing fixed.\n[M] Hatch handling improved.\n[M] Ladder fast-move improved.\n[F] Roof Chimney Trunk shape hollow to allow feeding IE Wire power over the roof into the building.\n[A] Roof Chimney added (smoking offset for Dark Shingle Roof Chimney Trunk block).\n[A] Metal Bar (ingredient item) added to circumvent recipe collisions with other mods.\n[M] Recipes for metallic blocks modified accordingly to depend on Metal Bars.",
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
"1.1.2-b1": "[U] Ported to MC1.16.2."
|
"1.1.2-b1": "[U] Ported to MC1.16.2."
|
||||||
},
|
},
|
||||||
"promos": {
|
"promos": {
|
||||||
"1.16.3-recommended": "1.1.2-b8",
|
"1.16.3-recommended": "1.1.2",
|
||||||
"1.16.3-latest": "1.1.2-b8"
|
"1.16.3-latest": "1.1.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,6 +11,9 @@ Mod sources for Minecraft version 1.16.3.
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
- v1.1.2 [U] Updated to Forge 1.16.3-34.1.0.
|
||||||
|
[A] Added Factory Hopper insertion/extraction for entities like Minecarts (issue #125, ty boneskull).
|
||||||
|
|
||||||
- v1.1.2-b8 [F] Fixed Double-T support thick steel pole connection (thx @CastCrafter).
|
- v1.1.2-b8 [F] Fixed Double-T support thick steel pole connection (thx @CastCrafter).
|
||||||
[A] Concrete and Clinker walls connect to windows and glass panes.
|
[A] Concrete and Clinker walls connect to windows and glass panes.
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,7 @@
|
||||||
*/
|
*/
|
||||||
package wile.engineersdecor.blocks;
|
package wile.engineersdecor.blocks;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
|
||||||
import net.minecraft.world.IWorldReader;
|
import net.minecraft.world.IWorldReader;
|
||||||
import wile.engineersdecor.ModContent;
|
|
||||||
import wile.engineersdecor.ModEngineersDecor;
|
|
||||||
import wile.engineersdecor.libmc.detail.Auxiliaries;
|
|
||||||
import wile.engineersdecor.libmc.detail.Inventories;
|
|
||||||
import wile.engineersdecor.libmc.detail.Networking;
|
|
||||||
import wile.engineersdecor.libmc.detail.Inventories.SlotRange;
|
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -52,7 +45,14 @@ import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
import wile.engineersdecor.ModContent;
|
||||||
|
import wile.engineersdecor.ModEngineersDecor;
|
||||||
|
import wile.engineersdecor.libmc.detail.Auxiliaries;
|
||||||
|
import wile.engineersdecor.libmc.detail.Inventories;
|
||||||
|
import wile.engineersdecor.libmc.detail.Networking;
|
||||||
|
import wile.engineersdecor.libmc.detail.Inventories.SlotRange;
|
||||||
import wile.engineersdecor.libmc.detail.TooltipDisplay;
|
import wile.engineersdecor.libmc.detail.TooltipDisplay;
|
||||||
import wile.engineersdecor.libmc.detail.TooltipDisplay.TipRange;
|
import wile.engineersdecor.libmc.detail.TooltipDisplay.TipRange;
|
||||||
|
|
||||||
|
@ -459,6 +459,12 @@ public class EdHopper
|
||||||
|
|
||||||
// ITickable and aux methods ---------------------------------------------------------------------
|
// ITickable and aux methods ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
private IItemHandler inventory_entity_handler(BlockPos where)
|
||||||
|
{
|
||||||
|
final List<Entity> entities = world.getEntitiesInAABBexcluding(null, (new AxisAlignedBB(where)), EntityPredicates.HAS_INVENTORY);
|
||||||
|
return entities.isEmpty() ? null : Inventories.itemhandler(entities.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
private static int next_slot(int i)
|
private static int next_slot(int i)
|
||||||
{ return (i<NUM_OF_SLOTS-1) ? (i+1) : 0; }
|
{ return (i<NUM_OF_SLOTS-1) ? (i+1) : 0; }
|
||||||
|
|
||||||
|
@ -505,17 +511,28 @@ public class EdHopper
|
||||||
current_slot_index_ = 0;
|
current_slot_index_ = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final TileEntity te = world.getTileEntity(pos.offset(facing));
|
final BlockPos facing_pos = pos.offset(facing);
|
||||||
if(te == null) { delay_timer_ = TICK_INTERVAL+2; return false; } // no reason to recalculate this all the time if there is nothere to insert.
|
IItemHandler ih = null;
|
||||||
final IItemHandler ih = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()).orElse(null);
|
// Tile entity insertion check
|
||||||
|
{
|
||||||
|
final TileEntity te = world.getTileEntity(facing_pos);
|
||||||
|
if(te != null) {
|
||||||
|
ih = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()).orElse(null);
|
||||||
if(ih == null) { delay_timer_ = TICK_INTERVAL+2; return false; }
|
if(ih == null) { delay_timer_ = TICK_INTERVAL+2; return false; }
|
||||||
if(te instanceof net.minecraft.tileentity.HopperTileEntity) {
|
if(te instanceof net.minecraft.tileentity.HopperTileEntity) {
|
||||||
Direction f = world.getBlockState(pos.offset(facing)).get(net.minecraft.block.HopperBlock.FACING);
|
Direction f = world.getBlockState(facing_pos).get(net.minecraft.block.HopperBlock.FACING);
|
||||||
if(f==facing.getOpposite()) return false; // no back transfer
|
if(f==facing.getOpposite()) return false; // no back transfer
|
||||||
} else if(te instanceof EdHopper.HopperTileEntity) {
|
} else if(te instanceof EdHopper.HopperTileEntity) {
|
||||||
Direction f = world.getBlockState(pos.offset(facing)).get(EdHopper.HopperBlock.FACING);
|
Direction f = world.getBlockState(facing_pos).get(EdHopper.HopperBlock.FACING);
|
||||||
if(f==facing.getOpposite()) return false;
|
if(f==facing.getOpposite()) return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Entity insertion check
|
||||||
|
if(ih == null) ih = inventory_entity_handler(facing_pos);
|
||||||
|
if(ih == null) { delay_timer_ = TICK_INTERVAL+2; return false; } // no reason to recalculate this all the time if there is nowhere to insert.
|
||||||
|
// Handler insertion
|
||||||
|
{
|
||||||
ItemStack insert_stack = current_stack.copy();
|
ItemStack insert_stack = current_stack.copy();
|
||||||
if(insert_stack.getCount() > transfer_count_) insert_stack.setCount(transfer_count_);
|
if(insert_stack.getCount() > transfer_count_) insert_stack.setCount(transfer_count_);
|
||||||
final int initial_insert_stack_size = insert_stack.getCount();
|
final int initial_insert_stack_size = insert_stack.getCount();
|
||||||
|
@ -542,6 +559,7 @@ public class EdHopper
|
||||||
if(!insert_stack.isEmpty()) current_slot_index_ = next_slot(current_slot_index_);
|
if(!insert_stack.isEmpty()) current_slot_index_ = next_slot(current_slot_index_);
|
||||||
return (num_inserted > 0);
|
return (num_inserted > 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean try_item_handler_extract(final IItemHandler ih)
|
private boolean try_item_handler_extract(final IItemHandler ih)
|
||||||
{
|
{
|
||||||
|
@ -643,15 +661,20 @@ public class EdHopper
|
||||||
if(rssignal || pulse_mode) {
|
if(rssignal || pulse_mode) {
|
||||||
Direction hopper_input_facing = (hopper_facing==Direction.UP) ? Direction.DOWN : Direction.UP;
|
Direction hopper_input_facing = (hopper_facing==Direction.UP) ? Direction.DOWN : Direction.UP;
|
||||||
TileEntity te = world.getTileEntity(pos.offset(hopper_input_facing));
|
TileEntity te = world.getTileEntity(pos.offset(hopper_input_facing));
|
||||||
final IItemHandler ih = (te==null) ? (null) : (te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, hopper_input_facing.getOpposite()).orElse(null));
|
IItemHandler ih = (te==null) ? (null) : (te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, hopper_input_facing.getOpposite()).orElse(null));
|
||||||
if((ih != null) || (te instanceof ISidedInventory)) {
|
if((ih != null) || (te instanceof ISidedInventory)) {
|
||||||
// IItemHandler pulling
|
// Tile Entity pulling
|
||||||
if((ih != null)) {
|
if((ih != null)) {
|
||||||
if(try_item_handler_extract(ih)) dirty = true;
|
if(try_item_handler_extract(ih)) dirty = true;
|
||||||
} else {
|
} else {
|
||||||
if(try_inventory_extract((IInventory)te)) dirty = true;
|
if(try_inventory_extract((IInventory)te)) dirty = true;
|
||||||
}
|
}
|
||||||
} else if((collection_timer_ -= TICK_INTERVAL) <= 0) {
|
}
|
||||||
|
if(ih==null) {
|
||||||
|
ih = inventory_entity_handler(pos.offset(hopper_input_facing));
|
||||||
|
if((ih!=null) && (try_item_handler_extract(ih))) dirty = true;
|
||||||
|
}
|
||||||
|
if((ih==null) && (collection_timer_ -= TICK_INTERVAL) <= 0) {
|
||||||
// Ranged collection
|
// Ranged collection
|
||||||
collection_timer_ = COLLECTION_INTERVAL;
|
collection_timer_ = COLLECTION_INTERVAL;
|
||||||
if(try_collect(hopper_input_facing)) dirty = true;
|
if(try_collect(hopper_input_facing)) dirty = true;
|
||||||
|
|
|
@ -7,9 +7,8 @@
|
||||||
* JEI plugin (see https://github.com/mezz/JustEnoughItems/wiki/Creating-Plugins)
|
* JEI plugin (see https://github.com/mezz/JustEnoughItems/wiki/Creating-Plugins)
|
||||||
*/
|
*/
|
||||||
package wile.engineersdecor.eapi.jei;
|
package wile.engineersdecor.eapi.jei;
|
||||||
public class JEIPlugin {}
|
//public class JEIPlugin {}
|
||||||
|
|
||||||
/*
|
|
||||||
import wile.engineersdecor.ModEngineersDecor;
|
import wile.engineersdecor.ModEngineersDecor;
|
||||||
import wile.engineersdecor.ModConfig;
|
import wile.engineersdecor.ModConfig;
|
||||||
import wile.engineersdecor.ModContent;
|
import wile.engineersdecor.ModContent;
|
||||||
|
@ -75,4 +74,3 @@ public class JEIPlugin implements mezz.jei.api.IModPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
|
@ -8,6 +8,7 @@
|
||||||
*/
|
*/
|
||||||
package wile.engineersdecor.libmc.detail;
|
package wile.engineersdecor.libmc.detail;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.inventory.ItemStackHelper;
|
import net.minecraft.inventory.ItemStackHelper;
|
||||||
|
@ -50,6 +51,12 @@ public class Inventories
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IItemHandler itemhandler(Entity entity)
|
||||||
|
{ return (entity instanceof IInventory) ? (new InvWrapper((IInventory)entity)) : null; }
|
||||||
|
|
||||||
|
public static IItemHandler itemhandler(Entity entity, @Nullable Direction side)
|
||||||
|
{ return (entity instanceof IInventory) ? (new InvWrapper((IInventory)entity)) : null; } // in case a sided entity insertion pops up.
|
||||||
|
|
||||||
public static ItemStack insert(IItemHandler handler, ItemStack stack , boolean simulate)
|
public static ItemStack insert(IItemHandler handler, ItemStack stack , boolean simulate)
|
||||||
{ return ItemHandlerHelper.insertItemStacked(handler, stack, simulate); }
|
{ return ItemHandlerHelper.insertItemStacked(handler, stack, simulate); }
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ logoFile="logo.png"
|
||||||
[[dependencies.engineersdecor]]
|
[[dependencies.engineersdecor]]
|
||||||
modId="forge"
|
modId="forge"
|
||||||
mandatory=true
|
mandatory=true
|
||||||
versionRange="[34.0.1,)"
|
versionRange="[34.1.0,)"
|
||||||
ordering="NONE"
|
ordering="NONE"
|
||||||
side="BOTH"
|
side="BOTH"
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
"engineersdecor:rebar_concrete_slab",
|
"engineersdecor:rebar_concrete_slab",
|
||||||
"engineersdecor:rebar_concrete_tile_slab",
|
"engineersdecor:rebar_concrete_tile_slab",
|
||||||
"engineersdecor:gas_concrete_slab",
|
"engineersdecor:gas_concrete_slab",
|
||||||
"engineersdecor:panzerglass_slab"
|
"engineersdecor:panzerglass_slab",
|
||||||
|
"engineersdecor:old_industrial_wood_slab"
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@
|
||||||
"engineersdecor:slag_brick_stairs",
|
"engineersdecor:slag_brick_stairs",
|
||||||
"engineersdecor:rebar_concrete_stairs",
|
"engineersdecor:rebar_concrete_stairs",
|
||||||
"engineersdecor:rebar_concrete_tile_stairs",
|
"engineersdecor:rebar_concrete_tile_stairs",
|
||||||
"engineersdecor:gas_concrete_stairs"
|
"engineersdecor:gas_concrete_stairs",
|
||||||
|
"engineersdecor:old_industrial_wood_stairs"
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue