use of net.minecraftforge.fluids.BlockFluidBase in project NewHorizonsCoreMod by GTNewHorizons.
the class OilGeneratorFix method getTopBlock.
private int getTopBlock(World pWorld, int pLocX, int pLocZ) {
Chunk tChunk = pWorld.getChunkFromBlockCoords(pLocX, pLocZ);
int y = tChunk.getTopFilledSegment() + 15;
int trimmedX = pLocX & 0xF;
int trimmedZ = pLocZ & 0xF;
for (; y > 0; y--) {
Block tBlock = tChunk.getBlock(trimmedX, y, trimmedZ);
if (!tBlock.isAir(pWorld, pLocX, y, pLocZ)) {
if ((tBlock instanceof BlockStaticLiquid)) {
return y;
}
if ((tBlock instanceof BlockFluidBase)) {
return y;
}
if ((tBlock instanceof IFluidBlock)) {
return y;
}
if (tBlock.getMaterial().blocksMovement()) {
if (!(tBlock instanceof BlockFlower)) {
return y - 1;
}
}
}
}
return -1;
}
use of net.minecraftforge.fluids.BlockFluidBase in project RebornCore by TechReborn.
the class LogicBlock method addItemsToList.
private void addItemsToList(IItemHandler inventory, List<ItemStack> items) {
for (int i = 0; i < inventory.getSlots(); i++) {
ItemStack itemStack = inventory.getStackInSlot(i);
if (itemStack == ItemStack.EMPTY) {
continue;
}
if (itemStack != ItemStack.EMPTY && itemStack.getCount() > 0) {
if (itemStack.getItem() instanceof ItemBlock) {
if (((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockFluidBase || ((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockStaticLiquid || ((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockDynamicLiquid) {
continue;
}
}
}
items.add(itemStack.copy());
}
}
use of net.minecraftforge.fluids.BlockFluidBase in project RebornCore by TechReborn.
the class BlockMachineBase method addItemsToList.
private void addItemsToList(IInventory inventory, List<ItemStack> items) {
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack itemStack = inventory.getStackInSlot(i);
if (itemStack == ItemStack.EMPTY) {
continue;
}
if (itemStack != ItemStack.EMPTY && itemStack.getCount() > 0) {
if (itemStack.getItem() instanceof ItemBlock) {
if (((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockFluidBase || ((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockStaticLiquid || ((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockDynamicLiquid) {
continue;
}
}
}
items.add(itemStack.copy());
}
}
use of net.minecraftforge.fluids.BlockFluidBase in project TechReborn by TechReborn.
the class BlockTransformer method dropInventory.
protected List<ItemStack> dropInventory(IBlockAccess world, BlockPos pos, ItemStack itemToDrop) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity == null) {
System.out.print("Null");
return null;
}
if (!(tileEntity instanceof IInventory)) {
System.out.print("Not INstance");
return null;
}
IInventory inventory = (IInventory) tileEntity;
List<ItemStack> items = new ArrayList<>();
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack itemStack = inventory.getStackInSlot(i);
if (itemStack.isEmpty()) {
continue;
}
if (!itemStack.isEmpty() && itemStack.getCount() > 0) {
if (itemStack.getItem() instanceof ItemBlock) {
if (((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockFluidBase || ((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockStaticLiquid || ((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockDynamicLiquid) {
continue;
}
}
}
items.add(itemStack.copy());
}
items.add(itemToDrop.copy());
return items;
}
use of net.minecraftforge.fluids.BlockFluidBase in project GregTech by GregTechCE.
the class BakedModelHandler method onModelsBake.
@SubscribeEvent
public void onModelsBake(ModelBakeEvent event) {
for (BlockFluidBase fluidBlock : fluidBlocks) {
Fluid fluid = ObfuscationReflectionHelper.getPrivateValue(BlockFluidBase.class, fluidBlock, "definedFluid");
ModelFluid modelFluid = new ModelFluid(fluid);
IBakedModel bakedModel = modelFluid.bake(modelFluid.getDefaultState(), DefaultVertexFormats.ITEM, TextureUtils::getTexture);
ModelResourceLocation resourceLocation = getSimpleModelLocation(fluidBlock);
event.getModelRegistry().putObject(resourceLocation, bakedModel);
}
for (Tuple<Block, String> tuple : builtInBlocks) {
ModelResourceLocation resourceLocation = getSimpleModelLocation(tuple.getFirst());
ModelBuiltInRenderer bakedModel = new ModelBuiltInRenderer(tuple.getSecond());
event.getModelRegistry().putObject(resourceLocation, bakedModel);
}
}
Aggregations