Skip to content

Commit

Permalink
asm
Browse files Browse the repository at this point in the history
  • Loading branch information
huige233 committed Feb 24, 2023
1 parent 71cdfdc commit 9c997cf
Show file tree
Hide file tree
Showing 35 changed files with 11,551 additions and 150 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: 'org.spongepowered.mixin'

group = 'huige233'
version = '1.1.4-fix7.2'
version = '1.1.4-test111'

minecraft {
version = project.forgeVersion
Expand Down
263 changes: 261 additions & 2 deletions src/main/java/huige233/transcend/asm/ClassTransformer.java

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/main/java/huige233/transcend/compat/slash/SlashInit.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import huige233.transcend.Main;
import huige233.transcend.compat.slash.specialattack.Delete;
import huige233.transcend.compat.slash.specialeffects.SEDataLock;
import huige233.transcend.compat.slash.specialeffects.SETranscend;
import mods.flammpfeil.slashblade.SlashBlade;
import mods.flammpfeil.slashblade.item.ItemSlashBlade;
Expand All @@ -15,5 +16,7 @@ public static void init(){
ItemSlashBlade.specialAttacks.put(Integer.valueOf(678), new Delete());
MinecraftForge.EVENT_BUS.register(new SlashUpdateEvent());
SpecialEffects.register((ISpecialEffect) new SETranscend());
SpecialEffects.register((ISpecialEffect) new SEDataLock());
SlashBlade.InitEventBus.register(Main.proxy);
}
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
package huige233.transcend.compat.slash.named;

import huige233.transcend.util.BladeUtils;
import huige233.transcend.util.TextUtils;
import huige233.transcend.util.ItemBladeUtils;
import mods.flammpfeil.slashblade.ItemSlashBladeNamed;
import mods.flammpfeil.slashblade.TagPropertyAccessor;
import mods.flammpfeil.slashblade.specialattack.IJustSpecialAttack;
import mods.flammpfeil.slashblade.specialattack.SpecialAttackBase;
import net.minecraft.client.resources.I18n;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.NonNullList;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.EnumSet;
import java.util.List;

import static huige233.transcend.util.BladeUtils.TrNamedBlades;

public class ItemTrSlashBlade extends ItemSlashBladeNamed {
public ItemTrSlashBlade(ToolMaterial material, float baseAttackModifiers) {
super(material, baseAttackModifiers);
ItemBladeUtils.Tr_BLADE.add(this);
}

public static TagPropertyAccessor.TagPropertyBoolean isInCreativeTab = new TagPropertyAccessor.TagPropertyBoolean("IsInCreativeTab");
public static TagPropertyAccessor.TagPropertyBoolean isTrBlade = new TagPropertyAccessor.TagPropertyBoolean("isTrBlade");

/*
@Override
@SideOnly(Side.CLIENT)
public void addInformationSwordClass(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
Expand All @@ -50,7 +42,7 @@ public void addInformationSwordClass(ItemStack stack, EntityPlayer player, List
tooltip.add(String.format("§8%s", I18n.format("flammpfeil.swaepon.info.noname")));
}
}
/*
@Override
@SideOnly(Side.CLIENT)
public void addInformationSpecialAttack(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
Expand All @@ -66,8 +58,6 @@ public void addInformationSpecialAttack(ItemStack par1ItemStack, EntityPlayer pa
}
}
*/

@Override
@SideOnly(Side.CLIENT)
public void addInformationMaxAttack(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
Expand Down Expand Up @@ -99,40 +89,20 @@ public void addInformationMaxAttack(ItemStack par1ItemStack, EntityPlayer par2En
par3List.add(String.format(template,ba , sss , (baseModif + maxBonus)));
}
public void doChargeAttack(ItemStack stack, EntityPlayer par3EntityPlayer,boolean isJust){
NBTTagCompound tag = getItemTagCompound(stack);
if (isInCreativeTab.get(tag)) {
return;
}
SpecialAttackBase sa = getSpecialAttack(stack);
if(isJust && sa instanceof IJustSpecialAttack){
((IJustSpecialAttack)sa).doJustSpacialAttack(stack,par3EntityPlayer);
}else {
sa.doSpacialAttack(stack, par3EntityPlayer);
}
IsCharged.set(tag, true);
}
/*
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
if (this.isInCreativeTab(tab)) {
for(String bladename : TrNamedBlades){
ItemStack blade = BladeUtils.getCustomBlade(bladename);
NBTTagCompound tag = getItemTagCompound(blade);
BaseAttackModifier.set(tag,0.0F);
isInCreativeTab.set(tag,true);
if(blade.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
blade.setItemDamage(0);
}
if(!blade.isEmpty()) {
subItems.add(blade);
}
public void doChargeAttack(ItemStack stack, EntityPlayer par3EntityPlayer,boolean isJust){
NBTTagCompound tag = getItemTagCompound(stack);
if (isInCreativeTab.get(tag)) {
return;
}
SpecialAttackBase sa = getSpecialAttack(stack);
if(isJust && sa instanceof IJustSpecialAttack){
((IJustSpecialAttack)sa).doJustSpacialAttack(stack,par3EntityPlayer);
}else {
sa.doSpacialAttack(stack, par3EntityPlayer);
}
IsCharged.set(tag, true);
}
}
*/
*/
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
if (isInCreativeTab(tab))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
package huige233.transcend.compat.slash.named;

import huige233.transcend.compat.slash.SlashUpdateEvent;
import huige233.transcend.compat.slash.specialattack.Delete;
import huige233.transcend.compat.slash.BladeLoader;
import huige233.transcend.compat.slash.SlashUpdateEvent;
import huige233.transcend.util.ItemBladeUtils;
import huige233.transcend.util.ItemNBTHelper;
import huige233.transcend.util.TextUtils;
import mods.flammpfeil.slashblade.ItemSlashBladeNamed;
import mods.flammpfeil.slashblade.ability.JustGuard;
import mods.flammpfeil.slashblade.ability.StylishRankManager;
import mods.flammpfeil.slashblade.item.ItemSlashBlade;
import mods.flammpfeil.slashblade.specialeffect.SpecialEffects;
import mods.flammpfeil.slashblade.util.SilentUpdateItem;
import net.minecraft.client.resources.I18n;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Enchantments;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.UUID;
import java.util.*;

public class TranscendSlashBlade extends ItemTrSlashBlade {
private boolean firstload;
Expand All @@ -34,21 +47,52 @@ public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean
super.onUpdate(stack, world, entity, i, b);
if(!this.isUsing) SlashUpdateEvent.setTimestop(Boolean.valueOf(false));
if(entity instanceof EntityPlayer) this.isUsing = false;
ItemSlashBlade.specialAttacks.put(Integer.valueOf(678),new Delete());
NBTTagCompound tag = stack.getTagCompound();
tag.setInteger("HideFlags",6);
ItemSlashBladeNamed.NamedBlades.add("flammpfeil.slashblade.named.tran");
ItemSlashBladeNamed.CurrentItemName.set(tag, "flammpfeil.slashblade.named.tran");
ItemSlashBladeNamed.CustomMaxDamage.set(tag, Integer.valueOf(32767));
ItemSlashBladeNamed.IsDefaultBewitched.set(tag, Boolean.valueOf(true));
ItemSlashBlade.SummonedSwordColor.set(tag, 0x4091FF);
ItemSlashBlade.setBaseAttackModifier(tag, 32767.0F);
ItemSlashBlade.SpecialAttackType.set(tag, Integer.valueOf(678));
ItemSlashBlade.TextureName.set(tag, "named/transcend/texture");
ItemSlashBlade.ModelName.set(tag, "named/transcend/model");
ItemSlashBlade.RepairCount.set(tag, Integer.valueOf(100000));
ItemSlashBlade.KillCount.set(tag, Integer.valueOf(1000000));
ItemSlashBlade.ProudSoul.set(tag, Integer.valueOf(1000000));
if(entity instanceof EntityPlayer && ((EntityPlayer)entity).experienceLevel >= 1000){
EntityPlayer player = (EntityPlayer)entity;
ItemSlashBladeNamed.NamedBlades.add("flammpfeil.slashblade.named.tran");
ItemSlashBladeNamed.CurrentItemName.set(tag, "flammpfeil.slashblade.named.tran");
ItemSlashBlade.TextureName.set(tag, "named/transcend/texture");
ItemSlashBlade.ModelName.set(tag, "named/transcend/model");
ItemSlashBlade.setBaseAttackModifier(tag, 32767.0F);
ItemSlashBlade.SpecialAttackType.set(tag, Integer.valueOf(678));
ItemSlashBladeNamed.IsDefaultBewitched.set(tag, Boolean.valueOf(true));
ItemSlashBladeNamed.CustomMaxDamage.set(tag, Integer.valueOf(32767));
ItemSlashBlade.RepairCount.set(tag, Integer.valueOf(100000));
ItemSlashBlade.KillCount.set(tag, Integer.valueOf(1000000));
ItemSlashBlade.ProudSoul.set(tag, Integer.valueOf(1000000));
if(((EntityPlayer) entity).getHeldItemMainhand().getItem() == this){
int rankPoint = StylishRankManager.getTotalRankPoint(player);
int aRankPoint = (int) (StylishRankManager.RankRange * 7D);
int rankAmount = aRankPoint - rankPoint;
StylishRankManager.addRankPoint(player,rankAmount);
}
ItemNBTHelper.setInt(stack,"empty",300);
} else {
EntityPlayer player = (EntityPlayer)entity;
ItemSlashBladeNamed.NamedBlades.add("flammpfeil.slashblade.named.tran");
ItemSlashBladeNamed.CurrentItemName.set(tag, "flammpfeil.slashblade.named.tran1");
ItemSlashBlade.TextureName.set(tag, "named/transcend/scabbard");
ItemSlashBlade.ModelName.set(tag, "named/transcend/blade");
ItemSlashBlade.setBaseAttackModifier(tag, 0.0F);
ItemSlashBlade.SpecialAttackType.set(tag, Integer.valueOf(2));
ItemSlashBladeNamed.IsDefaultBewitched.set(tag, Boolean.valueOf(false));
ItemSlashBladeNamed.CustomMaxDamage.set(tag, Integer.valueOf(0));
ItemSlashBlade.RepairCount.set(tag, Integer.valueOf(1));
ItemSlashBlade.KillCount.set(tag, Integer.valueOf(1000));
ItemSlashBlade.ProudSoul.set(tag, Integer.valueOf(1000));
player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, -1, 3, false, false));
player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, -1, 3, false, false));
if(ItemNBTHelper.getInt(stack,"empty",0) < 300){
ItemNBTHelper.setInt(stack,"empty",ItemNBTHelper.getInt(stack,"empty",0)+1);
}else if(ItemNBTHelper.getInt(stack,"empty",300) > 300){
ItemNBTHelper.setInt(stack,"empty",300);
}
}

