Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport spongesDryInTheNether rule #98

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
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
7 changes: 5 additions & 2 deletions carpetmodSrc/carpet/CarpetSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ private static boolean validateRedstoneMultimeter(boolean value) {

@Rule(desc = "Allows to always be able to eat cakes.", category = CREATIVE)
public static boolean cakeAlwaysEat;

private static boolean validateFlyingMachineTransparent(boolean value) {
int newOpacity = value ? 0 : 255;
Blocks.OBSERVER.setLightOpacity(newOpacity);
Expand Down Expand Up @@ -710,6 +710,9 @@ private static boolean validateLiquidsNotRandom(boolean value) {
@SurvivalDefault
public static boolean persistentParrots = false;

@Rule(desc = "Wet sponges dry in the nether dimension", category = FEATURE)
public static boolean spongesDryInTheNether = false;

@Rule(desc = "Empty shulker boxes can stack to 64 when dropped on the ground", category = SURVIVAL, extra = {
"To move them around between inventories, use shift click to move entire stacks"
})
Expand Down Expand Up @@ -807,7 +810,7 @@ private static boolean validateSpongeRandom(boolean value) {
private static boolean validateTileTickLimit(int value) {
return value >= -1;
}

@Rule(desc = "Redstone ore blocks can redirect redstone dust", category = {EXPERIMENTAL, FEATURE})
public static boolean redstoneOreRedirectsDust = false;

Expand Down
32 changes: 28 additions & 4 deletions patches/net/minecraft/block/BlockSponge.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSponge.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSponge.java
@@ -18,6 +18,9 @@
@@ -9,15 +9,21 @@
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
+import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
+import net.minecraft.util.SoundCategory;
import net.minecraft.util.Tuple;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;

Expand All @@ -10,7 +22,7 @@
public class BlockSponge extends Block
{
public static final PropertyBool field_176313_a = PropertyBool.func_177716_a("wet");
@@ -119,6 +122,38 @@
@@ -119,6 +125,50 @@
return ((Boolean)p_176201_1_.func_177229_b(field_176313_a)).booleanValue() ? 1 : 0;
}

Expand All @@ -36,15 +48,27 @@
+ touches_wet = true;
+ }
+ }
+ if ((state.func_177229_b(field_176313_a)).booleanValue() && !touches_water && worldIn.func_175678_i(pos.func_177984_a()) && worldIn.func_72935_r() && !worldIn.func_175727_C(pos.func_177984_a()))
+ if (state.func_177229_b(field_176313_a).booleanValue() && !touches_water && worldIn.func_175678_i(pos.func_177984_a()) && worldIn.func_72935_r() && !worldIn.func_175727_C(pos.func_177984_a()))
+ {
+ worldIn.func_180501_a(pos, state.func_177226_a(field_176313_a, Boolean.valueOf(false)), 2);
+ }
+ else if ( !(state.func_177229_b(field_176313_a)).booleanValue() && (touches_wet || touches_water || worldIn.func_175727_C(pos.func_177984_a())) && random.nextInt(3)==0)
+ else if ( !state.func_177229_b(field_176313_a).booleanValue() && (touches_wet || touches_water || worldIn.func_175727_C(pos.func_177984_a())) && random.nextInt(3)==0)
+ {
+ worldIn.func_180501_a(pos, state.func_177226_a(field_176313_a, Boolean.valueOf(true)), 2);
+ }
+ }
+
+ @Override
+ public void func_180633_a(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
+ {
+ super.func_180633_a(worldIn, pos, state, placer, stack);
+
+ if (worldIn.field_73011_w.func_177495_o() && CarpetSettings.spongesDryInTheNether && state.func_177229_b(field_176313_a).booleanValue())
+ {
+ worldIn.func_184133_a(null, pos, SoundEvents.field_187646_bt, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.field_73012_v.nextFloat() - worldIn.field_73012_v.nextFloat()) * 0.8F);
+ worldIn.func_180501_a(pos, state.func_177226_a(field_176313_a, Boolean.valueOf(false)), 2);
+ }
+ }
+
protected BlockStateContainer func_180661_e()
{
Expand Down