Browse Source

1.0.7

Fix Speed When Giant
Fix Third-Person View
Fix Inventory View
master 1.0.7+20w13b
TheBrokenRail 1 year ago
parent
commit
30995c0cc3
8 changed files with 71 additions and 5 deletions
  1. +5
    -0
      CHANGELOG.md
  2. +1
    -1
      gradle.properties
  3. +29
    -0
      src/main/java/com/thebrokenrail/gulliverreloaded/mixin/MixinCamera.java
  4. +2
    -0
      src/main/java/com/thebrokenrail/gulliverreloaded/mixin/MixinClientPlayerInteractionManager.java
  5. +24
    -0
      src/main/java/com/thebrokenrail/gulliverreloaded/mixin/MixinInventoryScreen.java
  6. +6
    -2
      src/main/java/com/thebrokenrail/gulliverreloaded/mixin/MixinLivingEntity.java
  7. BIN
      src/main/resources/assets/gulliver-reloaded/textures/mob_effect/shrink.png
  8. +4
    -2
      src/main/resources/gulliver-reloaded.mixins.json

+ 5
- 0
CHANGELOG.md View File

@ -1,5 +1,10 @@
# Changelog
**1.0.7**
* Fix Speed When Giant
* Fix Third-Person View
* Fix Inventory View
**1.0.6**
* Fix Gradle Script
* Automatically Adjust Shadow Size


+ 1
- 1
gradle.properties View File

@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
fabric_loader_version = 0.7.8+build.189
# Mod Properties
mod_version = 1.0.6
mod_version = 1.0.7
maven_group = com.thebrokenrail
archives_base_name = gulliver-reloaded


+ 29
- 0
src/main/java/com/thebrokenrail/gulliverreloaded/mixin/MixinCamera.java View File

@ -0,0 +1,29 @@
package com.thebrokenrail.gulliverreloaded.mixin;
import com.thebrokenrail.gulliverreloaded.ScaledEntity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.Camera;
import net.minecraft.entity.Entity;
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")
@Environment(EnvType.CLIENT)
@Mixin(Camera.class)
public abstract class MixinCamera {
@Shadow
private Entity focusedEntity;
@Shadow
protected abstract double clipToSpace(double distance);
@Shadow
protected abstract void moveBy(double x, double y, double z);
@Redirect(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;clipToSpace(D)D"))
public double onUpdateClipToSpaceProxy(Camera obj, double distance) {
float scale = focusedEntity instanceof ScaledEntity ? ((ScaledEntity) focusedEntity).getScale() : 1f;
return clipToSpace(distance * scale);
}
}

+ 2
- 0
src/main/java/com/thebrokenrail/gulliverreloaded/mixin/MixinClientPlayerInteractionManager.java View File

@ -4,6 +4,8 @@ import com.thebrokenrail.gulliverreloaded.ScaledEntity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;


+ 24
- 0
src/main/java/com/thebrokenrail/gulliverreloaded/mixin/MixinInventoryScreen.java View File

@ -0,0 +1,24 @@
package com.thebrokenrail.gulliverreloaded.mixin;
import com.thebrokenrail.gulliverreloaded.ScaledEntity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
import net.minecraft.entity.LivingEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
@SuppressWarnings("unused")
@Environment(EnvType.CLIENT)
@Mixin(InventoryScreen.class)
public class MixinInventoryScreen {
@ModifyVariable(at = @At("HEAD"), method = "drawEntity", argsOnly = true, index = 2)
private static int adjustEntitySize(int initial, int x, int y, int size, float mouseX, float mouseY, LivingEntity entity) {
if (entity instanceof ScaledEntity) {
return (int) (initial / ((ScaledEntity) entity).getScale());
} else {
return initial;
}
}
}

+ 6
- 2
src/main/java/com/thebrokenrail/gulliverreloaded/mixin/MixinLivingEntity.java View File

@ -16,6 +16,7 @@ import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@ -27,13 +28,16 @@ import java.util.UUID;
@SuppressWarnings("unused")
@Mixin(LivingEntity.class)
public abstract class MixinLivingEntity implements ScaledEntity {
@Unique
private static final UUID SCALED_SPEED_ID = UUID.fromString("c5267238-6a78-4257-ae83-a2a5e34c1128");
@Unique
private static final TrackedData<Float> SCALE = DataTracker.registerData(LivingEntity.class, TrackedDataHandlerRegistry.FLOAT);
@Shadow
public abstract Map<StatusEffect, StatusEffectInstance> getActiveStatusEffects();
@Shadow public abstract EntityAttributeInstance getAttributeInstance(EntityAttribute attribute);
@Shadow
public abstract EntityAttributeInstance getAttributeInstance(EntityAttribute attribute);
@Override
public float getScale() {
@ -92,7 +96,7 @@ public abstract class MixinLivingEntity implements ScaledEntity {
if (speedAttribute.getModifier(SCALED_SPEED_ID) != null) {
speedAttribute.removeModifier(SCALED_SPEED_ID);
}
speedAttribute.addModifier((new EntityAttributeModifier(SCALED_SPEED_ID, "Scaled speed multiplier", getScale() - 1, EntityAttributeModifier.Operation.MULTIPLY_TOTAL)).setSerialize(false));
speedAttribute.addModifier((new EntityAttributeModifier(SCALED_SPEED_ID, "Scaled speed multiplier", Math.pow(getScale(), 0.4) - 1, EntityAttributeModifier.Operation.MULTIPLY_TOTAL)).setSerialize(false));
}
@Inject(at = @At("RETURN"), method = "initDataTracker")


BIN
src/main/resources/assets/gulliver-reloaded/textures/mob_effect/shrink.png View File

Before After
Width: 18  |  Height: 18  |  Size: 307 B Width: 18  |  Height: 18  |  Size: 342 B

+ 4
- 2
src/main/resources/gulliver-reloaded.mixins.json View File

@ -3,9 +3,11 @@
"package": "com.thebrokenrail.gulliverreloaded.mixin",
"compatibilityLevel": "JAVA_8",
"client": [
"MixinCamera",
"MixinClientPlayerInteractionManager",
"MixinLivingEntityRenderer",
"MixinEntityRenderDispatcher"
"MixinEntityRenderDispatcher",
"MixinInventoryScreen",
"MixinLivingEntityRenderer"
],
"mixins": [
"BrewingRecipeRegistryAccessor",


Loading…
Cancel
Save