-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/VazkiiMods/Quark
- Loading branch information
Showing
36 changed files
with
90 additions
and
156 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
- Fallen logs can rarely spawn on water | ||
- Fallen logs can no longer spawn on ice and other non terrain blocks (added tag for them) | ||
- Fallen log decoration (moss and vines) are now biome temperature and humidify dependent. No more moss in snowy biomes | ||
- Freestanding ladders will now break off the wall when you break the top block | ||
- Matrix Enchanting Table appears in creative if automaticallyConvert is off | ||
- Fixed Skull Pikes not functioning when there's a block on top, by lowering the detection point |
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
22 changes: 22 additions & 0 deletions
22
src/main/java/org/violetmoon/quark/mixin/mixins/BlockBehaviourMixin.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,22 @@ | ||
package org.violetmoon.quark.mixin.mixins; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.util.RandomSource; | ||
import net.minecraft.world.level.block.state.BlockBehaviour; | ||
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.CallbackInfo; | ||
|
||
/** | ||
* Exists to be subclassed by LadderBlockMixin basically | ||
*/ | ||
@Mixin(BlockBehaviour.class) | ||
public class BlockBehaviourMixin { | ||
@Inject(method = "tick", at = @At("HEAD")) | ||
public void quark$tick(BlockState pState, ServerLevel pLevel, BlockPos pPos, RandomSource pRandom, CallbackInfo ci) { | ||
|
||
} | ||
} |
43 changes: 34 additions & 9 deletions
43
src/main/java/org/violetmoon/quark/mixin/mixins/LadderBlockMixin.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 |
---|---|---|
@@ -1,30 +1,55 @@ | ||
package org.violetmoon.quark.mixin.mixins; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import com.llamalad7.mixinextras.injector.ModifyReturnValue; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.util.RandomSource; | ||
import net.minecraft.world.level.LevelAccessor; | ||
import net.minecraft.world.level.LevelReader; | ||
import net.minecraft.world.level.block.Blocks; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.LadderBlock; | ||
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.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import org.violetmoon.quark.content.tweaks.module.EnhancedLaddersModule; | ||
|
||
@Mixin(LadderBlock.class) | ||
public class LadderBlockMixin { | ||
|
||
public class LadderBlockMixin extends BlockBehaviourMixin { | ||
@ModifyReturnValue(method = "canSurvive", at = @At("RETURN")) | ||
private boolean canSurviveTweak(boolean original, BlockState state, LevelReader level, BlockPos pos) { | ||
return EnhancedLaddersModule.canSurviveTweak(original, state, level, pos); | ||
} | ||
|
||
@Inject(method = "canSurvive", at = @At("HEAD"), cancellable = true) | ||
private void canSurvive(BlockState state, LevelReader level, BlockPos pos, CallbackInfoReturnable<Boolean> callbackInfoReturnable) { | ||
if(EnhancedLaddersModule.canLadderSurvive(state, level, pos)) { | ||
callbackInfoReturnable.setReturnValue(true); | ||
callbackInfoReturnable.cancel(); | ||
/** | ||
* In vanilla, the only way to break a ladder is to break the block behind it. So in updateShape, | ||
* vanilla only does ladder canSurvive checks if the update came from behind. But with Quark's | ||
* freestanding ladder feature, it's possible to break a ladder by breaking a block *above* it. | ||
*/ | ||
@Inject(method = "updateShape", at = @At(value = "HEAD"), cancellable = true) | ||
private void updateShapeTweak(BlockState pState, Direction pFacing, BlockState pFacingState, LevelAccessor pLevel, BlockPos pCurrentPos, BlockPos pFacingPos, CallbackInfoReturnable<BlockState> cir) { | ||
if(EnhancedLaddersModule.shouldDoUpdateShapeTweak(pState) && pFacing == Direction.UP) { | ||
//This is just for fun. Makes the ladders break like bamboo instead of instantly. | ||
pLevel.scheduleTick(pCurrentPos, (LadderBlock) (Object) this, 1); | ||
cir.setReturnValue(pState); | ||
} | ||
} | ||
|
||
/** | ||
* Override from BlockBehaviourMixin which does the actual injection | ||
*/ | ||
@Override | ||
public void quark$tick(BlockState pState, ServerLevel pLevel, BlockPos pPos, RandomSource pRandom, CallbackInfo ci) { | ||
if(EnhancedLaddersModule.shouldDoUpdateShapeTweak(pState) && !pState.canSurvive(pLevel, pPos)) { | ||
pLevel.destroyBlock(pPos, true); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.