Skip to content

Commit

Permalink
Version 1.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
misterplus committed Mar 9, 2020
1 parent 691068f commit 23e73bc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'org.spongepowered.mixin'

version = "1.3.5"
version = "1.3.6"
group = "com.misterplus.plustweaks"
archivesBaseName = "plustweaks"

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/misterplus/plustweaks/PlusTweaks.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class PlusTweaks {
public static final String MOD_ID = "plustweaks";
public static final String MOD_NAME = "PlusTweaks";
public static final String VERSION = "1.3.5";
public static final String VERSION = "1.3.6";

public static Logger logger = LogManager.getLogger(PlusTweaks.MOD_NAME);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.HashMap;
import java.util.Objects;

import static com.misterplus.plustweaks.PlusTweaks.blockCool;
import static com.misterplus.plustweaks.PlusTweaks.blockGen;
Expand Down Expand Up @@ -57,8 +58,6 @@ private boolean redirect_checkForMixing(World world, BlockPos pos, IBlockState s

@Shadow @Final
public static PropertyInteger LEVEL;


@Shadow public abstract int tickRate(World worldIn);

@Inject(
Expand All @@ -69,25 +68,28 @@ private boolean redirect_checkForMixing(World world, BlockPos pos, IBlockState s
private void injectCheckForMixing(World worldIn, BlockPos pos, IBlockState state, CallbackInfoReturnable<Boolean> cir) {
for (EnumFacing enumfacing : EnumFacing.values())
{
if (!worldIn.getBlockState(pos.offset(enumfacing)).getMaterial().isLiquid())
if (!worldIn.getBlockState(pos.offset(enumfacing)).getMaterial().isLiquid() || enumfacing == EnumFacing.UP)
continue;
findBlock(worldIn, pos, enumfacing, cir);
String key = findKey(worldIn, pos, enumfacing);
BlockPos actualPos = pos;
if (key != null) {
if (!key.startsWith(Objects.requireNonNull(BlockDynamicLiquid.getStaticBlock(this.material).getRegistryName()).toString()))
actualPos = pos.offset(enumfacing);
HashMap<Integer, IBlockState> blockList = interactions.get(key);
Integer integer = worldIn.getBlockState(actualPos).getValue(LEVEL);
if (blockList.containsKey(integer)) {
worldIn.setBlockState(actualPos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(worldIn, actualPos, actualPos, blockList.get(integer)));
worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
cir.setReturnValue(true);
}
}
}
}

private void findBlock(World worldIn, BlockPos pos, EnumFacing enumfacing, CallbackInfoReturnable<Boolean> cir) {
private String findKey(World worldIn, BlockPos pos, EnumFacing enumfacing) {
ResourceLocation liquid1 = BlockDynamicLiquid.getStaticBlock(this.material).getRegistryName();
ResourceLocation liquid2 = worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getRegistryName();
String key = (enumfacing == EnumFacing.DOWN) ? liquid2 + ":" + liquid1 : liquid1 + ":" + liquid2;
if (interactions.containsKey(key)) {
HashMap<Integer, IBlockState> blockList = interactions.get(key);
BlockPos actualPos = (enumfacing == EnumFacing.DOWN) ? pos.offset(enumfacing) : pos;
Integer integer = worldIn.getBlockState(actualPos).getValue(LEVEL);
if (blockList.containsKey(integer)) {
worldIn.setBlockState(actualPos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(worldIn, actualPos, actualPos, blockList.get(integer)));
worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
cir.setReturnValue(true);
}
}
String key = liquid1 + ":" + liquid2;
return interactions.containsKey(key) ? key : (interactions.containsKey(liquid2 + ":" + liquid1) ? liquid2 + ":" + liquid1 : null);
}
}

0 comments on commit 23e73bc

Please sign in to comment.