Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ configurations {

dependencies {
minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2860'
compileOnly "curse.maven:fluidlogged-api-485654:7212988"
implementation "org.spongepowered:mixin:0.8"
implementation "curse.maven:atlas-463826:6981034"
implementation "curse.maven:raids-977633:5626565"
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/deeperdepths/common/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class Constants {
public static final String NAME = "Deeper Depths";
public static final String MODID = "deeperdepths";
public static final String VERSION = "1.1.1";
public static final String DEPENDENCIES = "required-after:atlaslib@[1.1.9,)";
public static final String DEPENDENCIES = "required-after:atlaslib@[1.1.9,);after:fluidlogged_api@[3.1.0,)";
public static final String PATH = "com.deeperdepths.";
public static final String CLIENT = PATH + "client.ClientProxy";
public static final String SERVER = PATH + "common.CommonProxy";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.deeperdepths.common.blocks.BlockCandle;
import com.deeperdepths.common.blocks.BlockLightningRod;
import com.deeperdepths.common.blocks.ICopperBlock;
import com.deeperdepths.common.blocks.IFluidloggable;
import com.deeperdepths.common.blocks.tiles.TileTrialSpawner;
import com.deeperdepths.common.blocks.tiles.TileVault;
import com.deeperdepths.common.capabilities.CapabilityWindChargeFall;
Expand Down Expand Up @@ -320,53 +319,4 @@ public void livingHurtEnd(LivingAttackEvent event) {
public void addLoot(LootTableLoadEvent event) {
for (LootTableEntry entry : LootTablesConfig.ENTRIES) if (entry.canApply(event.getName())) entry.addEntry(event.getTable());
}

@SubscribeEvent(priority = EventPriority.HIGH)
public void fillBucket(FillBucketEvent event) {
World world = event.getWorld();
RayTraceResult ray = event.getTarget();
if (ray == null) return;
if (ray.typeOfHit != RayTraceResult.Type.BLOCK) return;
BlockPos pos = ray.getBlockPos();
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
if (!(block instanceof IFluidloggable)) return;
ItemStack bucket = event.getEmptyBucket();
if (!bucket.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) return;
IFluidloggable loggableBlock = (IFluidloggable) block;
IFluidHandlerItem cap = bucket.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
EntityPlayer player = event.getEntityPlayer();
FluidStack fluidStack = FluidUtil.getFluidContained(bucket);
if (loggableBlock.isFluidLogged(world, pos, state)) {
if (fluidStack != null) return;
Optional<Fluid> optional = loggableBlock.getContainedFluid(world, pos, state);
if (!optional.isPresent()) return;
Fluid fluid = optional.get();
fluidStack = new FluidStack(fluid, 1000);
if (cap.fill(fluidStack, false) < 1000) return;
player.playSound(fluid.getFillSound(fluidStack), 1, 1);
loggableBlock.empty(world, pos, state);
if (!player.isCreative()) cap.fill(fluidStack, true);
} else {
if (fluidStack == null) return;
if (fluidStack.amount < 1000 |! loggableBlock.canContainFluid(world, pos, state, fluidStack.getFluid())) return;
FluidStack drained = cap.drain(fluidStack, false);
if (drained == null) return;
if (drained.amount < 1000 || drained.getFluid() != fluidStack.getFluid()) return;
if (world.provider.doesWaterVaporize()) {
world.playSound(player, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5f, 2.6f + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8f);
for (int k = 0; k < 8; ++k)
world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 0, 0, 0);
} else {
world.playSound(player, pos, fluidStack.getFluid().getEmptySound(fluidStack), SoundCategory.BLOCKS, 1, 1);
loggableBlock.fillWithFluid(world, pos, state, fluidStack.getFluid());
}
if (!player.isCreative()) cap.drain(fluidStack, true);
}
player.addStat(StatList.getObjectUseStats(bucket.getItem()));
ItemStack container = cap.getContainer().copy();
event.setFilledBucket(container);
event.setResult(Event.Result.ALLOW);
}

}
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
package com.deeperdepths.common.blocks;

import com.deeperdepths.common.DeeperDepthsSoundTypes;
import com.deeperdepths.common.blocks.enums.EnumWeatherStage;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

Expand All @@ -25,36 +20,7 @@ public BlockCopperGrate() {

@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, WEATHER_STAGE, WAXED, WATERLOGGED);
}

@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
return super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand)
.withProperty(WATERLOGGED, world.getBlockState(pos).getBlock() == Blocks.WATER);
}

