Fixed CFBR Iron Hatch recursion. Added scheduled Crafting Table client sync. In libmc fixed directional block default state forwarding during construction.
This commit is contained in:
parent
7e8d7780dc
commit
e8064f236f
10 changed files with 149 additions and 19 deletions
|
@ -5,4 +5,4 @@ version_minecraft=1.16.4
|
|||
version_forge_minecraft=1.16.4-35.1.10
|
||||
version_fml_mappings=20201028-1.16.3
|
||||
version_jei=1.16.4:7.6.1.63
|
||||
version_engineersdecor=1.1.8-b1
|
||||
version_engineersdecor=1.1.8-b2
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
||||
"1.16.4": {
|
||||
"1.1.8-b2": "[F] Fixed Iron Hatch isLadder bug (thx jerryw09).\n[F] Fixed Block Placer block placing pre-conditions (issue #160, ty XFactHD).\n[F] Added explicit scheduled Crafting Table client sync.\n[F] Fixed directional waterloggable block default state forwarding (issue #162, ty b52src).",
|
||||
"1.1.8-b1": "[F] Fluid Funnel waterlogged fluid picking fixed (issue #158, thx ZoMadeStuff).\n[F] Roof rendering fixes (issues #153/#159, thx Salamance73/Murph).\n[A] Recessed Clinkers, Vertically Slit Clinkers, and Structured Vertical Clinker Slab added.",
|
||||
"1.1.7": "[M] 1.16.5 support.\n[F] Fixed Labeled Crate include (issue #157, ty NillerMedDild).",
|
||||
"1.1.6": "[F] Added common-config opt-out specification for pack level opt-outs (issue #154, ty gekkone), will replace server config opt-out in MC1.17.",
|
||||
|
@ -27,6 +28,6 @@
|
|||
},
|
||||
"promos": {
|
||||
"1.16.4-recommended": "1.1.7",
|
||||
"1.16.4-latest": "1.1.8-b1"
|
||||
"1.16.4-latest": "1.1.8-b2"
|
||||
}
|
||||
}
|
|
@ -11,6 +11,11 @@ Mod sources for Minecraft version 1.16.x.
|
|||
|
||||
## Version history
|
||||
|
||||
- v1.1.8-b2 [F] Fixed Iron Hatch isLadder bug (thx jerryw09).
|
||||
[F] Fixed Block Placer block placing pre-conditions (issue #160, ty XFactHD).
|
||||
[F] Added explicit scheduled Crafting Table client sync.
|
||||
[F] Fixed directional waterloggable block default state forwarding (issue #162, ty b52src).
|
||||
|
||||
- v1.1.8-b1 [F] Fluid Funnel waterlogged fluid picking fixed (issue #158, thx ZoMadeStuff).
|
||||
[F] Roof rendering fixes (issues #153/#159, thx Salamance73/Murph).
|
||||
[A] Recessed Clinkers, Vertically Slit Clinkers, and Structured Vertical Clinker Slab added.
|
||||
|
|
|
@ -37,6 +37,7 @@ import net.minecraft.util.text.StringTextComponent;
|
|||
import net.minecraft.client.gui.widget.button.ImageButton;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
@ -158,19 +159,27 @@ public class EdCraftingTable
|
|||
}
|
||||
return stacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(BlockState state, ServerWorld world, BlockPos pos, Random rand)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
if(!(te instanceof CraftingTableTileEntity)) return;
|
||||
((CraftingTableTileEntity)te).sync();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
// Tile entity
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public static class CraftingTableTileEntity extends TileEntity implements INameable, INamedContainerProvider
|
||||
public static class CraftingTableTileEntity extends TileEntity implements INameable, INamedContainerProvider, Networking.IPacketTileNotifyReceiver
|
||||
{
|
||||
public static final int NUM_OF_STORAGE_SLOTS = 18;
|
||||
public static final int NUM_OF_STORAGE_ROWS = 2;
|
||||
public static final int NUM_OF_SLOTS = 9+NUM_OF_STORAGE_SLOTS;
|
||||
|
||||
protected Inventories.StorageInventory inventory_ = new StorageInventory(this, NUM_OF_SLOTS, 1);
|
||||
protected Inventories.StorageInventory inventory_;
|
||||
protected CompoundNBT history = new CompoundNBT();
|
||||
|
||||
public CraftingTableTileEntity()
|
||||
|
@ -179,12 +188,17 @@ public class EdCraftingTable
|
|||
public CraftingTableTileEntity(TileEntityType<?> te_type)
|
||||
{
|
||||
super(te_type);
|
||||
inventory_ = new StorageInventory(this, NUM_OF_SLOTS, 1);
|
||||
inventory_.setCloseAction((player)->{
|
||||
if(getWorld() instanceof World) {
|
||||
scheduleSync();
|
||||
BlockState state = getBlockState();
|
||||
getWorld().notifyBlockUpdate(getPos(), state, state, 1|2|16);
|
||||
}
|
||||
});
|
||||
inventory_.setSlotChangeAction((slot_index,stack)-> {
|
||||
if(slot_index < 9) scheduleSync();
|
||||
});
|
||||
}
|
||||
|
||||
public void reset()
|
||||
|
@ -256,6 +270,27 @@ public class EdCraftingTable
|
|||
@Override
|
||||
public Container createMenu( int id, PlayerInventory inventory, PlayerEntity player )
|
||||
{ return new CraftingTableContainer(id, inventory, inventory_, IWorldPosCallable.of(world, pos)); }
|
||||
|
||||
@Override
|
||||
public void onServerPacketReceived(CompoundNBT nbt)
|
||||
{ readnbt(nbt); }
|
||||
|
||||
public void sync()
|
||||
{
|
||||
if(getWorld().isRemote()) return;
|
||||
CompoundNBT nbt = new CompoundNBT();
|
||||
writenbt(nbt);
|
||||
Networking.PacketTileNotifyServerToClient.sendToPlayers(this, nbt);
|
||||
}
|
||||
|
||||
public void scheduleSync()
|
||||
{
|
||||
if(world.isRemote()) return;
|
||||
final Block crafting_table_block = getBlockState().getBlock();
|
||||
if(!(crafting_table_block instanceof CraftingTableBlock)) return;
|
||||
if(world.getPendingBlockTicks().isTickScheduled(getPos(), crafting_table_block)) return;
|
||||
world.getPendingBlockTicks().scheduleTick(getPos(), crafting_table_block, 20, TickPriority.LOW);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1476,7 +1511,14 @@ public class EdCraftingTable
|
|||
}
|
||||
}
|
||||
super.onCrafting(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onTake(PlayerEntity player, ItemStack stack)
|
||||
{
|
||||
final ItemStack result_stack = super.onTake(player, stack);
|
||||
container.sync();
|
||||
return result_stack;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,20 @@ public class EdHatchBlock extends DecorBlock.HorizontalWaterLoggable implements
|
|||
|
||||
@Override
|
||||
public boolean isLadder(BlockState state, IWorldReader world, BlockPos pos, LivingEntity entity)
|
||||
{ return state.get(OPEN) && world.getBlockState(pos.up()).isLadder(world, pos, entity); }
|
||||
{
|
||||
if(!state.get(OPEN)) return false;
|
||||
{
|
||||
final BlockState up_state = world.getBlockState(pos.up());
|
||||
if(up_state.isIn(this) && (up_state.get(OPEN))) return true;
|
||||
if(up_state.isLadder(world, pos.up(), entity)) return true;
|
||||
}
|
||||
{
|
||||
final BlockState down_state = world.getBlockState(pos.down());
|
||||
if(down_state.isIn(this) && (down_state.get(OPEN))) return true;
|
||||
if(down_state.isLadder(world, pos.down(), entity)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCreatureSpawn(BlockState state, IBlockReader world, BlockPos pos, EntitySpawnPlacementRegistry.PlacementType type, @Nullable EntityType<?> entityType)
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package wile.engineersdecor.blocks;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.inventory.container.ClickType;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.block.*;
|
||||
|
@ -454,7 +455,7 @@ public class EdPlacer
|
|||
|
||||
private boolean try_place(Direction facing, boolean triggered)
|
||||
{
|
||||
if(world.isRemote) return false;
|
||||
if(world.isRemote()) return false;
|
||||
BlockPos placement_pos = pos.offset(facing);
|
||||
if(world.getTileEntity(placement_pos) != null) return false;
|
||||
ItemStack current_stack = ItemStack.EMPTY;
|
||||
|
@ -500,21 +501,29 @@ public class EdPlacer
|
|||
placement_pos = placement_pos.up();
|
||||
}
|
||||
}
|
||||
} else if(
|
||||
(!world.getBlockState(placement_pos).getMaterial().isReplaceable()) ||
|
||||
(!world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(placement_pos), (Entity e)->{
|
||||
if(e.canBeCollidedWith()) return true;
|
||||
if(triggered) return false;
|
||||
if((e instanceof ItemEntity)) {
|
||||
if((e.getMotion().getY() > 0) || (e.getMotion().getY() < -0.5)) return true; // not falling or falling by
|
||||
if(Math.abs(e.getMotion().getX())+Math.abs(e.getMotion().getZ()) > 0) return true; // not straight
|
||||
}
|
||||
return false;
|
||||
}).isEmpty())
|
||||
} else {
|
||||
final BlockState current_placement_pos_state = world.getBlockState(placement_pos);
|
||||
@SuppressWarnings("deprecation")
|
||||
final boolean replacable = current_placement_pos_state.getMaterial().isReplaceable()
|
||||
|| current_placement_pos_state.getBlock().isReplaceable(block.getDefaultState(), Fluids.EMPTY)
|
||||
|| world.isAirBlock(placement_pos);
|
||||
if((!replacable) || (
|
||||
(!world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(placement_pos), (Entity e)->{
|
||||
if(e.canBeCollidedWith()) return true;
|
||||
if(triggered) return false;
|
||||
if((e instanceof ItemEntity)) {
|
||||
if((e.getMotion().getY() > 0) || (e.getMotion().getY() < -0.5)) return true; // not falling or falling by
|
||||
if(Math.abs(e.getMotion().getX())+Math.abs(e.getMotion().getZ()) > 0) return true; // not straight
|
||||
}
|
||||
return false;
|
||||
}).isEmpty())
|
||||
)
|
||||
) {
|
||||
block = Blocks.AIR;
|
||||
no_space = true;
|
||||
}
|
||||
}
|
||||
|
||||
// println("PLACE " + current_stack + " --> " + block + " at " + placement_pos.subtract(pos) + "( item=" + item + ")");
|
||||
if(block != Blocks.AIR) {
|
||||
try {
|
||||
|
|
|
@ -263,7 +263,7 @@ public class StandardBlocks
|
|||
public Directed(long config, Block.Properties properties, final Supplier<ArrayList<VoxelShape>> shape_supplier)
|
||||
{
|
||||
super(config, properties);
|
||||
setDefaultState(stateContainer.getBaseState().with(FACING, Direction.UP));
|
||||
setDefaultState(super.getDefaultState().with(FACING, Direction.UP));
|
||||
vshapes = shape_supplier.get();
|
||||
}
|
||||
|
||||
|
@ -338,7 +338,7 @@ public class StandardBlocks
|
|||
public Horizontal(long config, Block.Properties properties, final Supplier<ArrayList<VoxelShape>> shape_supplier)
|
||||
{
|
||||
super(config|CFG_HORIZIONTAL, properties);
|
||||
setDefaultState(stateContainer.getBaseState().with(HORIZONTAL_FACING, Direction.NORTH));
|
||||
setDefaultState(super.getDefaultState().with(HORIZONTAL_FACING, Direction.NORTH));
|
||||
vshapes = shape_supplier.get();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"type": "forge:conditional",
|
||||
"recipes": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"type": "engineersdecor:optional",
|
||||
"result": "engineersdecor:clinker_brick_slab",
|
||||
"required": ["engineersdecor:clinker_brick_block"]
|
||||
}
|
||||
],
|
||||
"recipe": {
|
||||
"type": "minecraft:stonecutting",
|
||||
"ingredient": { "item": "engineersdecor:clinker_brick_block" },
|
||||
"result": "engineersdecor:clinker_brick_slab",
|
||||
"count": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"type": "forge:conditional",
|
||||
"recipes": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"type": "engineersdecor:optional",
|
||||
"result": "engineersdecor:clinker_brick_stairs",
|
||||
"required": ["engineersdecor:clinker_brick_block"]
|
||||
}
|
||||
],
|
||||
"recipe": {
|
||||
"type": "minecraft:stonecutting",
|
||||
"ingredient": { "item": "engineersdecor:clinker_brick_block" },
|
||||
"result": "engineersdecor:clinker_brick_stairs",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"type": "forge:conditional",
|
||||
"recipes": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"type": "engineersdecor:optional",
|
||||
"result": "engineersdecor:clinker_brick_vertical_slab_structured",
|
||||
"required": ["engineersdecor:clinker_brick_block"]
|
||||
}
|
||||
],
|
||||
"recipe": {
|
||||
"type": "minecraft:stonecutting",
|
||||
"ingredient": { "item": "engineersdecor:clinker_brick_block" },
|
||||
"result": "engineersdecor:clinker_brick_vertical_slab_structured",
|
||||
"count": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue