Updated to 1.16.2.

This commit is contained in:
stfwi 2020-08-16 16:16:19 +02:00
parent 267233d994
commit 640ede7570
71 changed files with 2369 additions and 794 deletions

View file

@ -114,7 +114,6 @@ public class ModConfig
public final ForgeConfigSpec.BooleanValue without_lab_furnace;
public final ForgeConfigSpec.BooleanValue without_electrical_furnace;
public final ForgeConfigSpec.BooleanValue without_valves;
public final ForgeConfigSpec.BooleanValue without_passive_fluid_accumulator;
public final ForgeConfigSpec.BooleanValue without_waste_incinerator;
public final ForgeConfigSpec.BooleanValue without_factory_dropper;
public final ForgeConfigSpec.BooleanValue without_factory_hopper;
@ -267,10 +266,6 @@ public class ModConfig
.translation(MODID + ".config.without_valves")
.comment("Disable check valve, and redstone controlled valves.")
.define("without_valves", false);
without_passive_fluid_accumulator = builder
.translation(MODID + ".config.without_passive_fluid_accumulator")
.comment("Disable the passive fluid accumulator.")
.define("without_passive_fluid_accumulator", false);
without_waste_incinerator = builder
.translation(MODID + ".config.without_waste_incinerator")
.comment("Disable item disposal/trash/void incinerator device.")
@ -521,8 +516,6 @@ public class ModConfig
// Cache
//--------------------------------------------------------------------------------------------------------------------
@Deprecated
private static String const_exclude_patterns = "dark_shingle_*"; // experimental
private static final CompoundNBT server_config_ = new CompoundNBT();
private static HashSet<String> optouts_ = new HashSet<>();
private static boolean with_experimental_features_ = false;
@ -553,7 +546,6 @@ public class ModConfig
{
String exc = SERVER.pattern_excludes.get().toLowerCase().replaceAll(MODID+":", "").replaceAll("[^*_,a-z0-9]", "");
if(!exc.isEmpty()) LOGGER.info("Config pattern excludes: '" + exc + "'");
if(!const_exclude_patterns.isEmpty()) exc += "," + const_exclude_patterns;
String[] excl = exc.split(",");
excludes_.clear();
for(int i=0; i< excl.length; ++i) {
@ -574,9 +566,9 @@ public class ModConfig
ModContent.getRegisteredBlocks().stream().filter((Block block) -> {
if(block==null) return true;
if(block==ModContent.SIGN_MODLOGO) return true;
if(COMMON==null) return false;
if(SERVER==null) return false;
try {
if(!SERVER.with_experimental.get()) {
if(!with_experimental_features_) {
if(block instanceof Auxiliaries.IExperimentalFeature) return true;
if(ModContent.isExperimentalBlock(block)) return true;
}
@ -610,7 +602,6 @@ public class ModConfig
if(block instanceof EdCraftingTable.CraftingTableBlock) return SERVER.without_crafting_table.get();
if(block instanceof EdElectricalFurnace.ElectricalFurnaceBlock) return SERVER.without_electrical_furnace.get();
if((block instanceof EdFurnace.FurnaceBlock)&&(!(block instanceof EdElectricalFurnace.ElectricalFurnaceBlock))) return SERVER.without_lab_furnace.get();
if(block instanceof EdFluidAccumulator.FluidAccumulatorBlock) return SERVER.without_passive_fluid_accumulator.get();
if(block instanceof EdWasteIncinerator.WasteIncineratorBlock) return SERVER.without_waste_incinerator.get();
if(block instanceof EdDropper.DropperBlock) return SERVER.without_factory_dropper.get();
if(block instanceof EdPlacer.PlacerBlock) return SERVER.without_factory_placer.get();

View file

@ -212,17 +212,17 @@ public class ModContent
// -------------------------------------------------------------------------------------------------------------------
public static final EdRoofBlock DARK_CERAMIC_SHINGLE_ROOF = (EdRoofBlock)(new EdRoofBlock(
DecorBlock.CFG_DEFAULT,
DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 15f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "dark_shingle_roof"));
public static final DecorBlock.Normal DARK_CERAMIC_SHINGLE_ROOF_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal(
DecorBlock.CFG_DEFAULT,
DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 15f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "dark_shingle_roof_block"));
public static final EdSlabBlock DARK_CERAMIC_SHINGLE_ROOF_SLAB = (EdSlabBlock)(new EdSlabBlock(
DecorBlock.CFG_DEFAULT,
DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 15f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "dark_shingle_roof_slab"));
@ -231,6 +231,21 @@ public class ModContent
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 15f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "dark_shingle_roof_slabslice"));
public static final EdRoofBlock DARK_CERAMIC_SHINGLE_ROOF_METALIZED = (EdRoofBlock)(new EdRoofBlock(
DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 15f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "dark_shingle_roof_metallized"));
public static final EdRoofBlock DARK_CERAMIC_SHINGLE_ROOF_SKYLIGHT = (EdRoofBlock)(new EdRoofBlock(
DecorBlock.CFG_TRANSLUCENT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 15f).sound(SoundType.STONE).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "dark_shingle_roof_skylight"));
public static final EdRoofBlock DARK_CERAMIC_SHINGLE_ROOF_CHIMNEYTRUNK = (EdRoofBlock)(new EdRoofBlock(
DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 15f).sound(SoundType.STONE)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "dark_shingle_roof_chimneytrunk"));
// -------------------------------------------------------------------------------------------------------------------
public static final EdGroundBlock DENSE_GRIT_SAND = (EdGroundBlock)(new EdGroundBlock(
@ -466,7 +481,6 @@ public class ModContent
// -------------------------------------------------------------------------------------------------------------------
@Deprecated // @todo: rename to "crafting_table" in 1.16.2 or 1.17
public static final EdCraftingTable.CraftingTableBlock CRAFTING_TABLE = (EdCraftingTable.CraftingTableBlock)(new EdCraftingTable.CraftingTableBlock(
DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 15f).sound(SoundType.METAL).notSolid(),
@ -474,7 +488,7 @@ public class ModContent
Auxiliaries.getPixeledAABB(0,15,0, 16,16,16),
Auxiliaries.getPixeledAABB(1, 0,1, 15,16,15)
}
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "treated_wood_crafting_table"));
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "metal_crafting_table"));
public static final FurnaceBlock SMALL_LAB_FURNACE = (FurnaceBlock)(new FurnaceBlock(
DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
@ -654,13 +668,10 @@ public class ModContent
}
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "straight_pipe_valve_redstone_analog"));
public static final EdFluidAccumulator.FluidAccumulatorBlock PASSIVE_FLUID_ACCUMULATOR = (EdFluidAccumulator.FluidAccumulatorBlock)(new EdFluidAccumulator.FluidAccumulatorBlock(
DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL).notSolid(),
new AxisAlignedBB[]{
Auxiliaries.getPixeledAABB(3,3,0, 13,13, 1),
Auxiliaries.getPixeledAABB(0,0,1, 16,16,16)
}
@Deprecated // remove in 1.17/1.16.3, not needed by anyone
public static final DecorBlock.Normal PASSIVE_FLUID_ACCUMULATOR = (DecorBlock.Normal)(new DecorBlock.Normal(
DecorBlock.CFG_EXPERIMENTAL,
Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 15f).sound(SoundType.METAL)
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "passive_fluid_accumulator"));
public static final EdFluidBarrel.FluidBarrelBlock FLUID_BARREL = (EdFluidBarrel.FluidBarrelBlock)(new EdFluidBarrel.FluidBarrelBlock(
@ -693,18 +704,6 @@ public class ModContent
// -------------------------------------------------------------------------------------------------------------------
//todo: REMOVE IN 1.17/1.16.2
@Deprecated
public static final EdWallBlock CONCRETE_WALL = (EdWallBlock)(new EdWallBlock(
DecorBlock.CFG_CUTOUT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 50f).sound(SoundType.STONE).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "concrete_wall"));
public static final EdSlabSliceBlock HALFSLAB_CONCRETE = (EdSlabSliceBlock)(new EdSlabSliceBlock(
DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1f, 10f).sound(SoundType.STONE).notSolid()
)).setRegistryName(new ResourceLocation(ModEngineersDecor.MODID, "halfslab_concrete"));
public static final EdSlabSliceBlock HALFSLAB_TREATEDWOOD = (EdSlabSliceBlock)(new EdSlabSliceBlock(
DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT,
Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 4f).sound(SoundType.WOOD).notSolid()
@ -805,17 +804,18 @@ public class ModContent
GAS_CONCRETE_WALL,
HALFSLAB_REBARCONCRETE,
HALFSLAB_GASCONCRETE,
HALFSLAB_CONCRETE,
HALFSLAB_TREATEDWOOD,
HALFSLAB_SHEETMETALIRON,
HALFSLAB_SHEETMETALSTEEL,
HALFSLAB_SHEETMETALCOPPER,
HALFSLAB_SHEETMETALGOLD,
HALFSLAB_SHEETMETALALUMINIUM,
CONCRETE_WALL,
PANZERGLASS_BLOCK,
PANZERGLASS_SLAB,
DARK_CERAMIC_SHINGLE_ROOF,
DARK_CERAMIC_SHINGLE_ROOF_METALIZED,
DARK_CERAMIC_SHINGLE_ROOF_SKYLIGHT,
DARK_CERAMIC_SHINGLE_ROOF_CHIMNEYTRUNK,
DARK_CERAMIC_SHINGLE_ROOF_BLOCK,
DARK_CERAMIC_SHINGLE_ROOF_SLAB,
HALFSLAB_DARK_CERAMIC_SHINGLE_ROOF,
@ -912,11 +912,6 @@ public class ModContent
.build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_pipe_valve");
public static final TileEntityType<?> TET_PASSIVE_FLUID_ACCUMULATOR = TileEntityType.Builder
.create(EdFluidAccumulator.FluidAccumulatorTileEntity::new, PASSIVE_FLUID_ACCUMULATOR)
.build(null)
.setRegistryName(ModEngineersDecor.MODID, "te_passive_fluid_accumulator");
public static final TileEntityType<?> TET_FLUID_BARREL = TileEntityType.Builder
.create(EdFluidBarrel.FluidBarrelTileEntity::new, FLUID_BARREL)
.build(null)
@ -968,7 +963,6 @@ public class ModContent
TET_SMALL_MILKING_MACHINE,
TET_STRAIGHT_PIPE_VALVE,
TET_FLUID_BARREL,
TET_PASSIVE_FLUID_ACCUMULATOR,
TET_SMALL_FLUID_FUNNEL,
TET_TEST_BLOCK
};
@ -1050,8 +1044,9 @@ public class ModContent
return blocks;
}
@SuppressWarnings("deprecation")
public static boolean isExperimentalBlock(Block block)
{ return ArrayUtils.contains(devBlocks, block); }
{ return ArrayUtils.contains(devBlocks, block) || ((block instanceof IDecorBlock) && ((((IDecorBlock)block).config() & DecorBlock.CFG_EXPERIMENTAL))!=0); }
@Nonnull
public static List<Block> getRegisteredBlocks()

View file

@ -46,6 +46,8 @@ public class ModEngineersDecor
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onSendImc);
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onRecvImc);
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientSetup);
FMLJavaModLoadingContext.get().getModEventBus().addListener(ForgeEvents::onConfigLoad);
FMLJavaModLoadingContext.get().getModEventBus().addListener(ForgeEvents::onConfigReload);
ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.SERVER, ModConfig.SERVER_CONFIG_SPEC);
ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.CLIENT, ModConfig.CLIENT_CONFIG_SPEC);
MinecraftForge.EVENT_BUS.register(this);
@ -119,11 +121,9 @@ public class ModEngineersDecor
public static void onServerStarting(FMLServerStartingEvent event)
{}
@SubscribeEvent
public static void onConfigLoad(net.minecraftforge.fml.config.ModConfig.Loading configEvent)
{ config_loaded = true; }
@SubscribeEvent
public static void onConfigReload(net.minecraftforge.fml.config.ModConfig.Reloading configEvent)
{
try {

View file

@ -39,6 +39,7 @@ public class DecorBlock
public static final long CFG_STRICT_CONNECTIONS = StandardBlocks.CFG_STRICT_CONNECTIONS;
public static final long CFG_AI_PASSABLE = StandardBlocks.CFG_AI_PASSABLE;
public static final long CFG_HARD_IE_DEPENDENT = 0x8000000000000000L;
@Deprecated public static final long CFG_EXPERIMENTAL = 0x4000000000000000L;
public static class Normal extends StandardBlocks.BaseBlock implements IDecorBlock
{

View file

@ -126,7 +126,7 @@ public class EdCraftingTable
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, final TileEntity te, boolean explosion)
public List<ItemStack> dropList(BlockState state, World world, final TileEntity te, boolean explosion)
{
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;

View file

@ -141,7 +141,7 @@ public class EdDropper
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, final TileEntity te, boolean explosion)
public List<ItemStack> dropList(BlockState state, World world, final TileEntity te, boolean explosion)
{
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;

View file

@ -1,273 +0,0 @@
/*
* @file EdFluidAccumulator.java
* @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT)
*
* A device that collects fluids from adjacent tank outputs
* when a pump drains on the (only) output side. Shall support
* high flow rates, and a vavuum suction delay. Shall not drain
* high amounts of fluid from the adjacent tanks when no fluid
* is requested at the output port. Shall drain balanced from
* the adjacent input sides.
*/
package wile.engineersdecor.blocks;
import wile.engineersdecor.ModContent;
import wile.engineersdecor.libmc.detail.Auxiliaries;
import net.minecraft.world.World;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
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 javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class EdFluidAccumulator
{
//--------------------------------------------------------------------------------------------------------------------
// Block
//--------------------------------------------------------------------------------------------------------------------
public static class FluidAccumulatorBlock extends DecorBlock.Directed implements IDecorBlock
{
public FluidAccumulatorBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABB)
{ super(config, builder, unrotatedAABB); }
@Override
public boolean hasTileEntity(BlockState state)
{ return true; }
@Override
@Nullable
public TileEntity createTileEntity(BlockState state, IBlockReader world)
{ return new EdFluidAccumulator.FluidAccumulatorTileEntity(); }
@Override
@SuppressWarnings("deprecation")
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult)
{
if(world.isRemote) return ActionResultType.SUCCESS;
TileEntity te = world.getTileEntity(pos);
if(!(te instanceof FluidAccumulatorTileEntity)) return ActionResultType.FAIL;
((FluidAccumulatorTileEntity)te).send_device_stats(player);
return ActionResultType.SUCCESS;
}
@Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused)
{
TileEntity te = world.getTileEntity(pos);
if(te instanceof FluidAccumulatorTileEntity) ((FluidAccumulatorTileEntity)te).block_changed();
}
}
//--------------------------------------------------------------------------------------------------------------------
// Tile entity
//--------------------------------------------------------------------------------------------------------------------
public static class FluidAccumulatorTileEntity extends TileEntity implements ITickableTileEntity, ICapabilityProvider
{
protected static int tick_idle_interval = 20; // ca 1000ms, simulates suction delay and saves CPU when not drained.
protected static int max_flowrate = 1000;
private Direction block_facing_ = Direction.NORTH;
private FluidStack tank_ = FluidStack.EMPTY;
private int last_drain_request_amount_ = 0;
private int vacuum_ = 0;
private int tick_timer_ = 0;
private int round_robin_ = 0;
private boolean initialized_ = false;
private int total_volume_filled_ = 0;
private int total_volume_drained_ = 0;
public void send_device_stats(PlayerEntity player)
{
int t_vol = tank_.getAmount();
Auxiliaries.playerChatMessage(player,"" + t_vol + "mB");
}
public void block_changed()
{ initialized_ = false; tick_timer_ = MathHelper.clamp(tick_timer_ , 0, tick_idle_interval); }
// TileEntity ------------------------------------------------------------------------------
public FluidAccumulatorTileEntity()
{ this(ModContent.TET_PASSIVE_FLUID_ACCUMULATOR); }
public FluidAccumulatorTileEntity(TileEntityType<?> te_type)
{ super(te_type); }
@Override
public void func_230337_a_(BlockState state, CompoundNBT nbt)
{
super.func_230337_a_(state, nbt);
tank_ = (!nbt.contains("tank")) ? (FluidStack.EMPTY) : (FluidStack.loadFluidStackFromNBT(nbt.getCompound("tank")));
}
@Override
public CompoundNBT write(CompoundNBT nbt)
{
super.write(nbt);
if(!tank_.isEmpty()) nbt.put("tank", tank_.writeToNBT(new CompoundNBT()));
return nbt;
}
@Override
public void remove()
{
super.remove();
fill_handler_.invalidate();
fluid_handler_.invalidate();
}
// Input flow handler ---------------------------------------------------------------------
private static class InputFillHandler implements IFluidHandler
{
private final FluidAccumulatorTileEntity parent_;
InputFillHandler(FluidAccumulatorTileEntity parent) { parent_ = parent; }
@Override public int getTanks() { return 0; }
@Override public FluidStack getFluidInTank(int tank) { return FluidStack.EMPTY; }
@Override public int getTankCapacity(int tank) { return max_flowrate; }
@Override public boolean isFluidValid(int tank, @Nonnull FluidStack stack) { return true; }
@Override public int fill(FluidStack resource, FluidAction action) { return 0; }
@Override public FluidStack drain(FluidStack resource, FluidAction action) { return FluidStack.EMPTY; }
@Override public FluidStack drain(int maxDrain, FluidAction action) { return FluidStack.EMPTY; }
}
// Output flow handler ---------------------------------------------------------------------
private static class OutputFlowHandler implements IFluidHandler
{
private final FluidAccumulatorTileEntity te;
OutputFlowHandler(FluidAccumulatorTileEntity parent) { te = parent; }
@Override public int getTanks() { return 1; }
@Override public FluidStack getFluidInTank(int tank) { return te.tank_.copy(); }
@Override public int getTankCapacity(int tank) { return max_flowrate; }
@Override public boolean isFluidValid(int tank, @Nonnull FluidStack stack) { return true; }
@Override public int fill(FluidStack resource, FluidAction action) { return 0; }
@Override public FluidStack drain(FluidStack resource, FluidAction action)
{
if((resource==null) || (te.tank_.isEmpty())) return FluidStack.EMPTY;
return (!(te.tank_.isFluidEqual(resource))) ? (FluidStack.EMPTY) : drain(resource.getAmount(), action);
}
@Override public FluidStack drain(int maxDrain, FluidAction action)
{
if(!te.initialized_) return FluidStack.EMPTY;
if((action==FluidAction.EXECUTE) && (maxDrain > 0)) te.last_drain_request_amount_ = maxDrain;
if(te.tank_.isEmpty()) return FluidStack.EMPTY;
maxDrain = MathHelper.clamp(maxDrain ,0 , te.tank_.getAmount());
FluidStack res = te.tank_.copy();
if(action!=FluidAction.EXECUTE) return res;
res.setAmount(maxDrain);
te.tank_.setAmount(te.tank_.getAmount()-maxDrain);
if(te.tank_.getAmount() <= 0) te.tank_ = FluidStack.EMPTY;
te.total_volume_drained_ += res.getAmount();
return res;
}
}
// ICapabilityProvider --------------------------------------------------------------------
private final LazyOptional<IFluidHandler> fluid_handler_ = LazyOptional.of(() -> new OutputFlowHandler(this));
private final LazyOptional<IFluidHandler> fill_handler_ = LazyOptional.of(() -> new InputFillHandler(this));
@Override
public <T> LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing)
{
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
if(initialized_) {
if(facing == block_facing_) return fluid_handler_.cast();
if(facing != null) return fill_handler_.cast();
}
return LazyOptional.empty();
}
return super.getCapability(capability, facing);
}
// ITickable--------------------------------------------------------------------------------
public void tick()
{
if((world.isRemote) || (--tick_timer_ > 0)) return;
tick_timer_ = tick_idle_interval;
BlockState state = world.getBlockState(pos);
if(!(state.getBlock() instanceof FluidAccumulatorBlock)) return;
if(!initialized_) {
initialized_ = true;
block_facing_ = state.get(FluidAccumulatorBlock.FACING);
}
int n_requested = last_drain_request_amount_;
last_drain_request_amount_ = 0;
if(n_requested > 0) {
vacuum_ += 2;
if(vacuum_ > 5) vacuum_ = 5;
} else {
if((--vacuum_) <= 0) {
vacuum_ = 0;
if(!tank_.isEmpty()) {
return; // nothing to do, noone's draining.
} else {
n_requested = 10; // drip in
}
}
}
boolean has_refilled = false;
n_requested += (vacuum_ * 50);
int tank_buffer_needed = n_requested;
if(tank_buffer_needed > max_flowrate) tank_buffer_needed = max_flowrate;
for(int i=0; i<6; ++i) {
if(++round_robin_ > 5) round_robin_ = 0;
if(n_requested <= 0) break;
if((tank_.getAmount() >= tank_buffer_needed)) break;
final Direction f = Direction.byIndex(round_robin_);
if(f == block_facing_) continue;
final TileEntity te = world.getTileEntity(pos.offset(f));
if((te==null) || (te instanceof FluidAccumulatorTileEntity)) continue;
final IFluidHandler fh = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, f.getOpposite()).orElse(null);
if(fh==null) continue;
if(tank_.isEmpty()) {
FluidStack res = fh.drain(n_requested, FluidAction.EXECUTE).copy();
if(res.isEmpty()) continue;
total_volume_filled_ += res.getAmount();
tank_ = res.copy();
has_refilled = true;
} else {
if((tank_.getAmount() + n_requested) > max_flowrate) n_requested = (max_flowrate - tank_.getAmount());
FluidStack rq = tank_.copy();
rq.setAmount(n_requested);
FluidStack res = fh.drain(rq, FluidAction.SIMULATE);
if(!res.isFluidEqual(rq)) continue;
res = fh.drain(rq, FluidAction.EXECUTE);
if(res.isEmpty()) continue;
tank_.setAmount(tank_.getAmount()+res.getAmount());
total_volume_filled_ += res.getAmount();
has_refilled = true;
if(tank_.getAmount() >= max_flowrate) break;
}
}
if(has_refilled) tick_timer_ = 0;
}
}
}

