mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
aim IAnimatedItem like a bow
This commit is contained in:
parent
dbd63e706f
commit
2efce806a9
@ -10,9 +10,12 @@ import net.minecraft.item.ItemStack;
|
|||||||
|
|
||||||
public interface IAnimatedItem<T extends Enum<?>> {
|
public interface IAnimatedItem<T extends Enum<?>> {
|
||||||
|
|
||||||
// Fetch the animation for a given type
|
/** Fetch the animation for a given type */
|
||||||
public BusAnimation getAnimation(T type, ItemStack stack);
|
public BusAnimation getAnimation(T type, ItemStack stack);
|
||||||
|
|
||||||
|
/** Should a player holding this item aim it like a gun/bow? */
|
||||||
|
public boolean shouldPlayerModelAim(ItemStack stack);
|
||||||
|
|
||||||
// Runtime erasure means we have to explicitly give the class a second time :(
|
// Runtime erasure means we have to explicitly give the class a second time :(
|
||||||
public Class<T> getEnum();
|
public Class<T> getEnum();
|
||||||
|
|
||||||
|
|||||||
@ -127,4 +127,9 @@ public class ItemBoltgun extends Item implements IAnimatedItem<ToolAnimation> {
|
|||||||
.addPos(0, 0, 1, 100));
|
.addPos(0, 0, 1, 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldPlayerModelAim(ItemStack stack) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,4 +75,10 @@ public class ItemChainsaw extends ItemToolAbilityFueled implements IHeldSoundPro
|
|||||||
public Class<ToolAnimation> getEnum() {
|
public Class<ToolAnimation> getEnum() {
|
||||||
return ToolAnimation.class;
|
return ToolAnimation.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldPlayerModelAim(ItemStack stack) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -153,11 +153,9 @@ public class ItemCrucible extends ItemSwordAbility implements IEquipReceiver, IA
|
|||||||
|
|
||||||
if(HbmAnimations.getRelevantTransformation("SWING_ROT")[0] == 0) {
|
if(HbmAnimations.getRelevantTransformation("SWING_ROT")[0] == 0) {
|
||||||
|
|
||||||
Random rand = Minecraft.getMinecraft().theWorld.rand;
|
int offset = itemRand.nextInt(80) - 20;
|
||||||
|
|
||||||
int offset = rand.nextInt(80) - 20;
|
playSwing(0.8F + itemRand.nextFloat() * 0.2F);
|
||||||
|
|
||||||
playSwing(0.8F + rand.nextFloat() * 0.2F);
|
|
||||||
|
|
||||||
return new BusAnimation()
|
return new BusAnimation()
|
||||||
.addBus("SWING_ROT", new BusAnimationSequence()
|
.addBus("SWING_ROT", new BusAnimationSequence()
|
||||||
@ -186,4 +184,9 @@ public class ItemCrucible extends ItemSwordAbility implements IEquipReceiver, IA
|
|||||||
return ToolAnimation.class;
|
return ToolAnimation.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldPlayerModelAim(ItemStack stack) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.hbm.blocks.ICustomBlockHighlight;
|
|||||||
import com.hbm.config.ClientConfig;
|
import com.hbm.config.ClientConfig;
|
||||||
import com.hbm.config.RadiationConfig;
|
import com.hbm.config.RadiationConfig;
|
||||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||||
|
import com.hbm.items.IAnimatedItem;
|
||||||
import com.hbm.items.armor.IArmorDisableModel;
|
import com.hbm.items.armor.IArmorDisableModel;
|
||||||
import com.hbm.items.armor.IArmorDisableModel.EnumPlayerPart;
|
import com.hbm.items.armor.IArmorDisableModel.EnumPlayerPart;
|
||||||
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
|
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
|
||||||
@ -55,7 +56,7 @@ public class ModEventHandlerRenderer {
|
|||||||
|
|
||||||
private static ModelMan manlyModel;
|
private static ModelMan manlyModel;
|
||||||
private static boolean[] partsHidden = new boolean[7];
|
private static boolean[] partsHidden = new boolean[7];
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onRenderTickPre(TickEvent.RenderTickEvent event) { }
|
public void onRenderTickPre(TickEvent.RenderTickEvent event) { }
|
||||||
|
|
||||||
@ -187,7 +188,17 @@ public class ModEventHandlerRenderer {
|
|||||||
RenderPlayer renderer = event.renderer;
|
RenderPlayer renderer = event.renderer;
|
||||||
ItemStack held = player.getHeldItem();
|
ItemStack held = player.getHeldItem();
|
||||||
|
|
||||||
if(held != null && player.getHeldItem().getItem() instanceof ItemGunBaseNT) {
|
if(held == null) return;
|
||||||
|
|
||||||
|
if(held.getItem() instanceof IAnimatedItem) {
|
||||||
|
if(((IAnimatedItem<?>) held.getItem()).shouldPlayerModelAim(held)) {
|
||||||
|
renderer.modelBipedMain.aimedBow = true;
|
||||||
|
renderer.modelArmor.aimedBow = true;
|
||||||
|
renderer.modelArmorChestplate.aimedBow = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(held.getItem() instanceof ItemGunBaseNT) {
|
||||||
renderer.modelBipedMain.aimedBow = true;
|
renderer.modelBipedMain.aimedBow = true;
|
||||||
renderer.modelArmor.aimedBow = true;
|
renderer.modelArmor.aimedBow = true;
|
||||||
renderer.modelArmorChestplate.aimedBow = true;
|
renderer.modelArmorChestplate.aimedBow = true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user