SpecialEffects.addEffect(stack, "SEDataLock",0);
SpecialEffects.addEffect(stack, "SETranscend",1000);
if(!this.firstload){
this.firstload = true;
Expand All @@ -60,6 +104,104 @@ public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean
tag.setBoolean("Unbreakable", true);
}

@Override
@SideOnly(Side.CLIENT)
public void addInformationSwordClass(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
EnumSet<SwordType> swordType = getSwordType(stack);
NBTTagCompound tag = getItemTagCompound(stack);

if(swordType.contains(SwordType.Enchanted)){
//if(swordType.contains(SwordType.Bewitched)){
if (isTrBlade.get(tag)) {
if (player.experienceLevel < 1000) {
tooltip.add(TextUtils.makeSANICS(I18n.format("flammpfeil.info.no.transcend")));
} else {
tooltip.add(TextUtils.makeFabulous(I18n.format("flammpfeil.info.transcend")));
}
}
}
//}
}

@SideOnly(Side.CLIENT)
public void addInformationRepairCount(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
NBTTagCompound tag = getItemTagCompound(par1ItemStack);
int repair = RepairCount.get(tag);
if (0 < repair && repair <= 100000) {
par3List.add(String.format("Refine : %d", repair));
}else {
par3List.add(String.format("§eRefine : %d", repair));
}
}

@SideOnly(Side.CLIENT)
public void addInformationSpecialEffec(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
NBTTagCompound etag = getSpecialEffect(par1ItemStack);
Set<String> tagKeys = etag.getKeySet();
if (tagKeys.size() != 0) {
int playerLevel = par2EntityPlayer.experienceLevel;
par3List.add("");
Iterator var8 = tagKeys.iterator();

while(var8.hasNext()) {
String key = (String)var8.next();
int reqiredLevel = etag.getInteger(key);
par3List.add(TextUtils.makeFabulousL(I18n.format("slashblade.seffect.name." + key, new Object[0])) + "§r " + (reqiredLevel <= playerLevel ? "§e" : "§8") + reqiredLevel);
}

}
}

@Override
public ActionResult<ItemStack> func_77659_a(World worldIn, EntityPlayer playerIn, EnumHand hand) {
ItemStack itemStackIn = playerIn.getHeldItem(hand);
if (hand == EnumHand.OFF_HAND) {
return new ActionResult(EnumActionResult.FAIL, itemStackIn);
} else {
if(playerIn.experienceLevel < 1000) return new ActionResult(EnumActionResult.FAIL, itemStackIn);
JustGuard.setJustGuardState(playerIn);
NBTTagCompound tag = getItemTagCompound(itemStackIn);
long prevAttackTime = LastActionTime.get(tag);
long currentTime = playerIn.world.getTotalWorldTime();
ComboSequence comboSeq = getComboSequence(tag);
this.nextAttackSequence(itemStackIn, comboSeq, playerIn);
SilentUpdateItem.silentUpdateItem(playerIn, hand);
playerIn.setActiveHand(hand);
return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
}

@Override
@SideOnly(Side.CLIENT)
public void addInformationMaxAttack(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
NBTTagCompound tag = getItemTagCompound(par1ItemStack);
float repair = RepairCount.get(tag);
EnumSet<SwordType> swordType = getSwordType(par1ItemStack);
par3List.add("");
par3List.add("§4RankAttackDamage");
String header;
String template;
if(swordType.contains(SwordType.FiercerEdge)){
header = "§6B-A§r/§4S-SSS§r/§5Limit";
}else{
header = "§6B-SS§r/§4SSS§r/§5Limit";
}
if (isInCreativeTab.get(tag)){
template = "§6???§r/§4????§r/§5?????";
}else{
template = "§6+%.1f§r/§4+%.1f§r/§5+%.1f";
}
float baseModif = getBaseAttackModifiers(tag);

float maxBonus = RefineBase + repair;
float level = par2EntityPlayer.experienceLevel;
float ba = baseModif;
float sss = (baseModif + Math.min(maxBonus,level));

par3List.add(header);
par3List.add(String.format(template,ba , sss , (baseModif + maxBonus)));
}

public boolean onDroppedByPlayer(ItemStack stack, EntityPlayer player) {
if (stack.getItem() == BladeLoader.tran) {
NBTTagCompound tag = getItemTagCompound(stack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public void init(LoadEvent.InitEvent event){
ItemSlashBlade.ProudSoul.set(tag, Integer.valueOf(1000000));
ItemSlashBlade.SummonedSwordColor.set(tag, 0x4091FF);
SpecialEffects.addEffect(customblade, "SETranscend",1000);
SpecialEffects.addEffect(customblade, "SEDataLock",0);
customblade.addEnchantment(Enchantments.INFINITY, 127);
customblade.addEnchantment(Enchantments.POWER, 127);
customblade.addEnchantment(Enchantments.PUNCH, 127);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public static void removeEntity(Entity entity, Entity player,Boolean b){

public void doSpacialAttack(ItemStack stack, EntityPlayer player){
World world = player.world;
if(world.isRemote) return;
if((Minecraft.getMinecraft()).entityRenderer.getShaderGroup() != null) (Minecraft.getMinecraft()).entityRenderer.stopUseShader();
NBTTagCompound tag = ItemSlashBlade.getItemTagCompound(stack);
Entity target = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package huige233.transcend.compat.slash.specialeffects;

import mods.flammpfeil.slashblade.item.ItemSlashBlade;
import mods.flammpfeil.slashblade.specialeffect.IRemovable;
import mods.flammpfeil.slashblade.specialeffect.ISpecialEffect;
import mods.flammpfeil.slashblade.util.SlashBladeHooks;
import net.minecraft.item.ItemStack;

public class SEDataLock implements ISpecialEffect, IRemovable {
private static final String EffectKey = "SEDataLock";

public int getDefaultRequiredLevel(){
return 0;
}

public boolean canCopy(ItemStack stack){
return false;
}

public boolean canRemoval(ItemStack stack){
return false;
}

public String getEffectKey(){
return EffectKey;
}

public void register(){
SlashBladeHooks.EventBus.register(this);
}

private boolean useBlade(ItemSlashBlade.ComboSequence sequence){
if(sequence.useScabbard) return false;
if(sequence == ItemSlashBlade.ComboSequence.None) return false;
if(sequence == ItemSlashBlade.ComboSequence.Noutou) return false;
return true;
}
}
Loading

0 comments on commit 9c997cf

Please sign in to comment.