View file

@ -100,7 +100,7 @@ public class EdFluidBarrel
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, final TileEntity te, boolean explosion)
public List<ItemStack> dropList(BlockState state, World world, final TileEntity te, boolean explosion)
{
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;

View file

@ -119,7 +119,7 @@ public class EdFluidFunnel
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, final TileEntity te, boolean explosion)
public List<ItemStack> dropList(BlockState state, World world, final TileEntity te, boolean explosion)
{
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;

View file

@ -134,7 +134,7 @@ public class EdFurnace
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, final TileEntity te, boolean explosion) {
public List<ItemStack> dropList(BlockState state, World world, final TileEntity te, boolean explosion) {
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;
if(!(te instanceof FurnaceTileEntity)) return stacks;

View file

@ -119,7 +119,7 @@ public class EdHopper
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, final TileEntity te, boolean explosion)
public List<ItemStack> dropList(BlockState state, World world, final TileEntity te, boolean explosion)
{
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;

View file

@ -123,7 +123,7 @@ public class EdLabeledCrate
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, final TileEntity te, boolean explosion)
public List<ItemStack> dropList(BlockState state, World world, final TileEntity te, boolean explosion)
{
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;

View file

@ -103,7 +103,7 @@ public class EdMineralSmelter
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, TileEntity te, boolean explosion)
public List<ItemStack> dropList(BlockState state, World world, TileEntity te, boolean explosion)
{
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;

View file

@ -114,7 +114,7 @@ public class EdPlacer
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, final TileEntity te, boolean explosion)
public List<ItemStack> dropList(BlockState state, World world, final TileEntity te, boolean explosion)
{
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;

View file

@ -41,11 +41,16 @@ public class EdRoofBlock extends StandardBlocks.HorizontalWaterLoggable implemen
public EdRoofBlock(long config, Block.Properties properties)
{
super(config,
properties.func_235838_a_((state)->1), // .notSolid() shade rendering again messed up
properties,//.func_235838_a_((state)->1).notSolid(), //shade rendering again messed up
Auxiliaries.getPixeledAABB(0, 0,0,16, 8, 16));
setDefaultState(stateContainer.getBaseState().with(HORIZONTAL_FACING, Direction.NORTH).with(SHAPE, StairsShape.STRAIGHT).with(WATERLOGGED, false));
}
@Override
@SuppressWarnings("deprecation")
public boolean isTransparent(BlockState state)
{ return true; }
@Override
public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext context)
{ return SHAPE_CACHE[state.get(HALF).ordinal()][state.get(HORIZONTAL_FACING).getIndex()][state.get(SHAPE).ordinal()]; }

View file

@ -77,7 +77,7 @@ public class EdTestBlock
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, TileEntity te, boolean explosion)
public List<ItemStack> dropList(BlockState state, World world, TileEntity te, boolean explosion)
{
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
list.add(new ItemStack(this, 1));

View file

@ -119,7 +119,7 @@ public class EdWasteIncinerator
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, final TileEntity te, boolean explosion)
public List<ItemStack> dropList(BlockState state, World world, final TileEntity te, boolean explosion)
{
final List<ItemStack> stacks = new ArrayList<ItemStack>();
if(world.isRemote) return stacks;

View file

@ -162,7 +162,7 @@ public class SlabSliceBlock extends StandardBlocks.WaterLoggable implements Stan
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, TileEntity te, boolean explosion)
public List<ItemStack> dropList(BlockState state, World world, TileEntity te, boolean explosion)
{ return new ArrayList<ItemStack>(Collections.singletonList(new ItemStack(this.asItem(), num_slabs_contained_in_parts_[state.get(PARTS) & 0xf]))); }
@Override

View file

@ -77,7 +77,7 @@ public class StandardBlocks
default boolean hasDynamicDropList()
{ return false; }
default List<ItemStack> dropList(BlockState state, World world, BlockPos pos, @Nullable TileEntity te, boolean explosion)
default List<ItemStack> dropList(BlockState state, World world, @Nullable TileEntity te, boolean explosion)
{ return Collections.singletonList((!world.isRemote()) ? (new ItemStack(state.getBlock().asItem())) : (ItemStack.EMPTY)); }
enum RenderTypeHint { SOLID,CUTOUT,CUTOUT_MIPPED,TRANSLUCENT,TRANSLUCENT_NO_CRUMBLING }
@ -193,13 +193,12 @@ public class StandardBlocks
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder)
{
final BlockPos pos = builder.get(LootParameters.POSITION);
final ServerWorld world = builder.getWorld();
final Float explosion_radius = builder.get(LootParameters.EXPLOSION_RADIUS);
final TileEntity te = builder.get(LootParameters.BLOCK_ENTITY);
if((!hasDynamicDropList()) || (pos==null) || (world==null)) return super.getDrops(state, builder);
if((!hasDynamicDropList()) || (world==null)) return super.getDrops(state, builder);
boolean is_explosion = (explosion_radius!=null) && (explosion_radius > 0);
return dropList(state, world, pos, te, is_explosion);
return dropList(state, world, te, is_explosion);
}
@Override

