Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand Action(IForgeAction&IForgeArmPose) #46

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
IForgeArmPose
  • Loading branch information
Ecdcaeb committed Jan 21, 2024
commit a7bfb142bc62e0d7a728060b2fd05d62389b3f12
33 changes: 33 additions & 0 deletions patches/minecraft/net/minecraft/client/model/ModelBiped.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--- before/net/minecraft/client/model/ModelBiped.java
+++ after/net/minecraft/client/model/ModelBiped.java
@@ -267,6 +267,8 @@
this.field_178723_h.field_78795_f = (float)(-Math.PI / 2) + this.field_78116_c.field_78795_f;
this.field_178724_i.field_78795_f = (float)(-Math.PI / 2) + this.field_78116_c.field_78795_f;
}
+ this.field_187075_l.setRotationAnglesLeftHand(this,p_78087_1_,p_78087_2_,p_78087_3_,p_78087_4_,p_78087_5_,p_78087_6_,p_78087_7_);
+ this.field_187076_m.setRotationAnglesRightHand(this,p_78087_1_,p_78087_2_,p_78087_3_,p_78087_4_,p_78087_5_,p_78087_6_,p_78087_7_);

func_178685_a(this.field_78116_c, this.field_178720_f);
}
@@ -321,11 +323,20 @@
}

@SideOnly(Side.CLIENT)
- public static enum ArmPose
+ public static enum ArmPose implements net.minecraftforge.client.model.IForgeArmPose
{
EMPTY,
ITEM,
BLOCK,
BOW_AND_ARROW;
+ //=======FORGE START=======//
+ private final net.minecraftforge.client.model.IForgeArmPose pose;
+ ArmPose(net.minecraftforge.client.model.IForgeArmPose poseIn){pose=poseIn;}
+ ArmPose(){this(net.minecraftforge.client.model.IForgeArmPose.EMPTY);}
+ @Override
+ public void setRotationAnglesLeftHand(net.minecraft.client.model.ModelBiped modelBiped, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, net.minecraft.entity.Entity entityIn) {pose.setRotationAnglesLeftHand(modelBiped, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);}
+ @Override
+ public void setRotationAnglesRightHand(net.minecraft.client.model.ModelBiped modelBiped, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, net.minecraft.entity.Entity entityIn) {pose.setRotationAnglesRightHand(modelBiped, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);}
+ //=======FORGE END=========//
}
}
8 changes: 8 additions & 0 deletions src/main/java/net/minecraftforge/client/EnumHelperClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@

import com.cleanroommc.hackery.enums.EnumHackery;
import net.minecraft.client.audio.MusicTicker;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.Util.EnumOS;
import net.minecraft.world.GameType;
import net.minecraft.client.settings.GameSettings.Options;
import net.minecraftforge.client.model.IForgeArmPose;
import net.minecraftforge.common.util.EnumHelper;

import javax.annotation.Nullable;
Expand All @@ -39,6 +41,12 @@ public class EnumHelperClient extends EnumHelper
{MusicTicker.MusicType.class, SoundEvent.class, int.class, int.class}
};

public static ModelBiped.ArmPose addArmPose(String name, IForgeArmPose pose){
return EnumHackery.addEnumEntry(ModelBiped.ArmPose.class, name,
new Class<?>[]{IForgeArmPose.class},
new Object[]{pose});
}

@Nullable
public static GameType addGameType(String name, int id, String displayName, String shortName)
{
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/net/minecraftforge/client/model/IForgeArmPose.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package net.minecraftforge.client.model;

import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public interface IForgeArmPose {
IForgeArmPose EMPTY=new IForgeArmPose() {};
default void setRotationAnglesLeftHand(ModelBiped modelBiped,float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
}
default void setRotationAnglesRightHand(ModelBiped modelBiped,float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
}
}
8 changes: 8 additions & 0 deletions src/main/java/net/minecraftforge/common/util/EnumHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;

import net.minecraftforge.common.IForgeAction;
import net.minecraftforge.fml.common.EnhancedRuntimeException;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraft.block.BlockPressurePlate.Sensitivity;
Expand Down Expand Up @@ -86,6 +87,13 @@ public static EnumAction addAction(String name)
return EnumHackery.addEnumEntry(EnumAction.class, name);
}
@Nullable
public static EnumAction addAction(String name, IForgeAction action)
{
return EnumHackery.addEnumEntry(EnumAction.class, name,
new Class<?>[]{IForgeAction.class},
new Object[]{action});
}
@Nullable
public static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip, float toughness)
{
return EnumHackery.addEnumEntry(ArmorMaterial.class, name,
Expand Down