Skip to content

Commit

Permalink
add Creative RF Source and EU Source
Browse files Browse the repository at this point in the history
  • Loading branch information
huige233 committed Sep 11, 2022
1 parent 944db51 commit bb0e56a
Show file tree
Hide file tree
Showing 23 changed files with 775 additions and 126 deletions.
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: 'org.spongepowered.mixin'

group = 'huige233'
version = '1.1.3'
archivesBaseName = 'transcend'
version = '1.1.4'

minecraft {
version = project.forgeVersion
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/huige233/transcend/blocks/voidblock.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import java.util.Random;

Expand Down Expand Up @@ -69,4 +73,14 @@ public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAcces
public boolean canEntityDestroy(IBlockState state, IBlockAccess world, BlockPos pos, Entity entity) {
return false;
}

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onBlockBreak(BlockEvent.BreakEvent event){
event.setCanceled(true);
}

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onBlockPush(PlayerInteractEvent.LeftClickBlock event){
event.setCanceled(true);
}
}
3 changes: 1 addition & 2 deletions src/main/java/huige233/transcend/compat/Avartiabreak.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package huige233.transcend.compat;

import morph.avaritia.init.ModItems;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraftforge.fml.common.Mod;
import morph.avaritia.init.ModItems;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@Mod.EventBusSubscriber
public class Avartiabreak {
Expand Down
92 changes: 0 additions & 92 deletions src/main/java/huige233/transcend/compat/botaniasword.java

This file was deleted.

10 changes: 5 additions & 5 deletions src/main/java/huige233/transcend/compat/tinkers/TiCConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class TiCConfig {
public static final AbstractTrait transcendtratt = new TraitTranscend();
public static final List<Material> materials = Lists.newArrayList();
public static Material flawless = mat("flawless", 0x777777);
public static final Material transcend = mat("transcend",0x9e9e9e9);
public static final Material transcend = mat("transcend",0xF8F8FF);
private static Material mat(String name, int color) {
if (TinkerRegistry.getMaterial(name) == TinkerRegistry.getMaterial("unknown")){
Material mat = new Material(name, color);
Expand All @@ -47,8 +47,8 @@ public static void setup() {
flawless.setRepresentativeItem(ModItems.FLAWLESS);
flawless.setCastable(true);
flawless.setCraftable(true);
flawless.addTrait(flawlesstrait, HEAD);
flawless.addTrait(TinkerTraits.tasty,HEAD);
flawless.addTrait(flawlesstrait);
flawless.addTrait(TinkerTraits.tasty);
TinkerRegistry.addMaterialStats(flawless,
new HeadMaterialStats(9999, 100.0f, 2000.0f, 32),
new HandleMaterialStats(10.0f, 9999),
Expand All @@ -61,7 +61,7 @@ public static void setup() {
transcend.setRepresentativeItem(ModItems.TRANSCEND);
transcend.setCastable(true);
transcend.setCraftable(true);
transcend.addTrait(transcendtratt, HEAD);
transcend.addTrait(transcendtratt);
TinkerRegistry.addMaterialStats(transcend,
new HeadMaterialStats(9999, 100.0f, 9999.0f, 99),
new HandleMaterialStats(100.0f, 9999),
Expand Down Expand Up @@ -110,7 +110,7 @@ public void postInit(FMLPostInitializationEvent event) {
static void registerMaterialRendering()
{
flawless.setRenderInfo(new MaterialRenderInfo.Metal(0x777777, 0.5f, 0.5f, 0.2f));
transcend.setRenderInfo(new MaterialRenderInfo.Metal(0x9e9e9e, 0.5f, 0.5f, 0.2f));
transcend.setRenderInfo(new MaterialRenderInfo.Metal(0xF8F8FF, 0.5f, 0.5f, 0.2f));
}
}

Original file line number Diff line number Diff line change
@@ -1,23 +1,67 @@
package huige233.transcend.compat.tinkers;

import c4.conarm.common.armor.utils.ArmorTagUtil;
import c4.conarm.lib.armor.ArmorNBT;
import c4.conarm.lib.traits.AbstractArmorTrait;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingDamageEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import slimeknights.tconstruct.library.utils.TagUtil;

import java.util.List;

public class TraitArmorFlawless extends AbstractArmorTrait {
public static final TraitArmorFlawless a = new TraitArmorFlawless();
public TraitArmorFlawless() {
super("flawless",TextFormatting.DARK_GRAY);
super("flawless",0x777777);
MinecraftForge.EVENT_BUS.register(this);
}

public float onHurt(ItemStack armor,EntityPlayer player, DamageSource source, float damage, float newDamage, LivingHurtEvent evt){
return 0.0f;
return damage-1000;
}

public float onDamaged(ItemStack armor, EntityPlayer player, DamageSource source, float damage, float newDamage, LivingDamageEvent evt) {
return 0.0f;
if (player.getHealth() - newDamage <= 0.0F && random.nextFloat() <= 0.1F) {
player.heal(2.0F);
evt.setCanceled(true);
}
return damage-1000;
}

@Override
public void onArmorTick(ItemStack armor, World world, EntityPlayer player){
player.setAir(300);
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 300, 0, false, false));
player.capabilities.allowFlying = true;
player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 300, 14, false, false));
player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 300, 14, false, false));
player.addPotionEffect(new PotionEffect(MobEffects.SPEED, 300, 2, false, false));
player.addPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, 300, 2, false, false));
player.stepHeight=0.6f;
player.addPotionEffect(new PotionEffect(MobEffects.LUCK, 300, 9, false, false));
if(player.isBurning()) {
player.extinguish();
}
}

@Override
public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) {
super.applyEffect(rootCompound, modifierTag);
ArmorNBT data = ArmorTagUtil.getArmorStats(rootCompound);
ArmorNBT orginal = ArmorTagUtil.getOriginalArmorStats(rootCompound);
data.modifiers += orginal.modifiers + 10;
TagUtil.setToolTag(rootCompound,data.get());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package huige233.transcend.compat.tinkers;

import c4.conarm.common.armor.traits.TraitVoltaic;
import c4.conarm.common.armor.utils.ArmorTagUtil;
import c4.conarm.lib.armor.ArmorNBT;
import c4.conarm.lib.traits.AbstractArmorTrait;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import slimeknights.tconstruct.library.modifiers.ModifierNBT;
import slimeknights.tconstruct.library.utils.ModifierTagHolder;
import slimeknights.tconstruct.library.utils.TagUtil;

import java.util.List;

public class TraitArmorTranscend extends AbstractArmorTrait {
public static final TraitArmorTranscend a = new TraitArmorTranscend();
public TraitArmorTranscend() {
super("transcend",0xF8F8FF);
MinecraftForge.EVENT_BUS.register(this);
}

@Override
public float onHurt(ItemStack armor, EntityPlayer player, DamageSource source, float damage, float newDamage, LivingHurtEvent evt){
evt.setCanceled(true);
return 0;
}

@Override
public int onArmorDamage(ItemStack armor, DamageSource source, int damage, int newDamage, EntityPlayer player, int slot) {
return 0;
}

@Override
public void onArmorTick(ItemStack armor, World world, EntityPlayer player){
player.setAir(300);
player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 300, 14, false, false));
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 300, 0, false, false));
player.capabilities.allowFlying = true;
player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 300, 14, false, false));
player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 300, 14, false, false));
List<PotionEffect> effects = Lists.newArrayList(player.getActivePotionEffects());
for(PotionEffect potion : Collections2.filter(effects, potion -> potion.getPotion().isBadEffect())) {
player.removePotionEffect(potion.getPotion());
}
player.getFoodStats().addStats(20, 20.0f);
player.addPotionEffect(new PotionEffect(MobEffects.SPEED, 300, 2, false, false));
player.addPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, 300, 2, false, false));
player.stepHeight=3;
player.setFire(0);
player.addPotionEffect(new PotionEffect(MobEffects.LUCK, 300, 9, false, false));
player.addPotionEffect(new PotionEffect(MobEffects.HASTE, 300, 44, false, false));
if(player.isBurning()) {
player.extinguish();
}
}

