Allow Dilating Random Tick Speed
This commit is contained in:
parent
0d55d8089d
commit
918d0bc9b9
@ -1,5 +1,8 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
**1.0.10**
|
||||||
|
* Allow Dilating Random Tick Speed
|
||||||
|
|
||||||
**1.0.9**
|
**1.0.9**
|
||||||
* Fix Structure Generation Bug with Modded Biomes
|
* Fix Structure Generation Bug with Modded Biomes
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
fabric_loader_version = 0.7.10+build.191
|
fabric_loader_version = 0.7.10+build.191
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0.9
|
mod_version = 1.0.10
|
||||||
maven_group = com.thebrokenrail
|
maven_group = com.thebrokenrail
|
||||||
archives_base_name = reliccraft
|
archives_base_name = reliccraft
|
||||||
|
|
||||||
|
@ -89,4 +89,19 @@ public class TimeDilaterItem extends Item {
|
|||||||
tag.putByte("Artificial", (byte) 2);
|
tag.putByte("Artificial", (byte) 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static long getTimeDilationFactor(TimeSpeed speed) {
|
||||||
|
switch (speed) {
|
||||||
|
case FAST: {
|
||||||
|
return 4L;
|
||||||
|
}
|
||||||
|
case VERY_FAST: {
|
||||||
|
return 8L;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
case NORMAL: {
|
||||||
|
return 1L;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.thebrokenrail.reliccraft.mixin;
|
||||||
|
|
||||||
|
import com.thebrokenrail.reliccraft.item.TimeDilaterItem;
|
||||||
|
import net.minecraft.server.world.ServerChunkManager;
|
||||||
|
import net.minecraft.world.GameRules;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
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.Redirect;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
@Mixin(ServerChunkManager.class)
|
||||||
|
public abstract class MixinServerChunkManager {
|
||||||
|
@Shadow
|
||||||
|
public abstract World getWorld();
|
||||||
|
|
||||||
|
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/GameRules;getInt(Lnet/minecraft/world/GameRules$RuleKey;)I"), method = "tickChunks")
|
||||||
|
public int adjustRandomTickSpeed(GameRules gameRules, GameRules.RuleKey<GameRules.IntRule> rule) {
|
||||||
|
if (rule.equals(GameRules.RANDOM_TICK_SPEED)) {
|
||||||
|
return (int) (gameRules.getInt(rule) * TimeDilaterItem.getTimeDilationFactor(((TimeDilaterItem.DilatedWorld) getWorld()).getTimeSpeed()));
|
||||||
|
} else {
|
||||||
|
return gameRules.getInt(rule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -24,18 +24,7 @@ public abstract class MixinWorld implements TimeDilaterItem.DilatedWorld {
|
|||||||
|
|
||||||
@ModifyConstant(constant = @Constant(longValue = 1L), method = "tickTime")
|
@ModifyConstant(constant = @Constant(longValue = 1L), method = "tickTime")
|
||||||
public long tickTime(long value) {
|
public long tickTime(long value) {
|
||||||
switch (getTimeSpeed()) {
|
return value * TimeDilaterItem.getTimeDilationFactor(getTimeSpeed());
|
||||||
case FAST: {
|
|
||||||
return value * 4L;
|
|
||||||
}
|
|
||||||
case VERY_FAST: {
|
|
||||||
return value * 8L;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
case NORMAL: {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
"MixinLivingEntity",
|
"MixinLivingEntity",
|
||||||
"MixinLocateCommand",
|
"MixinLocateCommand",
|
||||||
"MixinNetherStarItem",
|
"MixinNetherStarItem",
|
||||||
|
"MixinServerChunkManager",
|
||||||
"MixinServerWorld",
|
"MixinServerWorld",
|
||||||
"MixinThrownEnderpearlEntity",
|
"MixinThrownEnderpearlEntity",
|
||||||
"MixinWorld"
|
"MixinWorld"
|
||||||
|
Reference in New Issue
Block a user