Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.dafuqs.spectrum.blocks.rock_candy;

import de.dafuqs.spectrum.*;
import de.dafuqs.spectrum.blocks.*;
import de.dafuqs.spectrum.helpers.ColorHelper;
import de.dafuqs.spectrum.particle.effect.*;
Expand Down Expand Up @@ -108,9 +109,17 @@ public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random
List<ItemEntity> itemEntities = world.getNonSpectatingEntities(ItemEntity.class, Box.of(Vec3d.ofCenter(pos), ITEM_SEARCH_RANGE, ITEM_SEARCH_RANGE, ITEM_SEARCH_RANGE));
Collections.shuffle(itemEntities);
for (ItemEntity itemEntity : itemEntities) {
// is the item also submerged?
// lazy, but mostly accurate and performant way to check if it's the same liquid pool
if (!itemEntity.isSubmergedIn(SpectrumFluidTags.LIQUID_CRYSTAL)) {

// This implements checking if the item is submerged at eye level. This is necessary as the mixin went haywire
// in a connector environment (TLDR: isSubmergedIn() breaks though mixin transmog with Connector, this fixes it
var currentFluidHeight = itemEntity.getBlockStateAtPos().getFluidState().getHeight();
var eyePosY = itemEntity.getEyePos().y;
var entityPosFloorY = Math.floor(itemEntity.getEyePos().y);
var entityEyeFloorOffset = eyePosY - entityPosFloorY;

// Checks to see if the checked item is submerged and in liquid crystal, if one of these are false (making this true), continue to next to aiterate.
// This is to replace the submerge mixin check, given connector was screwing with its check
if (!itemEntity.getBlockStateAtPos().isOf(SpectrumBlocks.LIQUID_CRYSTAL)|| entityEyeFloorOffset > currentFluidHeight) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ public abstract class EntityApplyFluidsMixin implements TouchingWaterAware {
@Override
public void spectrum$setActuallyTouchingWater(boolean actuallyTouchingWater) { this.actuallyTouchingWater = actuallyTouchingWater; }

@Inject(method = "isSubmergedIn", at = @At("RETURN"), cancellable = true)
public void spectrum$isSubmergedIn(TagKey<Fluid> fluidTag, CallbackInfoReturnable<Boolean> cir) {
if (!cir.getReturnValue() && fluidTag == FluidTags.WATER) {
cir.setReturnValue(this.submergedFluidTag.contains(SpectrumFluidTags.SWIMMABLE_FLUID));
}
}
//This breaks in a connector enviorment for some reason. -Shibva
//@Inject(method = "isSubmergedIn", at = @At("RETURN"), cancellable = true)
//public void spectrum$isSubmergedIn(TagKey<Fluid> fluidTag, CallbackInfoReturnable<Boolean> cir) {
// if (!cir.getReturnValue() && fluidTag == FluidTags.WATER) {
// cir.setReturnValue(this.submergedFluidTag.contains(SpectrumFluidTags.SWIMMABLE_FLUID));
// }
//}

@Inject(method = "isSubmergedInWater", at = @At("RETURN"), cancellable = true)
public void spectrum$isSubmergedInWater(CallbackInfoReturnable<Boolean> cir) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "bettercombat:twin_blade"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "bettercombat:dagger"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "bettercombat:sword"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "bettercombat:sword"
}
Loading