@Override
public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) {
super.applyEffect(rootCompound, modifierTag);
ArmorNBT data = ArmorTagUtil.getArmorStats(rootCompound);
ArmorNBT orginal = ArmorTagUtil.getOriginalArmorStats(rootCompound);
data.modifiers += orginal.modifiers + 100;
TagUtil.setToolTag(rootCompound,data.get());
rootCompound.setBoolean("Unbreakable", true);
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
package huige233.transcend.compat.tinkers;

import huige233.transcend.compat.ThaumcraftSword;
import huige233.transcend.lib.TranscendDamageSources;
import huige233.transcend.util.ArmorUtils;
import huige233.transcend.util.ItemNBTHelper;
import huige233.transcend.util.SwordUtil;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.SPacketCustomSound;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.common.Loader;
import slimeknights.tconstruct.library.tools.ToolNBT;
import slimeknights.tconstruct.library.traits.AbstractTrait;
import slimeknights.tconstruct.library.utils.TagUtil;

Expand All @@ -16,14 +29,44 @@ public TraitTranscend() {
@Override
public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) {
NBTTagCompound toolTag = TagUtil.getToolTag(rootCompound);
toolTag.setInteger("FreeModifiers", 100);
ToolNBT state = TagUtil.getToolStats(rootCompound);
state.durability = 999999;
state.attack = 999999.0f;
state.speed = 999999.0f;
int modifiers = toolTag.getInteger("FreeModifiers");
toolTag.setInteger("FreeModifiers", 100 + modifiers);
rootCompound.setBoolean("Unbreakable", true);
TagUtil.setToolTag(rootCompound, toolTag);
}

public void onHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damageDealt, boolean wasCritical, boolean wasHit) {
if(player instanceof EntityPlayer) {
public int onToolDamage(ItemStack tool,int damage,int newdamage,EntityLivingBase entity){
return 0;
}

@Override
public void onHit(ItemStack tool, EntityLivingBase player, EntityLivingBase entity, float damage, boolean isCritical) {
if(!entity.world.isRemote){
if(entity instanceof EntityPlayer){
if (ArmorUtils.fullEquipped((EntityPlayer) entity)) {
player.sendMessage(new TextComponentTranslation("sword_to_armor"));
}
EntityPlayer p = (EntityPlayer) entity;
p.attackEntityFrom((new TranscendDamageSources(player)).setDamageAllowedInCreativeMode().setDamageBypassesArmor().setDamageIsAbsolute(), Float.MAX_VALUE);
p.getCombatTracker().trackDamage(new EntityDamageSource("transcend", player), Float.MAX_VALUE, Float.MAX_VALUE);
p.clearActivePotions();
p.inventory.dropAllItems();
p.setHealth(0.0f);
} else {
entity.clearActivePotions();
entity.attackEntityFrom((new TranscendDamageSources(player)).setDamageAllowedInCreativeMode().setDamageBypassesArmor().setDamageIsAbsolute(), Float.MAX_VALUE);
entity.getCombatTracker().trackDamage(new EntityDamageSource("transcend", player), Float.MAX_VALUE, Float.MAX_VALUE);
entity.setHealth(0.0f);
//entity.onDeath(new EntityDamageSource("transcend",player));
}
entity.onKillCommand();
if (Loader.isModLoaded("thaumcraft")) {
ThaumcraftSword.damageEntity(entity);
}
}
}
}
Loading

0 comments on commit bb0e56a

Please sign in to comment.