Skip to content

Commit 2fdeb19

Browse files
committed
slime noclip through trees
1 parent b989ba1 commit 2fdeb19

File tree

6 files changed

+69
-42
lines changed

6 files changed

+69
-42
lines changed

TODO.txt

+5-3
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ Bugfixes
2828
[❌] groundYlevel not working if you're already below it?
2929
[❌] gui scale not working?
3030

31-
[❌] tutorial camera centering is off
32-
[❌] Mounted piglins don't heal from nether terrain
3331

34-
[🟡] Load freezing (fixed by goodbird, pull 1.20.1 branch)
32+
[❌] Recreate tutorial world in 1.20.1
33+
[🟡] tutorial camera centering is off
34+
[🟡] Mounted piglins don't heal from nether terrain
35+
3536

3637
Quality of Life
3738
---------------
39+
[❌] Add commands to send resources
3840
[❌] Ravagers that are mounted no longer aggro automatically onto buildings
3941
- This prevents them hurting themselves from the splash damage
4042
[❌] Button to toggle spider climbing

TODO_backlog.txt

+2-9
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@
66
Features
77
--------
88

9-
[❌] Piglin mines
10-
- Static defense for piglins, but can also be used to siege
11-
- When built, can be exploded manaully (or set to autoexplode on nearby enemies approaching)
12-
- Explodes into combination of soulsand and magma
13-
9+
[❌] Import the Bedrock Minecraft Movie addon piglins
1410

11+
[❌] Add basic controls for non-rts units (so you can control modded units)
1512

1613

1714
Bugfixes
1815
--------
1916

20-
[❌] Central portals sometimes do not ignite (and this somehow makes grunts spawn underground)
21-
2217
[❌] Dying in survival puts you in a bugged survival mode
2318

2419
[❌] Villagers with professions don't use the correct texture for their arms, esp. farmers
@@ -31,8 +26,6 @@ Quality of Life Features
3126

3227
[❌] Added /gamerule for bridges over void
3328

34-
[❌] Save transport portal links between server restarts
35-
3629
[❌] restore ores on /rts-reset
3730
- Have to track each ore block when it is mined or converted into nether terrain
3831

src/main/java/com/solegendary/reignofnether/mixin/EntityMixin.java

+39-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
package com.solegendary.reignofnether.mixin;
22

33
import com.solegendary.reignofnether.orthoview.OrthoviewClientEvents;
4+
import com.solegendary.reignofnether.resources.BlockUtils;
5+
import net.minecraft.core.BlockPos;
46
import net.minecraft.network.chat.Component;
57
import net.minecraft.world.damagesource.DamageSource;
68
import net.minecraft.world.damagesource.DamageSources;
79
import net.minecraft.world.entity.Entity;
810
import net.minecraft.world.entity.EntityType;
11+
import net.minecraft.world.level.Level;
12+
import net.minecraft.world.level.block.Blocks;
13+
import net.minecraft.world.level.block.state.BlockState;
914
import net.minecraft.world.phys.AABB;
15+
import net.minecraft.world.phys.Vec3;
1016
import org.spongepowered.asm.mixin.Mixin;
1117
import org.spongepowered.asm.mixin.Shadow;
1218
import org.spongepowered.asm.mixin.injection.At;
1319
import org.spongepowered.asm.mixin.injection.Inject;
20+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
1421
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
1522

1623
@Mixin(Entity.class)
@@ -55,12 +62,11 @@ private void isInvulnerableTo(DamageSource pSource, CallbackInfoReturnable<Boole
5562
@Shadow public int getTicksFrozen() { return 0; }
5663

5764
@Shadow public abstract DamageSources damageSources();
58-
5965
@Shadow public abstract Component getName();
60-
6166
@Shadow public abstract void remove(Entity.RemovalReason pReason);
62-
6367
@Shadow public abstract AABB getBoundingBox();
68+
@Shadow public abstract BlockPos getOnPos();
69+
@Shadow public abstract Level level();
6470

6571
@Inject(
6672
method = "getPercentFrozen",
@@ -73,7 +79,6 @@ protected void getPercentFrozen(CallbackInfoReturnable<Float> cir) {
7379
cir.setReturnValue(Math.min(percent, 0.5f));
7480
}
7581

76-
/*
7782
@Inject(
7883
method = "collide",
7984
at = @At("TAIL"),
@@ -83,13 +88,37 @@ public void collide(Vec3 pVec, CallbackInfoReturnable<Vec3> cir) {
8388
if (!getName().getString().contains("magma"))
8489
return;
8590

86-
// TODO: detect if bb contains log or leaf blocks
87-
// boolean isNearLogs = this.getBoundingBox().get
88-
8991
Vec3 result = cir.getReturnValue();
9092

91-
cir.setReturnValue(new Vec3(pVec.x, result.y, pVec.z));
92-
}
93-
*/
93+
boolean isNearLeafOrLog = false;
94+
95+
AABB aabb = getBoundingBox().inflate(0.5f);
96+
outerloop:
97+
for (int x = (int) aabb.minX; x < aabb.maxX; x++) {
98+
for (int y = (int) aabb.minY; y < aabb.maxY; y++) {
99+
for (int z = (int) aabb.minZ; z < aabb.maxZ; z++) {
100+
BlockState bs = level().getBlockState(new BlockPos(x,y,z));
101+
if (BlockUtils.isLogBlock(bs) ||
102+
BlockUtils.isFallingLogBlock(bs) ||
103+
BlockUtils.isLeafBlock(bs)) {
104+
isNearLeafOrLog = true;
105+
break outerloop;
106+
}
107+
}
108+
}
109+
}
110+
if (!isNearLeafOrLog)
111+
return;
112+
113+
BlockState bs = level().getBlockState(getOnPos());
114+
BlockState bsBelow = level().getBlockState(getOnPos().below());
94115

116+
if (BlockUtils.isLogBlock(bs) || BlockUtils.isLogBlock(bsBelow) ||
117+
BlockUtils.isFallingLogBlock(bs) || BlockUtils.isFallingLogBlock(bsBelow) ||
118+
BlockUtils.isLeafBlock(bs) || BlockUtils.isLeafBlock(bsBelow)) {
119+
cir.setReturnValue(new Vec3(pVec.x, pVec.y, pVec.z));
120+
} else {
121+
cir.setReturnValue(new Vec3(pVec.x, result.y, pVec.z));
122+
}
123+
}
95124
}

