-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix StemBlock/AttachedStemBlock/PitcherCropBlock not being placeable …
…on BWG Farmland (Fabric Only). Closes #176 Signed-off-by: Joseph T. McQuigg <[email protected]>
- Loading branch information
Showing
5 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...c/src/main/java/net/potionstudios/biomeswevegone/fabric/mixin/AttachedStemBlockMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package net.potionstudios.biomeswevegone.fabric.mixin; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.block.AttachedStemBlock; | ||
import net.minecraft.world.level.block.BushBlock; | ||
import net.minecraft.world.level.block.FarmBlock; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(AttachedStemBlock.class) | ||
public abstract class AttachedStemBlockMixin extends BushBlock { | ||
protected AttachedStemBlockMixin(Properties properties) { | ||
super(properties); | ||
} | ||
|
||
/** | ||
* @reason Allows crops to be placed on Blocks that extend FarmBlock | ||
* @author Joseph T. McQuigg | ||
*/ | ||
@Inject(method = "mayPlaceOn", at = @At("RETURN"), cancellable = true) | ||
protected void mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos, CallbackInfoReturnable<Boolean> cir) { | ||
cir.setReturnValue(state.getBlock() instanceof FarmBlock); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...ic/src/main/java/net/potionstudios/biomeswevegone/fabric/mixin/PitcherCropBlockMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package net.potionstudios.biomeswevegone.fabric.mixin; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.block.BonemealableBlock; | ||
import net.minecraft.world.level.block.DoublePlantBlock; | ||
import net.minecraft.world.level.block.FarmBlock; | ||
import net.minecraft.world.level.block.PitcherCropBlock; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(PitcherCropBlock.class) | ||
public abstract class PitcherCropBlockMixin extends DoublePlantBlock implements BonemealableBlock { | ||
public PitcherCropBlockMixin(Properties properties) { | ||
super(properties); | ||
} | ||
|
||
/** | ||
* @reason Allows crops to be placed on Blocks that extend FarmBlock | ||
* @author Joseph T. McQuigg | ||
*/ | ||
@Inject(method = "mayPlaceOn", at = @At("RETURN"), cancellable = true) | ||
protected void mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos, CallbackInfoReturnable<Boolean> cir) { | ||
cir.setReturnValue(state.getBlock() instanceof FarmBlock); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Fabric/src/main/java/net/potionstudios/biomeswevegone/fabric/mixin/StemBlockMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package net.potionstudios.biomeswevegone.fabric.mixin; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.block.BonemealableBlock; | ||
import net.minecraft.world.level.block.BushBlock; | ||
import net.minecraft.world.level.block.FarmBlock; | ||
import net.minecraft.world.level.block.StemBlock; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(StemBlock.class) | ||
public abstract class StemBlockMixin extends BushBlock implements BonemealableBlock { | ||
protected StemBlockMixin(Properties properties) { | ||
super(properties); | ||
} | ||
|
||
/** | ||
* @reason Allows crops to be placed on Blocks that extend FarmBlock | ||
* @author Joseph T. McQuigg | ||
*/ | ||
@Inject(method = "mayPlaceOn", at = @At("RETURN"), cancellable = true) | ||
protected void mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos, CallbackInfoReturnable<Boolean> cir) { | ||
cir.setReturnValue(state.getBlock() instanceof FarmBlock); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters