1.0.7
Fix Speed When Giant Fix Third-Person View Fix Inventory View
This commit is contained in:
parent
ce28c1c609
commit
30995c0cc3
@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
**1.0.7**
|
||||||
|
* Fix Speed When Giant
|
||||||
|
* Fix Third-Person View
|
||||||
|
* Fix Inventory View
|
||||||
|
|
||||||
**1.0.6**
|
**1.0.6**
|
||||||
* Fix Gradle Script
|
* Fix Gradle Script
|
||||||
* Automatically Adjust Shadow Size
|
* Automatically Adjust Shadow Size
|
||||||
|
@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
fabric_loader_version = 0.7.8+build.189
|
fabric_loader_version = 0.7.8+build.189
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0.6
|
mod_version = 1.0.7
|
||||||
maven_group = com.thebrokenrail
|
maven_group = com.thebrokenrail
|
||||||
archives_base_name = gulliver-reloaded
|
archives_base_name = gulliver-reloaded
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,8 @@ import com.thebrokenrail.gulliverreloaded.ScaledEntity;
|
|||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.client.MinecraftClient;
|
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 net.minecraft.client.network.ClientPlayerInteractionManager;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -16,6 +16,7 @@ import net.minecraft.entity.effect.StatusEffect;
|
|||||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
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.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
@ -27,13 +28,16 @@ import java.util.UUID;
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Mixin(LivingEntity.class)
|
@Mixin(LivingEntity.class)
|
||||||
public abstract class MixinLivingEntity implements ScaledEntity {
|
public abstract class MixinLivingEntity implements ScaledEntity {
|
||||||
|
@Unique
|
||||||
private static final UUID SCALED_SPEED_ID = UUID.fromString("c5267238-6a78-4257-ae83-a2a5e34c1128");
|
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);
|
private static final TrackedData<Float> SCALE = DataTracker.registerData(LivingEntity.class, TrackedDataHandlerRegistry.FLOAT);
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
public abstract Map<StatusEffect, StatusEffectInstance> getActiveStatusEffects();
|
public abstract Map<StatusEffect, StatusEffectInstance> getActiveStatusEffects();
|
||||||
|
|
||||||
@Shadow public abstract EntityAttributeInstance getAttributeInstance(EntityAttribute attribute);
|
@Shadow
|
||||||
|
public abstract EntityAttributeInstance getAttributeInstance(EntityAttribute attribute);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getScale() {
|
public float getScale() {
|
||||||
@ -92,7 +96,7 @@ public abstract class MixinLivingEntity implements ScaledEntity {
|
|||||||
if (speedAttribute.getModifier(SCALED_SPEED_ID) != null) {
|
if (speedAttribute.getModifier(SCALED_SPEED_ID) != null) {
|
||||||
speedAttribute.removeModifier(SCALED_SPEED_ID);
|
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")
|
@Inject(at = @At("RETURN"), method = "initDataTracker")
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 307 B After Width: | Height: | Size: 342 B |
@ -3,9 +3,11 @@
|
|||||||
"package": "com.thebrokenrail.gulliverreloaded.mixin",
|
"package": "com.thebrokenrail.gulliverreloaded.mixin",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"client": [
|
"client": [
|
||||||
|
"MixinCamera",
|
||||||
"MixinClientPlayerInteractionManager",
|
"MixinClientPlayerInteractionManager",
|
||||||
"MixinLivingEntityRenderer",
|
"MixinEntityRenderDispatcher",
|
||||||
"MixinEntityRenderDispatcher"
|
"MixinInventoryScreen",
|
||||||
|
"MixinLivingEntityRenderer"
|
||||||
],
|
],
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"BrewingRecipeRegistryAccessor",
|
"BrewingRecipeRegistryAccessor",
|
||||||
|
Reference in New Issue
Block a user