-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
173 additions
and
139 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
72 changes: 63 additions & 9 deletions
72
common/src/main/resources/assets/torchmaster/blockstates/feral_flare_lantern.json
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,10 +1,64 @@ | ||
{ | ||
"variants": { | ||
"facing=south": { "model": "torchmaster:block/feral_flare_lantern" }, | ||
"facing=north": { "model": "torchmaster:block/feral_flare_lantern" }, | ||
"facing=east": { "model": "torchmaster:block/feral_flare_lantern" }, | ||
"facing=west": { "model": "torchmaster:block/feral_flare_lantern" }, | ||
"facing=up": { "model": "torchmaster:block/feral_flare_lantern" }, | ||
"facing=down": { "model": "torchmaster:block/feral_flare_lantern" } | ||
} | ||
} | ||
"multipart": [ | ||
{ | ||
"apply": { | ||
"model": "torchmaster:block/feral_flare_lantern" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "torchmaster:block/feral_flare_lantern_stand", | ||
"x": 90 | ||
}, | ||
"when": { | ||
"facing": "south" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "torchmaster:block/feral_flare_lantern_stand", | ||
"x": 270 | ||
}, | ||
"when": { | ||
"facing": "north" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "torchmaster:block/feral_flare_lantern_stand", | ||
"x": 270, | ||
"y": 90 | ||
}, | ||
"when": { | ||
"facing": "east" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "torchmaster:block/feral_flare_lantern_stand", | ||
"x": 90, | ||
"y": 90 | ||
}, | ||
"when": { | ||
"facing": "west" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "torchmaster:block/feral_flare_lantern_stand", | ||
"x": 180 | ||
}, | ||
"when": { | ||
"facing": "up" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "torchmaster:block/feral_flare_lantern_stand" | ||
}, | ||
"when": { | ||
"facing": "down" | ||
} | ||
} | ||
] | ||
} |
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
File renamed without changes.
25 changes: 9 additions & 16 deletions
25
fabric/src/main/java/net/xalcon/torchmaster/mixin/BaseSpawnerMixin.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,35 +1,28 @@ | ||
package net.xalcon.torchmaster.mixin; | ||
|
||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import net.minecraft.world.entity.Mob; | ||
import net.minecraft.world.entity.MobSpawnType; | ||
import net.minecraft.world.level.BaseSpawner; | ||
import net.minecraft.world.level.LevelAccessor; | ||
import net.xalcon.torchmaster.events.EventResult; | ||
import net.xalcon.torchmaster.events.EventResultContainer; | ||
import net.xalcon.torchmaster.events.TorchmasterEventHandler; | ||
import net.xalcon.torchmaster.utils.MobWrapper; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(value = BaseSpawner.class, priority = 100) | ||
public abstract class BaseSpawnerMixin | ||
{ | ||
@Redirect( | ||
method = "serverTick", | ||
@WrapOperation( | ||
method = "serverTick(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;)V", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/world/entity/Mob;checkSpawnRules(Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/world/entity/MobSpawnType;)Z" | ||
) | ||
) | ||
private static boolean torchmaster_serverTick_checkSpawnRules(Mob mob, LevelAccessor level, MobSpawnType mobSpawnType) | ||
private static boolean torchmaster_serverTick_checkSpawnRules(Mob mob, LevelAccessor level, MobSpawnType mobSpawnType, Operation<Boolean> original) | ||
{ | ||
var container = new EventResultContainer(EventResult.DEFAULT); | ||
TorchmasterEventHandler.onCheckSpawn(mobSpawnType, mob, mob.position(), container); | ||
return switch(container.getResult()) | ||
{ | ||
case DEFAULT -> mob.checkSpawnRules(level, mobSpawnType); | ||
case ALLOW -> true; | ||
case DENY -> false; | ||
}; | ||
return MobWrapper.checkSpawnRules(mob, level, mobSpawnType, original); | ||
} | ||
} | ||
} |
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
26 changes: 12 additions & 14 deletions
26
fabric/src/main/java/net/xalcon/torchmaster/mixin/SpawnUtilMixin.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,29 +1,27 @@ | ||
package net.xalcon.torchmaster.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import net.minecraft.util.SpawnUtil; | ||
import net.minecraft.world.entity.Mob; | ||
import net.minecraft.world.entity.MobSpawnType; | ||
import net.minecraft.world.level.LevelAccessor; | ||
import net.xalcon.torchmaster.events.EventResult; | ||
import net.xalcon.torchmaster.events.EventResultContainer; | ||
import net.xalcon.torchmaster.events.TorchmasterEventHandler; | ||
import net.xalcon.torchmaster.utils.MobWrapper; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(SpawnUtil.class) | ||
public abstract class SpawnUtilMixin | ||
{ | ||
@Redirect(method = "trySpawnMob", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Mob;checkSpawnRules(Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/world/entity/MobSpawnType;)Z")) | ||
public boolean torchmaster_trySpawnMob_checkSpawnRules(Mob mob, LevelAccessor level, MobSpawnType mobSpawnType) | ||
@WrapOperation( | ||
method = "trySpawnMob", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/world/entity/Mob;checkSpawnRules(Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/world/entity/MobSpawnType;)Z" | ||
) | ||
) | ||
private static boolean torchmaster_trySpawnMob_checkSpawnRules(Mob mob, LevelAccessor level, MobSpawnType mobSpawnType, Operation<Boolean> original) | ||
{ | ||
var container = new EventResultContainer(EventResult.DEFAULT); | ||
TorchmasterEventHandler.onCheckSpawn(mobSpawnType, mob, mob.position(), container); | ||
return switch(container.getResult()) | ||
{ | ||
case DEFAULT -> mob.checkSpawnRules(level, mobSpawnType); | ||
case ALLOW -> true; | ||
case DENY -> false; | ||
}; | ||
return MobWrapper.checkSpawnRules(mob, level, mobSpawnType, original); | ||
} | ||
} |
Oops, something went wrong.