Compare commits

..

No commits in common. "master" and "v1.3.0" have entirely different histories.

17 changed files with 32 additions and 207 deletions

View File

@ -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.4.0 mod_version = 1.3.0
maven_group = xyz.pixelatedw.finalbeta maven_group = xyz.pixelatedw.finalbeta
archives_base_name = finalbeta archives_base_name = finalbeta

View File

@ -1,10 +0,0 @@
package xyz.pixelatedw.finalbeta;
import java.util.Set;
import net.minecraft.level.Level;
import net.minecraft.util.maths.Box;
public interface IMultiBoxCollision {
Set<Box> getCollisions(Level level, int x, int y, int z);
}

View File

@ -56,7 +56,6 @@ public class ModConfig {
"Makes it so players can no longer eat if they're at max HP so they don't accidently waste food"); "Makes it so players can no longer eat if they're at max HP so they don't accidently waste food");
public static final Option<Double> APPLE_DROP_RATE = make("Apple Drop Rate", 0.0, public static final Option<Double> APPLE_DROP_RATE = make("Apple Drop Rate", 0.0,
"Chance for apples to drop from leaves (decimal between 0.0 and 1.0)"); "Chance for apples to drop from leaves (decimal between 0.0 and 1.0)");
public static final Option<Boolean> EDIT_SIGNS = make("Edit Signs", true, "Enables sign editing");
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");
@ -100,15 +99,22 @@ public class ModConfig {
this.fileConfig.load(); this.fileConfig.load();
boolean save = false;
for (Option o : OPTIONS) { for (Option o : OPTIONS) {
if (!this.fileConfig.contains(o.name)) { if (!this.fileConfig.contains(o.name)) {
this.fileConfig.add(o.name, o.defaultValue); this.fileConfig.add(o.name, o.defaultValue);
this.fileConfig.setComment(o.name, o.description); this.fileConfig.setComment(o.name, o.description);
save = true;
} else if (!Strings.isNullOrEmpty(o.description) && this.fileConfig.contains(o.name) } else if (!Strings.isNullOrEmpty(o.description) && this.fileConfig.contains(o.name)
&& !this.fileConfig.containsComment(o.name)) { && !this.fileConfig.containsComment(o.name)) {
this.fileConfig.setComment(o.name, o.description); this.fileConfig.setComment(o.name, o.description);
save = true;
} }
} }
if (save) {
this.fileConfig.load();
}
} }
public static <T> Option<T> make(String name, T defaultValue, String description) { public static <T> Option<T> make(String name, T defaultValue, String description) {

View File

@ -17,9 +17,6 @@ public class ModSlider extends Button {
this.defaultText = label; this.defaultText = label;
this.changeEvent = changeEvent; this.changeEvent = changeEvent;
this.text = this.defaultText + "" + String.format("%.2f", this.value); this.text = this.defaultText + "" + String.format("%.2f", this.value);
if (this.id == 301) {
this.text = this.getCloudHeightString();
}
} }
@Override @Override
@ -40,13 +37,8 @@ public class ModSlider extends Button {
this.value = 1.0F; this.value = 1.0F;
} }
this.text = this.defaultText + "" + String.format("%.2f", this.value);
this.changeEvent.changeValue(this.value); this.changeEvent.changeValue(this.value);
this.text = this.defaultText + "" + String.format("%.2f", this.value);
if (this.id == 301) {
this.text = this.getCloudHeightString();
}
} }
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
@ -76,10 +68,6 @@ public class ModSlider extends Button {
} }
} }
private String getCloudHeightString() {
return this.defaultText + "" + String.format("%.2f", 108.0f + (108.0f * 2.0f * this.value));
}
@Override @Override
public void mouseReleased(int i, int j) { public void mouseReleased(int i, int j) {
this.dragged = false; this.dragged = false;

View File

@ -9,8 +9,8 @@ import java.util.HashMap;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.Player; import net.minecraft.entity.player.Player;
import net.minecraft.item.ItemInstance; import net.minecraft.item.ItemInstance;
import net.minecraft.item.ItemType;
import net.minecraft.recipe.RecipeRegistry; import net.minecraft.recipe.RecipeRegistry;
import net.minecraft.tile.Tile;
import xyz.pixelatedw.finalbeta.mixin.RecipeRegistryAccessor; import xyz.pixelatedw.finalbeta.mixin.RecipeRegistryAccessor;
public class WyHelper { public class WyHelper {
@ -115,8 +115,8 @@ public class WyHelper {
// player.dropItem(new ItemInstance(Tile.SLAB, 64)); // player.dropItem(new ItemInstance(Tile.SLAB, 64));
// player.dropItem(new ItemInstance(ItemType.minecart, 1)); // player.dropItem(new ItemInstance(ItemType.minecart, 1));
// player.dropItem(new ItemInstance(ItemType.minecartFurnace, 1)); // player.dropItem(new ItemInstance(ItemType.minecartFurnace, 1));
player.dropItem(new ItemInstance(ItemType.boat)); player.dropItem(new ItemInstance(Tile.FENCE, 1));
// player.dropItem(new ItemInstance(Tile.STONE_SLAB, 1, 2)); player.dropItem(new ItemInstance(Tile.STONE_SLAB, 1, 2));
// player.dropItem(new ItemInstance(Tile.GOLDEN_RAIL, 64)); // player.dropItem(new ItemInstance(Tile.GOLDEN_RAIL, 64));
// player.dropItem(new ItemInstance(Tile.COBBLESTONE, 64)); // player.dropItem(new ItemInstance(Tile.COBBLESTONE, 64));

View File

@ -7,9 +7,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.entity.Boat; import net.minecraft.entity.Boat;
import net.minecraft.util.maths.MathsHelper;
import xyz.pixelatedw.finalbeta.ModConfig; import xyz.pixelatedw.finalbeta.ModConfig;
import xyz.pixelatedw.finalbeta.WyHelper;
@Mixin(Boat.class) @Mixin(Boat.class)
public class BoatMixin { public class BoatMixin {
@ -23,7 +21,7 @@ public class BoatMixin {
* check, which we're setting to false before the vanilla check happens * check, which we're setting to false before the vanilla check happens
* if the boat is set to survive the impact from our checks. * if the boat is set to survive the impact from our checks.
* *
* Do note that the way the boat collision check happens is that the * Do note that they way the boat collision check happens is that the
* boat gets slowed down first, and then the velocity check is * boat gets slowed down first, and then the velocity check is
* performed, by default a velocity check is 0.15, we're raising that * performed, by default a velocity check is 0.15, we're raising that
* limit to 0.22. * limit to 0.22.
@ -31,12 +29,6 @@ public class BoatMixin {
if (this.isCollidingHorizontally(boat) && this.canSurvive(boat)) { if (this.isCollidingHorizontally(boat) && this.canSurvive(boat)) {
((Boat) (Object) this).field_1624 = false; ((Boat) (Object) this).field_1624 = false;
} }
if (boat.passenger != null && boat.field_1645 % 39 == 1) {
float speed = MathsHelper.sqrt(boat.velocityX * boat.velocityX + boat.velocityZ * boat.velocityZ);
float volume = 0.3f + WyHelper.lerp(WyHelper.clamp(speed, 0.0F, 0.25F), 0.0F, 0.7f);
boat.level.playSound(boat.x, boat.y, boat.z, "sound3.liquid.water", volume, 0.0f);
}
} }
private boolean canSurvive(Boat boat) { private boolean canSurvive(Boat boat) {

View File

@ -1,38 +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.CallbackInfoReturnable;
import net.minecraft.client.ClientInteractionManager;
import net.minecraft.entity.player.Player;
import net.minecraft.item.ItemInstance;
import net.minecraft.item.ItemType;
import net.minecraft.level.Level;
import net.minecraft.tile.Tile;
import net.minecraft.tile.entity.Sign;
import xyz.pixelatedw.finalbeta.ModConfig;
@Mixin(ClientInteractionManager.class)
public class ClientInteractionManagerMixin {
@Inject(method = "activateTile", at = @At("HEAD"), cancellable = true)
public void activateTile(Player player, Level level, ItemInstance heldItem, int x, int y, int z, int meta, CallbackInfoReturnable<Boolean> cir) {
int tileId = level.getTileId(x, y, z);
if (ModConfig.EDIT_SIGNS.get()) {
boolean isSign = tileId == Tile.STANDING_SIGN.id || tileId == Tile.WALL_SIGN.id;
// method_1373 = sneaking check
if (isSign && player.method_1373()) {
Sign signTile = (Sign) level.getTileEntity(x, y, z);
player.openSignScreen(signTile);
cir.setReturnValue(true);
return;
}
}
if (heldItem != null && heldItem.itemId == ItemType.sign.id && tileId == Tile.CHEST.id) {
cir.setReturnValue(heldItem.useOnTile(player, level, x, y, z, meta));
return;
}
}
}

View File

@ -1,9 +1,5 @@
package xyz.pixelatedw.finalbeta.mixin; package xyz.pixelatedw.finalbeta.mixin;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
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.Inject; import org.spongepowered.asm.mixin.injection.Inject;
@ -16,11 +12,9 @@ import net.minecraft.tile.FenceTile;
import net.minecraft.tile.Tile; import net.minecraft.tile.Tile;
import net.minecraft.tile.material.Material; import net.minecraft.tile.material.Material;
import net.minecraft.util.maths.Box; import net.minecraft.util.maths.Box;
import xyz.pixelatedw.finalbeta.IMultiBoxCollision;
import xyz.pixelatedw.finalbeta.ModConfig;
@Mixin(FenceTile.class) @Mixin(FenceTile.class)
public class FenceTileMixin extends Tile implements IMultiBoxCollision { public class FenceTileMixin extends Tile {
public FenceTileMixin(int i, Material j) { public FenceTileMixin(int i, Material j) {
super(i, j); super(i, j);
@ -33,21 +27,16 @@ public class FenceTileMixin extends Tile implements IMultiBoxCollision {
@Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true)
public void getCollisionShape(Level level, int x, int y, int z, CallbackInfoReturnable<Box> cir) { public void getCollisionShape(Level level, int x, int y, int z, CallbackInfoReturnable<Box> cir) {
if(ModConfig.FENCE_SLIM_HITBOX.get()) { cir.setReturnValue(createFenceBox(level, x, y, z, false));
cir.setReturnValue(this.createVanillaFenceBox(level, x, y, z, false));
}
} }
@Override @Override
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public Box getOutlineShape(Level level, int x, int y, int z) { public Box getOutlineShape(Level level, int x, int y, int z) {
if(ModConfig.FENCE_SLIM_HITBOX.get()) { return createFenceBox(level, x, y, z, true);
return this.createVanillaFenceBox(level, x, y, z, true);
}
return super.getOutlineShape(level, x, y, z);
} }
private Box createVanillaFenceBox(Level level, int x, int y, int z, boolean isOutline) { private Box createFenceBox(Level level, int x, int y, int z, boolean isOutline) {
Tile tile = ((FenceTile)(Object)this); Tile tile = ((FenceTile)(Object)this);
Tile xpTile = Tile.BY_ID[level.getTileId(x + 1, y, z)]; Tile xpTile = Tile.BY_ID[level.getTileId(x + 1, y, z)];
@ -65,7 +54,7 @@ public class FenceTileMixin extends Tile implements IMultiBoxCollision {
boolean southCheck = level.getMaterial(x, y, z + 1).isSolid() && zpCheck; boolean southCheck = level.getMaterial(x, y, z + 1).isSolid() && zpCheck;
boolean northCheck = level.getMaterial(x, y, z - 1).isSolid() && znCheck; boolean northCheck = level.getMaterial(x, y, z - 1).isSolid() && znCheck;
Box box = Box.getOrCreate(westCheck ? 0 : 0.375f, 0.0f, northCheck ? 0.0f : 0.375f, eastCheck ? 1.0f : 0.625f, 1.0F, southCheck ? 1.0f : 0.625f); Box box = Box.create(westCheck ? 0 : 0.375f, 0.0f, northCheck ? 0.0f : 0.375f, eastCheck ? 1.0f : 0.625f, 1.0F, southCheck ? 1.0f : 0.625f);
tile.minX = westCheck ? 0 : 0.375f; tile.minX = westCheck ? 0 : 0.375f;
tile.minY = 0.0; tile.minY = 0.0;
@ -87,58 +76,4 @@ public class FenceTileMixin extends Tile implements IMultiBoxCollision {
return box; return box;
} }
@Override
public void intersectsInLevel(Level level, int x, int y, int z, Box collision, ArrayList checks) {
if(ModConfig.FENCE_SLIM_HITBOX.get()) {
Set<Box> collisions = this.getCollisions(level, x, y, z);
for (Box other : collisions) {
if (other != null && collision.intersects(other)) {
checks.add(other);
}
}
}
}
@Override
public Set<Box> getCollisions(Level level, int x, int y, int z) {
Set<Box> collisions = new HashSet<Box>();
Tile xpTile = Tile.BY_ID[level.getTileId(x + 1, y, z)];
Tile xnTile = Tile.BY_ID[level.getTileId(x - 1, y, z)];
Tile zpTile = Tile.BY_ID[level.getTileId(x, y, z + 1)];
Tile znTile = Tile.BY_ID[level.getTileId(x, y, z - 1)];
boolean xpCheck = xpTile != null && (xpTile.isFullCube() || xpTile.id == Tile.FENCE.id);
boolean xnCheck = xnTile != null && (xnTile.isFullCube() || xnTile.id == Tile.FENCE.id);
boolean zpCheck = zpTile != null && (zpTile.isFullCube() || zpTile.id == Tile.FENCE.id);
boolean znCheck = znTile != null && (znTile.isFullCube() || znTile.id == Tile.FENCE.id);
boolean eastCheck = level.getMaterial(x + 1, y, z).isSolid() && xpCheck;
boolean westCheck = level.getMaterial(x - 1, y, z).isSolid() && xnCheck;
boolean southCheck = level.getMaterial(x, y, z + 1).isSolid() && zpCheck;
boolean northCheck = level.getMaterial(x, y, z - 1).isSolid() && znCheck;
if (eastCheck) {
collisions.add(Box.getOrCreate(x + 0.375f, y + 0.0f, z + 0.375f, x + 1.0f, y + 1.5F, z + 0.625f));
}
if (westCheck) {
collisions.add(Box.getOrCreate(x + 0.0f, y + 0.0f, z + 0.375f, x + 0.625f, y + 1.5F, z + 0.625f));
}
if (northCheck) {
collisions.add(Box.getOrCreate(x + 0.375f, y + 0.0f, z + 0.0f, x + 0.625f, y + 1.5F, z + 0.625f));
}
if (southCheck) {
collisions.add(Box.getOrCreate(x + 0.375f, y + 0.0f, z + 0.375f, x + 0.625f, y + 1.5F, z + 1.0f));
}
if (collisions.isEmpty()) {
collisions.add(Box.getOrCreate(x + 0.375f, y + 0.0f, z + 0.375f, x + 0.625f, y + 1.5F, z + 0.625f));
}
return collisions;
}
} }

View File

@ -1,15 +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.ModifyArg;
import net.minecraft.tile.FlowingFluidTile;
@Mixin(FlowingFluidTile.class)
public class FlowingFluidTileMixin {
@ModifyArg(method = "onScheduledTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/level/Level;getTileMeta(III)I"), index = 1)
private int updateFlowingWater(int y) {
return y - 1;
}
}

View File

@ -21,7 +21,7 @@ public class MinecraftMixin {
public void createDisplay() throws LWJGLException { public void createDisplay() throws LWJGLException {
// Why the fuck is this even a thing ? What was its intended purpose ? I NEED TO KNOW // Why the fuck is this even a thing ? What was its intended purpose ? I NEED TO KNOW
Minecraft.field_2800 = null; Minecraft.field_2800 = null;
Display.create(new PixelFormat().withDepthBits(24)); Display.create(new PixelFormat(0, 24, 0));
} }
@Inject(method = "loadSoundFromDir", at = @At("HEAD")) @Inject(method = "loadSoundFromDir", at = @At("HEAD"))

View File

@ -1,22 +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.CallbackInfoReturnable;
import net.minecraft.entity.player.Player;
import net.minecraft.item.ItemInstance;
import net.minecraft.item.food.MushroomStewItem;
import net.minecraft.level.Level;
import xyz.pixelatedw.finalbeta.ModConfig;
@Mixin(MushroomStewItem.class)
public class MushroomStewItemMixin {
@Inject(method = "use", at = @At("HEAD"), cancellable = true)
public void use(ItemInstance stack, Level level, Player player, CallbackInfoReturnable<ItemInstance> cir) {
if (ModConfig.DISABLE_EATING_WHEN_MAX_HP.get() && player.health >= 20) {
cir.setReturnValue(stack);
}
}
}

View File

@ -1,6 +1,8 @@
package xyz.pixelatedw.finalbeta.mixin; package xyz.pixelatedw.finalbeta.mixin;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import net.minecraft.client.util.ResourceDownloadThread; import net.minecraft.client.util.ResourceDownloadThread;
@ -9,8 +11,8 @@ public class ResourceDownloadThreadMixin {
private static final String RESOURCES_URL = "http://mcresources.modification-station.net/MinecraftResources/"; private static final String RESOURCES_URL = "http://mcresources.modification-station.net/MinecraftResources/";
// @ModifyConstant(method = "run", constant = @Constant(stringValue = "http://s3.amazonaws.com/MinecraftResources/"), remap = false) @ModifyConstant(method = "run", constant = @Constant(stringValue = "http://s3.amazonaws.com/MinecraftResources/"), remap = false)
// private String getResourcesUrl(String def) { private String getResourcesUrl(String def) {
// return RESOURCES_URL; return RESOURCES_URL;
// } }
} }

View File

@ -18,16 +18,7 @@ import xyz.pixelatedw.finalbeta.ModConfig;
public class SnowballMixin { public class SnowballMixin {
// Note, this is actually the "fireball" used by Ghasts. I guess they didn't have the fire charges done yet // Note, this is actually the "fireball" used by Ghasts. I guess they didn't have the fire charges done yet
@Inject( @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;damage(Lnet/minecraft/entity/Entity;I)Z", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true)
method = "tick",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/Entity;damage(Lnet/minecraft/entity/Entity;I)Z",
shift = At.Shift.BEFORE
),
locals = LocalCapture.CAPTURE_FAILHARD,
cancellable = true
)
private void newDamageRouter(CallbackInfo ci, Vec3d _v1, Vec3d _v2, HitResult result) { private void newDamageRouter(CallbackInfo ci, Vec3d _v1, Vec3d _v2, HitResult result) {
Snowball fireball = ((Snowball)(Object)this); Snowball fireball = ((Snowball)(Object)this);
if (ModConfig.ENABLE_GHASTS_INSTA_DEATH.get() && result != null && !fireball.level.isClient) { if (ModConfig.ENABLE_GHASTS_INSTA_DEATH.get() && result != null && !fireball.level.isClient) {

View File

@ -17,7 +17,7 @@ public class StillFluidTileMixin {
public void onScheduledTick(Level level, int x, int y, int z, Random random, CallbackInfo ci) { public void onScheduledTick(Level level, int x, int y, int z, Random random, CallbackInfo ci) {
StillFluidTile tile = ((StillFluidTile) (Object) this); StillFluidTile tile = ((StillFluidTile) (Object) this);
if (tile.material == Material.LAVA) { if (tile.material == Material.LAVA) {
if (level.rand.nextInt(10) == 1) { if (level.rand.nextBoolean()) {
level.playSound(x, y, z, "sound3.liquid.lava", 0.5f, 1.0f); level.playSound(x, y, z, "sound3.liquid.lava", 0.5f, 1.0f);
} else { } else {
level.playSound(x, y, z, "sound3.liquid.lavapop", 0.5f, 1.0f); level.playSound(x, y, z, "sound3.liquid.lavapop", 0.5f, 1.0f);

View File

@ -27,7 +27,6 @@ public class VideoSettingsScreenMixin extends ScreenMixin {
if (btn.active) { if (btn.active) {
if (btn.id == 300) { if (btn.id == 300) {
ModConfig.ENABLE_CLOUDS.set(!ModConfig.ENABLE_CLOUDS.get()); ModConfig.ENABLE_CLOUDS.set(!ModConfig.ENABLE_CLOUDS.get());
btn.text = this.getCloudsLabel();
ci.cancel(); ci.cancel();
} }
else if(btn.id == 301) { else if(btn.id == 301) {

View File

@ -49,10 +49,7 @@
"ItemTypeAccessor", "ItemTypeAccessor",
"PressurePlateTileMixin", "PressurePlateTileMixin",
"LeavesTileMixin", "LeavesTileMixin",
"StillFluidTileMixin", "StillFluidTileMixin"
"FlowingFluidTileMixin",
"ClientInteractionManagerMixin",
"MushroomStewItemMixin"
], ],
"injectors": { "injectors": {
"defaultRequire": -1 "defaultRequire": -1