generated from RubixDev/CarpetAddonTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from RubixDev/development
v1.1.5
- Loading branch information
Showing
13 changed files
with
224 additions
and
10 deletions.
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
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
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
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
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
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
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
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
25 changes: 25 additions & 0 deletions
25
src/main/java/com/rubixdev/rug/mixins/AbstractBlockMixin.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,25 @@ | ||
package com.rubixdev.rug.mixins; | ||
|
||
import com.rubixdev.rug.util.Storage; | ||
import net.minecraft.block.AbstractBlock; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.Blocks; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Direction; | ||
import net.minecraft.world.WorldAccess; | ||
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(AbstractBlock.class) | ||
public class AbstractBlockMixin { | ||
@Inject(method = "getStateForNeighborUpdate", at = @At("HEAD"), cancellable = true) | ||
private void convertBasalt(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom, CallbackInfoReturnable<BlockState> cir) { | ||
if (((Block) (Object) this).is(Blocks.BASALT) && Storage.shouldConvertBasalt(world, pos)) { | ||
cir.setReturnValue(Blocks.BLACKSTONE.getDefaultState()); | ||
world.syncWorldEvent(1501, pos, 0); | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/com/rubixdev/rug/mixins/FluidBlockMixin.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,41 @@ | ||
package com.rubixdev.rug.mixins; | ||
|
||
import com.rubixdev.rug.RugSettings; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.Blocks; | ||
import net.minecraft.block.FluidBlock; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.WorldAccess; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(FluidBlock.class) | ||
public abstract class FluidBlockMixin { | ||
@Shadow protected abstract void playExtinguishSound(WorldAccess world, BlockPos pos); | ||
|
||
@Inject( | ||
method = "receiveNeighborFluids", | ||
at = @At(value = "INVOKE_ASSIGN", | ||
target = "Lnet/minecraft/fluid/FluidState;isStill()Z"), | ||
cancellable = true | ||
) | ||
private void generateNetherrack( | ||
World world, | ||
BlockPos pos, | ||
BlockState state, | ||
CallbackInfoReturnable<Boolean> cir | ||
) { | ||
if (RugSettings.netherrackGeneration | ||
&& world.getBlockState(pos.down()).isOf(Blocks.MAGMA_BLOCK) | ||
&& !world.getFluidState(pos).isStill() | ||
) { | ||
world.setBlockState(pos, Blocks.NETHERRACK.getDefaultState()); | ||
this.playExtinguishSound(world, pos); | ||
cir.setReturnValue(false); | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/rubixdev/rug/mixins/PillarBlockMixin.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,32 @@ | ||
package com.rubixdev.rug.mixins; | ||
|
||
import com.rubixdev.rug.util.Storage; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.Blocks; | ||
import net.minecraft.block.PillarBlock; | ||
import net.minecraft.item.ItemPlacementContext; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.WorldAccess; | ||
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(PillarBlock.class) | ||
public class PillarBlockMixin extends Block { | ||
public PillarBlockMixin(Settings settings) { | ||
super(settings); | ||
} | ||
|
||
@Inject(method = "getPlacementState", at = @At("HEAD"), cancellable = true) | ||
private void convertBasalt(ItemPlacementContext ctx, CallbackInfoReturnable<BlockState> cir) { | ||
WorldAccess world = ctx.getWorld(); | ||
BlockPos pos = ctx.getBlockPos(); | ||
|
||
if (this.is(Blocks.BASALT) && Storage.shouldConvertBasalt(world, pos)) { | ||
cir.setReturnValue(Blocks.BLACKSTONE.getDefaultState()); | ||
world.syncWorldEvent(1501, pos, 0); | ||
} | ||
} | ||
} |
Oops, something went wrong.