old-bugs

Minecraft: Better than Adventure! mod that brings back bugs from older versions
git clone git://memoryshards.xyz/old-bugs.git
Log | Files | Refs | README | LICENSE

BlockFireMixin.java (1405B)


      1 package ambos.oldbugs.mixin;
      2 
      3 import net.minecraft.core.block.Block;
      4 import net.minecraft.core.block.BlockFire;
      5 import net.minecraft.core.world.World;
      6 import org.spongepowered.asm.mixin.Mixin;
      7 import org.spongepowered.asm.mixin.injection.*;
      8 
      9 import ambos.oldbugs.OldBugs;
     10 
     11 @Mixin(value = BlockFire.class, remap = false)
     12 final class BlockFireMixin {
     13     @ModifyConstant(method = "tickRate", constant = @Constant(intValue = 40))
     14     private int changeTickRate(int a) {
     15         if (OldBugs.OLD_FIRE_SPREAD) {
     16             return OldBugs.FIRE_TICK_RATE;
     17         } else {
     18             return a;
     19         }
     20     }
     21 
     22     @Redirect(method = "tryToCatchBlockOnFire", at = @At(value = "INVOKE",
     23         target = "Lnet/minecraft/core/world/World;setBlockAndMetadataWithNotify(IIIII)Z"))
     24     private boolean infiniteSpreading(World world, int x, int y, int z, int id, int meta) {
     25         if (OldBugs.OLD_FIRE_SPREAD) {
     26             world.setBlockAndMetadataWithNotify(x, y, z, Block.fire.id, 0);
     27         }
     28 
     29         return false;
     30     }
     31 
     32     @Redirect(method = "tryToCatchBlockOnFire", at = @At(value = "INVOKE",
     33         target = "Lnet/minecraft/core/block/BlockFire;setBurnResult(Lnet/minecraft/core/world/World;III)V"))
     34     private void cancelSetBurnResult(BlockFire instance, World world, int x, int y, int z) {
     35         if (!OldBugs.OLD_FIRE_SPREAD) {
     36             instance.setBurnResult(world, x, y, z);
     37         }
     38     }
     39 }