Skip to content

Commit

Permalink
1.20.4 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fayer3 committed Jan 13, 2025
1 parent c34c9f1 commit a265073
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ public abstract class GameRendererVRMixin
RenderPassManager.setVanillaRenderPass();
}
}
@WrapMethod(method = "pick(F)V")

@WrapMethod(method = "pick")
private void vivecraft$vrPick(float partialTick, Operation<Void> original) {
if (VRState.VR_RUNNING) {
// skip when data not available yet
Expand All @@ -161,7 +162,7 @@ public abstract class GameRendererVRMixin
}
}

@ModifyArg(method = "pick(Lnet/minecraft/world/entity/Entity;DDF)Lnet/minecraft/world/phys/HitResult;", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;pick(DFZ)Lnet/minecraft/world/phys/HitResult;"), index = 0)
@ModifyArg(method = "pick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;pick(DFZ)Lnet/minecraft/world/phys/HitResult;"), index = 0)
private double vivecraft$getCrossVec(double hitDistance) {
if (VRState.VR_RUNNING) {
// get the end of the reach point here, to have the correct reach distance
Expand Down Expand Up @@ -332,14 +333,12 @@ public abstract class GameRendererVRMixin

PoseStack poseStack = new PoseStack();
RenderHelper.applyVRModelView(vivecraft$DATA_HOLDER.currentPass, poseStack);
VREffectsHelper.renderGuiLayer(partialTick, true, poseStack);
DebugRenderHelper.renderDebug(poseStack, partialTick);

vivecraft$resetProjectionMatrix(partialTick);

VREffectsHelper.renderGuiLayer(partialTick, true);
VREffectsHelper.renderGuiLayer(partialTick, true, poseStack);

DebugRenderHelper.renderDebug(partialTick);
DebugRenderHelper.renderDebug(poseStack, partialTick);

if (KeyboardHandler.SHOWING) {
if (vivecraft$DATA_HOLDER.vrSettings.physicalKeyboard) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
Expand All @@ -21,7 +22,6 @@
import net.minecraft.world.item.Items;
import net.minecraft.world.item.alchemy.PotionUtils;
import net.minecraft.world.item.alchemy.Potions;
import net.minecraft.world.item.component.ItemAttributeModifiers;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.spongepowered.asm.mixin.Final;
Expand All @@ -31,7 +31,6 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.At.Shift;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.vivecraft.mixin.world.entity.PlayerMixin;
Expand Down Expand Up @@ -121,19 +120,13 @@ protected ServerPlayerMixin(EntityType<? extends LivingEntity> entityType, Level
!this.getItemBySlot(EquipmentSlot.FEET).isEmpty())
{
float addedDamage = 0F;
ItemStack boots = this.getItemBySlot(EquipmentSlot.FEET);
ItemAttributeModifiers modifiers = boots.getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY);
if (modifiers.modifiers().isEmpty()) {
modifiers = boots.getItem().getDefaultAttributeModifiers();
}

for (ItemAttributeModifiers.Entry entry : modifiers.modifiers()) {
if (entry.attribute().is(Attributes.ARMOR)) {
float amount = (float) entry.modifier().amount();
switch (entry.modifier().operation()) {
case ADD_VALUE -> addedDamage += amount;
case ADD_MULTIPLIED_TOTAL -> addedDamage += amount * addedDamage;
}
for (AttributeModifier modifier : this.getItemBySlot(EquipmentSlot.FEET).getItem()
.getDefaultAttributeModifiers(EquipmentSlot.FEET).get(Attributes.ARMOR)) {
float amount = (float) modifier.getAmount();
switch (modifier.getOperation()) {
case ADDITION -> addedDamage += amount;
case MULTIPLY_TOTAL -> addedDamage += amount * addedDamage;
}
}
return damage + addedDamage * ServerConfig.BOOTS_ARMOR_DAMAGE.get().floatValue();
Expand Down

0 comments on commit a265073

Please sign in to comment.