View file

@ -135,7 +135,7 @@ public class StandardFenceBlock extends WallBlock implements StandardBlocks.ISta
if((block instanceof FenceGateBlock) || (block instanceof StandardFenceBlock) || (block instanceof VariantWallBlock)) return true;
final BlockState oppositeState = world.getBlockState(facingPos.offset(side, 2));
if(!(oppositeState.getBlock() instanceof StandardFenceBlock)) return false;
return facingState.isNormalCube(world, facingPos) && hasSolidSide(facingState, world, facingPos, side);
return facingState.isNormalCube(world, facingPos) && hasEnoughSolidSide(world, facingPos, side);
}
protected WallHeight selectWallHeight(IWorldReader world, BlockPos pos, Direction direction)

View file

@ -151,7 +151,7 @@ public class VariantSlabBlock extends StandardBlocks.WaterLoggable implements St
{ return true; }
@Override
public List<ItemStack> dropList(BlockState state, World world, BlockPos pos, TileEntity te, boolean explosion)
public List<ItemStack> dropList(BlockState state, World world, TileEntity te, boolean explosion)
{ return new ArrayList<ItemStack>(Collections.singletonList(new ItemStack(this.asItem(), num_slabs_contained_in_parts_[state.get(TYPE).ordinal() & 0x3]))); }
@Override