src/main/java/com/solegendary/reignofnether/tutorial/TutorialClientEvents.java

+18-19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.solegendary.reignofnether.tutorial;
22

3-
import com.mojang.blaze3d.vertex.PoseStack;
43
import com.solegendary.reignofnether.ReignOfNether;
54
import com.solegendary.reignofnether.building.Building;
65
import com.solegendary.reignofnether.building.BuildingClientEvents;
@@ -68,20 +67,20 @@ public class TutorialClientEvents {
6867

6968
private static final ArrayList<Building> damagedBuildings = new ArrayList<>();
7069

70+
7171
// all these positions are for camera only, actual spawn locations differ slightly on the serverside
72-
private static final Vec3i SPAWN_POS = new Vec3i(-2950, 0, -1166);
73-
public static final Vec3i BUILD_CAM_POS = new Vec3i(-2944, 0, -1200);
74-
public static final Vec3i BUILD_CAPITOL_POS = new Vec3i(-2936, 67, -1217);
75-
private static final Vec3i WOOD_POS = new Vec3i(-2919, 0, -1196);
76-
private static final Vec3i ORE_POS = new Vec3i(-2951, 0, -1224);
77-
private static final Vec3i FOOD_POS = new Vec3i(-2939, 0, -1173);
72+
private static final Vec3i SPAWN_CAM_POS = new Vec3i(-2960, 0, -1156);
73+
public static final Vec3i BUILD_CAM_POS = new Vec3i(-2954, 0, -1190);
74+
private static final Vec3i WOOD_CAM_POS = new Vec3i(-2929, 0, -1186);
75+
private static final Vec3i ORE_CAM_POS = new Vec3i(-2961, 0, -1214);
76+
private static final Vec3i FOOD_CAM_POS = new Vec3i(-2949, 0, -1163);
77+
private static final Vec3i MONSTER_CAM_POS = new Vec3i(-2993, 64, -1189);
78+
private static final Vec3i BRIDGE_CAM_POS = new Vec3i(-3007, 0, -1196);
79+
private static final Vec3i ARMY_CAM_POS = new Vec3i(-2973, 64, -1150);
7880

79-
private static final Vec3i MONSTER_CAMERA_POS = new Vec3i(-2983, 64, -1199);
81+
public static final Vec3i BUILD_CAPITOL_POS = new Vec3i(-2936, 67, -1217);
8082
private static final Vec3i MONSTER_BASE_POS = new Vec3i(-3085, 72, -1277);
8183

82-
private static final Vec3i BRIDGE_POS = new Vec3i(-2997, 0, -1206);
83-
private static final Vec3i ARMY_POS = new Vec3i(-2963, 64, -1160);
84-
8584
private static Supplier<Boolean> shouldPauseTicking = () -> false;
8685

8786
private static int helpButtonClicks = 0;
@@ -430,7 +429,7 @@ public static void updateStage() {
430429
progressStageAfterDelay(120);
431430
} else if (stageProgress == 1) {
432431
msg("tutorial.reignofnether.spawn_villagers");
433-
OrthoviewClientEvents.forceMoveCam(SPAWN_POS, 50);
432+
OrthoviewClientEvents.forceMoveCam(SPAWN_CAM_POS, 50);
434433
OrthoviewClientEvents.lockCam();
435434
nextStageAfterDelay(100);
436435
}
@@ -614,7 +613,7 @@ public static void updateStage() {
614613
progressStageAfterDelay(120);
615614
} else if (stageProgress == 1) {
616615
msg("tutorial.reignofnether.forest");
617-
OrthoviewClientEvents.forceMoveCam(WOOD_POS, 100);
616+
OrthoviewClientEvents.forceMoveCam(WOOD_CAM_POS, 100);
618617
progressStageAfterDelay(120);
619618
} else if (stageProgress == 2) {
620619
msg("tutorial.reignofnether.gather_wood");
@@ -642,7 +641,7 @@ public static void updateStage() {
642641
progressStageAfterDelay(100);
643642
} else if (stageProgress == 1) {
644643
msg("tutorial.reignofnether.beach_ore");
645-
OrthoviewClientEvents.forceMoveCam(ORE_POS, 50);
644+
OrthoviewClientEvents.forceMoveCam(ORE_CAM_POS, 50);
646645
progressStageAfterDelay(120);
647646
} else if (stageProgress == 2) {
648647
msg("tutorial.reignofnether.click_ore");
@@ -669,7 +668,7 @@ public static void updateStage() {
669668
msg("tutorial.reignofnether.gather_food");
670669
progressStageAfterDelay(120);
671670
} else if (stageProgress == 1) {
672-
OrthoviewClientEvents.forceMoveCam(FOOD_POS, 50);
671+
OrthoviewClientEvents.forceMoveCam(FOOD_CAM_POS, 50);
673672
TutorialServerboundPacket.doServerAction(TutorialAction.SPAWN_ANIMALS);
674673
msg("tutorial.reignofnether.pigs");
675674
progressStageAfterDelay(140);
@@ -844,7 +843,7 @@ public static void updateStage() {
844843
msg("tutorial.reignofnether.monster_attack");
845844
TutorialServerboundPacket.doServerAction(TutorialAction.SET_NIGHT_TIME);
846845
TutorialServerboundPacket.doServerAction(TutorialAction.SPAWN_MONSTERS_A);
847-
OrthoviewClientEvents.forceMoveCam(MONSTER_CAMERA_POS, 50);
846+
OrthoviewClientEvents.forceMoveCam(MONSTER_CAM_POS, 50);
848847
progressStageAfterDelay(120);
849848
}
850849
if (stageProgress == 1) {
@@ -869,7 +868,7 @@ public static void updateStage() {
869868
.isEmpty()) {
870869
msg("tutorial.reignofnether.more_incoming");
871870
TutorialServerboundPacket.doServerAction(TutorialAction.SPAWN_MONSTERS_B);
872-
OrthoviewClientEvents.forceMoveCam(MONSTER_CAMERA_POS, 50);
871+
OrthoviewClientEvents.forceMoveCam(MONSTER_CAM_POS, 50);
873872
progressStageAfterDelay(100);
874873
}
875874
} else if (stageProgress == 4) {
@@ -943,7 +942,7 @@ public static void updateStage() {
943942
msg("tutorial.reignofnether.build_bridge");
944943
progressStageAfterDelay(100);
945944
} else if (stageProgress == 2) {
946-
OrthoviewClientEvents.forceMoveCam(BRIDGE_POS, 50);
945+
OrthoviewClientEvents.forceMoveCam(BRIDGE_CAM_POS, 50);
947946
msg("tutorial.reignofnether.build_bridge2");
948947
setHelpButtonText("tutorial.reignofnether.build_bridge3");
949948
progressStage();
@@ -977,7 +976,7 @@ public static void updateStage() {
977976
if (stageProgress == 0) {
978977
msg("tutorial.reignofnether.reinforcements");
979978
TutorialServerboundPacket.doServerAction(TutorialAction.SPAWN_FRIENDLY_ARMY);
980-
OrthoviewClientEvents.forceMoveCam(ARMY_POS, 50);
979+
OrthoviewClientEvents.forceMoveCam(ARMY_CAM_POS, 50);
981980
progressStageAfterDelay(160);
982981
} else if (stageProgress == 1) {
983982
msg("tutorial.reignofnether.iron_golem");

src/main/java/com/solegendary/reignofnether/unit/interfaces/Unit.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ public static void tick(Unit unit) {
194194
} else if (unit.getFaction() == Faction.PIGLINS &&
195195
le.tickCount % PIGLIN_HEALING_TICKS == 0 &&
196196
!(unit instanceof Slime) &&
197-
(NetherBlocks.isNetherBlock(le.level(), le.getOnPos()) || unit instanceof GhastUnit)) {
197+
((le.getVehicle() != null && NetherBlocks.isNetherBlock(le.level(), le.getVehicle().getOnPos())) ||
198+
NetherBlocks.isNetherBlock(le.level(), le.getOnPos()) ||
199+
unit instanceof GhastUnit)) {
198200
le.heal(1);
199201
}
200202
}

src/main/java/com/solegendary/reignofnether/unit/units/monsters/SlimeUnit.java

+2
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ public void tick() {
380380
}
381381

382382
// break leaves that are touched
383+
/*
383384
public void aiStep() {
384385
super.aiStep();
385386
if (this.isAlive() && getSize() >= 2) {
@@ -408,6 +409,7 @@ public void aiStep() {
408409
}
409410
}
410411
}
412+
*/
411413

412414
// stop moving if we overshoot our move target
413415
private double lastDistToMoveTargetSqr = 9999;

0 commit comments

Comments
 (0)