Compare commits

..

No commits in common. "406fe6f86121ddc145962108551e2e334a456642" and "94ceb63a1fb40b3d622f8d7373ed569f26e25078" have entirely different histories.

6 changed files with 8 additions and 90 deletions

View File

@ -46,8 +46,6 @@ public class ModConfig {
"Extra speed modifier when minecarts go over powered rails\nVanilla default is 1.0");
public static final Option<Boolean> FURNACE_MINECART_PUSH = make("Enable furnace minecarts push", true,
"Enables furance minecarts to push forward the first minecart it comes in contact with");
public static final Option<Boolean> FURNACE_MINECART_CHUNK_LOADING = make("Enable furnace minecarts to load chunks", true,
"Name says it all, furnace minecarts will load chunks as they go on tracks.");
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");
@ -75,8 +73,6 @@ public class ModConfig {
"Fixes double doors not being in their correct state when pressure plates are used to open them");
public static final Option<Boolean> FIX_SLABS_RECIPE = make("Fix Slabs Recipe", true,
"Givs two slabs for every block, since 1 block = 2 slabs => 3 blocks = 6 slabs (instead of 3)");
public static final Option<Boolean> FIX_SLIME_SPLITS = make("Fix Slime Splits", true,
"Fixes slimes not splitting if their HP is not exactly zero");
private static ModConfig instance = new ModConfig();
public static final ModConfig instance() {

View File

@ -92,34 +92,15 @@ public class WyHelper {
}
public static void cheatCommand(Player player) {
// Slime slime = new Slime(player.level);
// slime.setPositionAndAngles(player.x, player.y + 0.5D, player.z, player.level.rand.nextFloat() * 360.0F, 0.0F);
// player.level.spawnEntity(slime);
// slime.setSize(10);
// player.level.entities.stream().filter(e -> !(e instanceof Player)).forEach((e) -> ((net.minecraft.entity.Entity)e).remove());
// player.dropItem(new ItemInstance(Tile.LADDER, 64));
// player.dropItem(new ItemInstance(ItemType.minecart, 1));
// player.dropItem(new ItemInstance(ItemType.minecartFurnace, 1));
// player.dropItem(new ItemInstance(ItemType.minecartChest, 1));
// player.dropItem(new ItemInstance(ItemType.coal, 64));
// player.dropItem(new ItemInstance(Tile.GOLDEN_RAIL, 64));
// player.dropItem(new ItemInstance(Tile.COBBLESTONE, 64));
// player.level.setTile((int)player.x, (int)player.y, (int)player.z, Tile.COBBLESTONE.id);
// int x = 248;
// int y = 79;
// int z = -65;
//
// for (int i = 0; i < 500; i++) {
// player.level.setTile(x + i, y, z, Tile.REDSTONE_TORCH_LIT.id);
// }
// player.level.setLevelTime(0);
// player.level.getProperties().setRaining(false);
// player.level.getProperties().setRainTime(0);
// player.level.getProperties().setThundering(false);
// player.level.getProperties().setThunderTime(0);
player.level.setLevelTime(0);
player.level.getProperties().setRaining(false);
player.level.getProperties().setRainTime(0);
player.level.getProperties().setThundering(false);
player.level.getProperties().setThunderTime(0);
}
}

View File

@ -5,11 +5,7 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.entity.Entity;
import net.minecraft.entity.Minecart;
import net.minecraft.level.Level;
import net.minecraft.util.maths.MathsHelper;
import xyz.pixelatedw.finalbeta.ModConfig;
import xyz.pixelatedw.finalbeta.WyHelper;
@Mixin(Level.class)
@ -20,38 +16,4 @@ public class LevelMixin {
WyHelper.playTime++;
}
@Inject(method="updatePosition", at = @At("TAIL"))
public void updatePosition(Entity entity, boolean forceUpdate, CallbackInfo ci) {
if (ModConfig.FURNACE_MINECART_CHUNK_LOADING.get() && entity instanceof Minecart) {
Minecart minecart = ((Minecart) entity);
int x = MathsHelper.floor(entity.x);
int z = MathsHelper.floor(entity.z);
/*
* TODO This is very likely not optimal, we could probably do better
* and only load "forward" chunks relative to the cart's direction,
* but its barely noticeable in my tests and at least at the moment
* I don't care enough for this optimization.
*/
int area = 64;
boolean isRegionLoaded = entity.level.isRegionLoaded(x - area, 0, z - area, x + area, 128, z + area);
if (!isRegionLoaded && minecart.type == 2) {
loadRegion(entity.level, x - area, z - area, x + area, z + area);
}
}
}
private void loadRegion(Level level, int minX, int minZ, int maxX, int maxZ) {
minX >>= 4;
minZ >>= 4;
maxX >>= 4;
maxZ >>= 4;
for (int x = minX; x <= maxX; ++x) {
for (int z = minZ; z <= maxZ; ++z) {
if (!level.getLevelSource().isChunkLoaded(x, z)) {
level.getLevelSource().loadChunk(x, z);
}
}
}
}
}

View File

@ -66,7 +66,7 @@ public class MinecartMixin {
private double getSpeedLimit(final double speedLimit) {
return ModConfig.MINECART_MAX_SPEED.get();
}
@Inject(method = "tick", at = @At("TAIL"))
public void tick(CallbackInfo ci) {
Minecart minecart = (Minecart) (Object) this;

View File

@ -1,20 +0,0 @@
package xyz.pixelatedw.finalbeta.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.entity.monster.Slime;
import xyz.pixelatedw.finalbeta.ModConfig;
@Mixin(Slime.class)
public class SlimeMixin {
@Inject(method = "remove", at = @At("HEAD"))
public void remove(CallbackInfo ci) {
if (ModConfig.FIX_SLIME_SPLITS.get()) {
Slime slime = ((Slime) (Object) this);
slime.health = Math.max(slime.health, 0);
}
}
}

View File

@ -41,8 +41,7 @@
"CraftingInventoryMixin",
"RecipeRegistryMixin",
"SnowballMixin",
"EntityMixin",
"SlimeMixin"
"EntityMixin"
],
"injectors": {
"defaultRequire": -1