View file

@ -138,7 +138,7 @@ public class VariantWallBlock extends WallBlock implements StandardBlocks.IStand
if((block instanceof FenceGateBlock) || (block instanceof WallBlock)) return true;
final BlockState oppositeState = world.getBlockState(facingPos.offset(side, 2));
if(!(oppositeState.getBlock() instanceof VariantWallBlock)) return false;
return facingState.isNormalCube(world, facingPos) && hasSolidSide(facingState, world, facingPos, side);
return facingState.isNormalCube(world, facingPos) && Block.hasEnoughSolidSide(world, facingPos, side);
}
protected WallHeight selectWallHeight(IWorldReader world, BlockPos pos, Direction direction)

View file

@ -108,8 +108,8 @@ public class OptionalRecipeCondition implements ICondition
}
if(!all_required_tags.isEmpty()) {
for(ResourceLocation rl:all_required_tags) {
if(!ItemTags.getCollection().getTagMap().containsKey(rl)) return false;
if(ItemTags.getCollection().getTagMap().get(rl).func_230236_b_().isEmpty()) return false;
if(!ItemTags.getCollection().func_241833_a()/*getTagMap()*/.containsKey(rl)) return false;
if(ItemTags.getCollection().func_241833_a()/*getTagMap()*/.get(rl).func_230236_b_().isEmpty()) return false;
}
}
if(!any_missing.isEmpty()) {
@ -120,8 +120,8 @@ public class OptionalRecipeCondition implements ICondition
}
if(!any_missing_tags.isEmpty()) {
for(ResourceLocation rl:any_missing_tags) {
if(!ItemTags.getCollection().getTagMap().containsKey(rl)) return true;
if(ItemTags.getCollection().getTagMap().get(rl).func_230236_b_().isEmpty()) return true;
if(!ItemTags.getCollection().func_241833_a()/*getTagMap()*/.containsKey(rl)) return true;
if(ItemTags.getCollection().func_241833_a()/*getTagMap()*/.get(rl).func_230236_b_().isEmpty()) return true;
}
return false;
}

View file

@ -92,7 +92,7 @@ public class TooltipDisplay
String text = tip.text.getString();
if(!text.isEmpty() && (!text.startsWith("block."))) {
try {
gui.renderToolTip(mx, Collections.singletonList(tip.text), x, y, Minecraft.getInstance().fontRenderer);
gui.func_243308_b(mx, Collections.singletonList(tip.text), x, y);
} catch(Exception ex) {
had_render_exception = true;
Auxiliaries.logError("Tooltip rendering disabled due to exception: '" + ex.getMessage() + "'");