@Override
public int getMetaFromState(IBlockState state) {
return super.getMetaFromState(state) + (state.getValue(WATERLOGGED) ? 8 : 0);
}

@Override
public int damageDropped(IBlockState state) {
return super.damageDropped(state) % 8;
}

@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(WEATHER_STAGE, EnumWeatherStage.values()[meta % 4])
.withProperty(WAXED, meta % 8 >= 4).withProperty(WATERLOGGED, meta >= 8);
}

@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
super.breakBlock(world, pos, state);
if (world.getBlockState(pos) != Blocks.AIR) return;
if (state.getValue(WATERLOGGED)) world.setBlockState(pos, Blocks.WATER.getDefaultState(), 3);
return new BlockStateContainer(this, WEATHER_STAGE, WAXED);
}

@Override
Expand All @@ -72,21 +38,6 @@ public boolean isOpaqueCube(IBlockState state) {
return false;
}

/*@Override
public Material getMaterial(IBlockState state) {
return state.getValue(WATERLOGGED) ? Material.WATER : super.getMaterial(state);
}

@Override
public boolean isReplaceable(IBlockAccess world, BlockPos pos) {
return false;
}*/

@Override
public String byState(IBlockState state) {
return byMeta(getMetaFromState(state) % getMaxMeta());
}

@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing facing) {
Expand Down
39 changes: 6 additions & 33 deletions src/main/java/com/deeperdepths/common/blocks/IFluidloggable.java
Original file line number Diff line number Diff line change
@@ -1,37 +1,10 @@
package com.deeperdepths.common.blocks;

import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;

import java.util.Optional;

public interface IFluidloggable {

PropertyBool WATERLOGGED = PropertyBool.create("waterlogged");

default boolean isFluidLogged(IBlockAccess world, BlockPos pos, IBlockState state) {
return state.getValue(WATERLOGGED);
}

default Optional<Fluid> getContainedFluid(IBlockAccess world, BlockPos pos, IBlockState state) {
return state.getValue(WATERLOGGED) ? Optional.of(FluidRegistry.WATER) : Optional.empty();
}

default boolean canContainFluid(IBlockAccess world, BlockPos pos, IBlockState state, Fluid fluid) {
return fluid == FluidRegistry.WATER;
}

default void fillWithFluid(World world, BlockPos pos, IBlockState state, Fluid fluid) {
world.setBlockState(pos, state.withProperty(WATERLOGGED, true), 3);
}

default void empty(World world, BlockPos pos, IBlockState state) {
world.setBlockState(pos, state.withProperty(WATERLOGGED, false), 3);
}
/**
* Wrapper for Fluidlogged API.
*/
@net.minecraftforge.fml.common.Optional.Interface
(modid = "fluidlogged_api", iface = "git.jbredwards.fluidlogged_api.api.block.IFluidloggable")
public interface IFluidloggable extends git.jbredwards.fluidlogged_api.api.block.IFluidloggable {

}
32 changes: 0 additions & 32 deletions src/main/java/com/deeperdepths/mixin/MixinBlockFluidRenderer.java

This file was deleted.

This file was deleted.

This file was deleted.

49 changes: 0 additions & 49 deletions src/main/java/com/deeperdepths/mixin/MixinRenderChunk.java

This file was deleted.

Loading