Increased minecart max speed and boosted speed
parent
4f2151e5c7
commit
9e9e91fb01
|
@ -9,6 +9,6 @@ plasma_build=22
|
||||||
api_version=1.1.0.1
|
api_version=1.1.0.1
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.1.0
|
mod_version = 1.2.0
|
||||||
maven_group = xyz.pixelatedw.finalbeta
|
maven_group = xyz.pixelatedw.finalbeta
|
||||||
archives_base_name = finalbeta
|
archives_base_name = finalbeta
|
||||||
|
|
|
@ -38,6 +38,10 @@ public class ModConfig {
|
||||||
"Allows dyed wool to be dyed back white using bone meal");
|
"Allows dyed wool to be dyed back white using bone meal");
|
||||||
public static final Option<Boolean> ENABLE_GHASTS_INSTA_DEATH = make("Enable Ghast Insta Death", true,
|
public static final Option<Boolean> ENABLE_GHASTS_INSTA_DEATH = make("Enable Ghast Insta Death", true,
|
||||||
"Allows ghasts to die in 1 shot when their fireballs get reflected at them");
|
"Allows ghasts to die in 1 shot when their fireballs get reflected at them");
|
||||||
|
public static final Option<Double> MINECART_MAX_SPEED = make("Minecart maximum speed limit", 0.5,
|
||||||
|
"Maximum allowed speed for minecarts\nVanilla default is 0.4");
|
||||||
|
public static final Option<Double> MINECART_POWERED_BOOST = make("Powered rails speed boost", 1.15,
|
||||||
|
"Extra speed modifier when minecarts go over powered rails\nVanilla default is 1.0");
|
||||||
|
|
||||||
public static final Option<Boolean> FIX_BOW_MODEL = make("Fix bow model", true,
|
public static final Option<Boolean> FIX_BOW_MODEL = make("Fix bow model", true,
|
||||||
"Makes the box model held by players and skeletons bigger and facing forward");
|
"Makes the box model held by players and skeletons bigger and facing forward");
|
||||||
|
|
|
@ -88,10 +88,10 @@ public class WyHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void cheatCommand(Player player) {
|
public static void cheatCommand(Player player) {
|
||||||
// player.dropItem(new ItemInstance(ItemType.minecartFurnace, 1));
|
// player.dropItem(new ItemInstance(Tile.LADDER, 64));
|
||||||
// player.dropItem(new ItemInstance(ItemType.minecartChest, 1));
|
// player.dropItem(new ItemInstance(ItemType.minecartChest, 1));
|
||||||
// player.dropItem(new ItemInstance(ItemType.coal, 64));
|
// player.dropItem(new ItemInstance(ItemType.coal, 64));
|
||||||
// player.dropItem(new ItemInstance(Tile.WOODEN_PRESSURE_PLATE, 2));
|
// player.dropItem(new ItemInstance(Tile.GOLDEN_RAIL, 64));
|
||||||
|
|
||||||
player.level.setLevelTime(0);
|
player.level.setLevelTime(0);
|
||||||
player.level.getProperties().setRaining(false);
|
player.level.getProperties().setRaining(false);
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
package xyz.pixelatedw.finalbeta.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.Minecart;
|
||||||
|
import net.minecraft.tile.Tile;
|
||||||
|
import net.minecraft.util.maths.MathsHelper;
|
||||||
|
import xyz.pixelatedw.finalbeta.ModConfig;
|
||||||
|
|
||||||
|
@Mixin(Entity.class)
|
||||||
|
public class EntityMixin {
|
||||||
|
|
||||||
|
@ModifyVariable(method = "move(DDD)V", at = @At("HEAD"), ordinal = 0)
|
||||||
|
private double boostXSpeed(double xSpeed) {
|
||||||
|
Entity entity = ((Entity) (Object) this);
|
||||||
|
if (entity instanceof Minecart && !entity.field_1642) {
|
||||||
|
Minecart minecart = (Minecart) entity;
|
||||||
|
boostSpeed(minecart, xSpeed);
|
||||||
|
}
|
||||||
|
return xSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModifyVariable(method = "move(DDD)V", at = @At("HEAD"), ordinal = 2)
|
||||||
|
private double boostZSpeed(double zSpeed) {
|
||||||
|
Entity entity = ((Entity) (Object) this);
|
||||||
|
if (entity instanceof Minecart && !entity.field_1642) {
|
||||||
|
Minecart minecart = (Minecart) entity;
|
||||||
|
boostSpeed(minecart, zSpeed);
|
||||||
|
}
|
||||||
|
return zSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private double boostSpeed(Minecart minecart, double original) {
|
||||||
|
int x = MathsHelper.floor(minecart.x);
|
||||||
|
int y = MathsHelper.floor(minecart.y);
|
||||||
|
int z = MathsHelper.floor(minecart.z);
|
||||||
|
int tileId = minecart.level.getTileId(x, y, z);
|
||||||
|
if (tileId == Tile.GOLDEN_RAIL.id) {
|
||||||
|
double boostedSpeed = Math.min(original * ModConfig.MINECART_POWERED_BOOST.get(), ModConfig.MINECART_MAX_SPEED.get());
|
||||||
|
return boostedSpeed;
|
||||||
|
}
|
||||||
|
return original;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,9 @@ package xyz.pixelatedw.finalbeta.mixin;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@ -31,6 +33,11 @@ public class MinecartMixin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ModifyConstant(method = "tick", constant = @Constant(doubleValue = 0.4))
|
||||||
|
private double getSpeedLimit(final double speedLimit) {
|
||||||
|
return ModConfig.MINECART_MAX_SPEED.get();
|
||||||
|
}
|
||||||
|
|
||||||
@Inject(method = "tick", at = @At("TAIL"))
|
@Inject(method = "tick", at = @At("TAIL"))
|
||||||
public void tick(CallbackInfo ci) {
|
public void tick(CallbackInfo ci) {
|
||||||
Minecart minecart = (Minecart) (Object) this;
|
Minecart minecart = (Minecart) (Object) this;
|
||||||
|
|
|
@ -40,7 +40,8 @@
|
||||||
"CraftingContainerMixin",
|
"CraftingContainerMixin",
|
||||||
"CraftingInventoryMixin",
|
"CraftingInventoryMixin",
|
||||||
"RecipeRegistryMixin",
|
"RecipeRegistryMixin",
|
||||||
"SnowballMixin"
|
"SnowballMixin",
|
||||||
|
"EntityMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": -1
|
"defaultRequire": -1
|
||||||
|
|
Loading…
Reference in New Issue