Skip to content
Permalink
Browse files

Fixed incorrect registry override for snow. Fixed ice formation not r…

…equiring solid blocks nearby. Fixed reed type plants popping off if found ice - should be fine as they don't grow. Some minor climate style cleanup.
  • Loading branch information...
alcatrazEscapee committed Aug 11, 2019
1 parent b5d08ea commit 0477472f7d5ae578c085f7624ebb20aef773f881
@@ -29,7 +29,7 @@ public BlockFluidWater(Fluid fluid, Material material, boolean isSalt)
super(fluid, material);
this.isSalt = isSalt;
this.canCreateSources = true;
this.freezeThreshold = isSalt ? IceMeltHandler.WATER_FREEZE_THRESHOLD : IceMeltHandler.SALT_WATER_FREEZE_THRESHOLD;
this.freezeThreshold = isSalt ? IceMeltHandler.SALT_WATER_FREEZE_THRESHOLD : IceMeltHandler.WATER_FREEZE_THRESHOLD;
}

@Override
@@ -39,7 +39,7 @@ public void onTemperatureUpdateTick(World world, BlockPos pos, IBlockState state
{
for (EnumFacing face : EnumFacing.HORIZONTALS)
{
if (world.getBlockState(pos.offset(face)).getBlock() == this)
if (world.getBlockState(pos.offset(face)).getBlock() != this)
{
world.setBlockState(pos, isSalt ? BlocksTFC.SEA_ICE.getDefaultState() : Blocks.ICE.getDefaultState());
break;
@@ -12,6 +12,7 @@
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.event.RegistryEvent;
@@ -599,7 +600,7 @@ public static void registerBlocks(RegistryEvent.Register<Block> event)
TerraFirmaCraft.getLog().info("The below warnings about unintended overrides are intended. The override is intended. ;)");
event.getRegistry().registerAll(
new BlockIceTFC(FluidsTFC.FRESH_WATER.get()).setRegistryName("minecraft", "ice").setTranslationKey("ice"),
new BlockSnowTFC().setRegistryName("minecraft", "snow").setTranslationKey("snow")
new BlockSnowTFC().setRegistryName("minecraft", "snow_layer").setTranslationKey("snow")
);

// Register Tile Entities
@@ -647,6 +648,11 @@ public static boolean isSaltWater(IBlockState current)
return current == FluidsTFC.SALT_WATER.get().getBlock().getDefaultState();
}

public static boolean isFreshWaterOrIce(IBlockState current)
{
return current.getBlock() == Blocks.ICE || isFreshWater(current);
}

public static boolean isRawStone(IBlockState current)
{
if (!(current.getBlock() instanceof BlockRockVariant)) return false;
@@ -287,10 +287,13 @@ public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos p
for (EnumFacing facing : EnumFacing.HORIZONTALS)
{
for (int i = 1; i <= beachDistance; i++)
if (BlocksTFC.isFreshWater(world.getBlockState(pos.offset(facing, i))))
{
if (BlocksTFC.isFreshWaterOrIce(world.getBlockState(pos.offset(facing, i))))
{
flag = true;
break;
}
}
}
return (type == Rock.Type.DIRT || type == Rock.Type.GRASS || type == Rock.Type.SAND || type == Rock.Type.DRY_GRASS) && flag;
}
@@ -17,8 +17,7 @@
*/
public final class ClimateCache
{
private final Map<ChunkPos, ClimateData> MAP = new HashMap<>();
private final ClimateData DEFAULT = new ClimateData(0, 250);
private final Map<ChunkPos, ClimateData> backingMap = new HashMap<>();

@Nonnull
public ClimateData get(BlockPos pos)
@@ -29,11 +28,11 @@ public ClimateData get(BlockPos pos)
@Nonnull
public ClimateData get(ChunkPos pos)
{
return MAP.getOrDefault(pos, DEFAULT);
return backingMap.getOrDefault(pos, ClimateData.DEFAULT);
}

public void update(ChunkPos pos, float temperature, float rainfall)
{
MAP.put(pos, new ClimateData(temperature, rainfall));
backingMap.put(pos, new ClimateData(temperature, rainfall));
}
}
@@ -7,6 +7,8 @@

public class ClimateData
{
public static final ClimateData DEFAULT = new ClimateData(0, 250);

private final float regionalTemp;
private final float rainfall;

0 comments on commit 0477472

Please sign in to comment.
You can’t perform that action at this time.