forked from AlmuraDev/mocreaturesdev
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2e0e25
commit 83092d2
Showing
11 changed files
with
305 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
src/main/java/drzhark/mocreatures/compat/tinkers/TinkersConstructIntegration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package drzhark.mocreatures.compat.tinkers; | ||
|
||
import drzhark.mocreatures.compat.tinkers.traits.TraitStingEffect; | ||
import drzhark.mocreatures.compat.tinkers.traits.TraitStingEffectPlayer; | ||
import drzhark.mocreatures.compat.tinkers.traits.TraitStingFire; | ||
import drzhark.mocreatures.init.MoCItems; | ||
import net.minecraft.init.MobEffects; | ||
import slimeknights.tconstruct.library.TinkerRegistry; | ||
import slimeknights.tconstruct.library.materials.BowMaterialStats; | ||
import slimeknights.tconstruct.library.materials.ExtraMaterialStats; | ||
import slimeknights.tconstruct.library.materials.HandleMaterialStats; | ||
import slimeknights.tconstruct.library.materials.HeadMaterialStats; | ||
import slimeknights.tconstruct.library.materials.Material; | ||
import slimeknights.tconstruct.library.materials.MaterialTypes; | ||
import slimeknights.tconstruct.library.traits.AbstractTrait; | ||
import slimeknights.tconstruct.library.utils.HarvestLevels; | ||
import slimeknights.tconstruct.tools.TinkerTraits; | ||
|
||
public class TinkersConstructIntegration { | ||
public static final Material DARK_CHITIN = new Material("dark_chitin", 0x535A6B); | ||
public static final Material EARTH_CHITIN = new Material("earth_chitin", 0xF37A07); | ||
public static final Material FIRE_CHITIN = new Material("fire_chitin", 0xC62B13); | ||
public static final Material FROST_CHITIN = new Material("frost_chitin", 0x1B7A87); | ||
public static final Material UNDEAD_CHITIN = new Material("undead_chitin", 0x92B859); | ||
|
||
public static final AbstractTrait DARK_STING = new TraitStingEffectPlayer("dark_sting", 0x535A6B, 1.5F, MobEffects.WEAKNESS, MobEffects.NAUSEA); | ||
public static final AbstractTrait EARTH_STING = new TraitStingEffect("earth_sting", 0xF37A07, 1.5F, MobEffects.POISON); | ||
public static final AbstractTrait FIRE_STING = new TraitStingFire(1.5F); | ||
public static final AbstractTrait FROST_STING = new TraitStingEffect("frost_sting", 0x1B7A87, 1.5F, MobEffects.SLOWNESS); | ||
public static final AbstractTrait UNDEAD_STING = new TraitStingEffectPlayer("undead_sting", 0x92B859, 1.5F, MobEffects.WITHER, MobEffects.BLINDNESS); | ||
|
||
public static void preInit() { | ||
TinkerRegistry.addMaterialStats(DARK_CHITIN, | ||
new HeadMaterialStats(300, 6.0F, 3.5F, HarvestLevels.DIAMOND), | ||
new HandleMaterialStats(0.95F, 60), | ||
new ExtraMaterialStats(60), | ||
new BowMaterialStats(0.9F, 0.7F, 0.0F)); | ||
DARK_CHITIN.addTrait(DARK_STING, MaterialTypes.HEAD); | ||
DARK_CHITIN.addTrait(TinkerTraits.fractured); | ||
TinkerRegistry.integrate(DARK_CHITIN).preInit(); | ||
|
||
TinkerRegistry.addMaterialStats(EARTH_CHITIN, | ||
new HeadMaterialStats(300, 6.0F, 3.5F, HarvestLevels.DIAMOND), | ||
new HandleMaterialStats(0.95F, 60), | ||
new ExtraMaterialStats(60), | ||
new BowMaterialStats(0.9F, 0.7F, 0.0F)); | ||
EARTH_CHITIN.addTrait(EARTH_STING, MaterialTypes.HEAD); | ||
EARTH_CHITIN.addTrait(TinkerTraits.fractured); | ||
TinkerRegistry.integrate(EARTH_CHITIN).preInit(); | ||
|
||
TinkerRegistry.addMaterialStats(FIRE_CHITIN, | ||
new HeadMaterialStats(300, 6.0F, 3.5F, HarvestLevels.DIAMOND), | ||
new HandleMaterialStats(0.95F, 60), | ||
new ExtraMaterialStats(60), | ||
new BowMaterialStats(0.9F, 0.7F, 0.0F)); | ||
FIRE_CHITIN.addTrait(FIRE_STING, MaterialTypes.HEAD); | ||
FIRE_CHITIN.addTrait(TinkerTraits.fractured); | ||
TinkerRegistry.integrate(FIRE_CHITIN).preInit(); | ||
|
||
TinkerRegistry.addMaterialStats(FROST_CHITIN, | ||
new HeadMaterialStats(300, 6.0F, 3.5F, HarvestLevels.DIAMOND), | ||
new HandleMaterialStats(0.95F, 60), | ||
new ExtraMaterialStats(60), | ||
new BowMaterialStats(0.9F, 0.7F, 0.0F)); | ||
FROST_CHITIN.addTrait(FROST_STING, MaterialTypes.HEAD); | ||
FROST_CHITIN.addTrait(TinkerTraits.fractured); | ||
TinkerRegistry.integrate(FROST_CHITIN).preInit(); | ||
|
||
TinkerRegistry.addMaterialStats(UNDEAD_CHITIN, | ||
new HeadMaterialStats(300, 6.0F, 3.5F, HarvestLevels.DIAMOND), | ||
new HandleMaterialStats(0.95F, 60), | ||
new ExtraMaterialStats(60), | ||
new BowMaterialStats(0.9F, 0.7F, 0.0F)); | ||
UNDEAD_CHITIN.addTrait(UNDEAD_STING, MaterialTypes.HEAD); | ||
UNDEAD_CHITIN.addTrait(TinkerTraits.fractured); | ||
TinkerRegistry.integrate(UNDEAD_CHITIN).preInit(); | ||
} | ||
|
||
public static void init() { | ||
DARK_CHITIN.addItem(MoCItems.chitinCave, 1, Material.VALUE_Ingot); | ||
DARK_CHITIN.setRepresentativeItem(MoCItems.chitinCave); | ||
DARK_CHITIN.setCraftable(true).setCastable(false); | ||
|
||
EARTH_CHITIN.addItem(MoCItems.chitin, 1, Material.VALUE_Ingot); | ||
EARTH_CHITIN.setRepresentativeItem(MoCItems.chitin); | ||
EARTH_CHITIN.setCraftable(true).setCastable(false); | ||
|
||
FIRE_CHITIN.addItem(MoCItems.chitinNether, 1, Material.VALUE_Ingot); | ||
FIRE_CHITIN.setRepresentativeItem(MoCItems.chitinNether); | ||
FIRE_CHITIN.setCraftable(true).setCastable(false); | ||
|
||
FROST_CHITIN.addItem(MoCItems.chitinFrost, 1, Material.VALUE_Ingot); | ||
FROST_CHITIN.setRepresentativeItem(MoCItems.chitinFrost); | ||
FROST_CHITIN.setCraftable(true).setCastable(false); | ||
|
||
UNDEAD_CHITIN.addItem(MoCItems.chitinUndead, 1, Material.VALUE_Ingot); | ||
UNDEAD_CHITIN.setRepresentativeItem(MoCItems.chitinUndead); | ||
UNDEAD_CHITIN.setCraftable(true).setCastable(false); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/drzhark/mocreatures/compat/tinkers/traits/TraitStingEffect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package drzhark.mocreatures.compat.tinkers.traits; | ||
|
||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import net.minecraft.potion.Potion; | ||
import net.minecraft.potion.PotionEffect; | ||
import slimeknights.tconstruct.library.tools.ToolNBT; | ||
import slimeknights.tconstruct.library.traits.AbstractTrait; | ||
import slimeknights.tconstruct.library.utils.TagUtil; | ||
import slimeknights.tconstruct.library.utils.TinkerUtil; | ||
|
||
public class TraitStingEffect extends AbstractTrait { | ||
protected final float damage; | ||
protected final Potion effect; | ||
|
||
public TraitStingEffect(String identifier, int color, float damage, Potion effect) { | ||
super(identifier, color); | ||
|
||
this.damage = damage; | ||
this.effect = effect; | ||
} | ||
|
||
@Override | ||
public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { | ||
// Apply bonus damage if it hasn't been applied yet | ||
if (!TinkerUtil.hasTrait(rootCompound, identifier)) { | ||
ToolNBT data = TagUtil.getToolStats(rootCompound); | ||
data.attack += damage; | ||
TagUtil.setToolTag(rootCompound, data.get()); | ||
} | ||
super.applyEffect(rootCompound, modifierTag); | ||
} | ||
|
||
@Override | ||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damageDealt, boolean wasCritical, boolean wasHit) { | ||
if (wasHit && target.isEntityAlive()) { | ||
target.addPotionEffect(new PotionEffect(effect, 20 * 5)); | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/drzhark/mocreatures/compat/tinkers/traits/TraitStingEffectPlayer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package drzhark.mocreatures.compat.tinkers.traits; | ||
|
||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import net.minecraft.potion.Potion; | ||
import net.minecraft.potion.PotionEffect; | ||
import slimeknights.tconstruct.library.tools.ToolNBT; | ||
import slimeknights.tconstruct.library.traits.AbstractTrait; | ||
import slimeknights.tconstruct.library.utils.TagUtil; | ||
import slimeknights.tconstruct.library.utils.TinkerUtil; | ||
|
||
public class TraitStingEffectPlayer extends AbstractTrait { | ||
protected final float damage; | ||
protected final Potion effect; | ||
protected final Potion playerEffect; | ||
|
||
public TraitStingEffectPlayer(String identifier, int color, float damage, Potion effect, Potion playerEffect) { | ||
super(identifier, color); | ||
|
||
this.damage = damage; | ||
this.effect = effect; | ||
this.playerEffect = playerEffect; | ||
} | ||
|
||
@Override | ||
public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { | ||
// Apply bonus damage if it hasn't been applied yet | ||
if (!TinkerUtil.hasTrait(rootCompound, identifier)) { | ||
ToolNBT data = TagUtil.getToolStats(rootCompound); | ||
data.attack += damage; | ||
TagUtil.setToolTag(rootCompound, data.get()); | ||
} | ||
|
||
super.applyEffect(rootCompound, modifierTag); | ||
} | ||
|
||
@Override | ||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damageDealt, boolean wasCritical, boolean wasHit) { | ||
if (wasHit && target.isEntityAlive()) { | ||
// Don't set the normal effect on players | ||
if (!(target instanceof EntityPlayer)) { | ||
target.addPotionEffect(new PotionEffect(effect, 20 * 5)); | ||
} | ||
|
||
// Set our alternative effect for players | ||
if (target instanceof EntityPlayer) { | ||
target.addPotionEffect(new PotionEffect(playerEffect, 20 * 5)); | ||
} | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/drzhark/mocreatures/compat/tinkers/traits/TraitStingFire.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package drzhark.mocreatures.compat.tinkers.traits; | ||
|
||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import slimeknights.tconstruct.library.tools.ToolNBT; | ||
import slimeknights.tconstruct.library.traits.AbstractTrait; | ||
import slimeknights.tconstruct.library.utils.TagUtil; | ||
import slimeknights.tconstruct.library.utils.TinkerUtil; | ||
|
||
public class TraitStingFire extends AbstractTrait { | ||
protected final float damage; | ||
|
||
public TraitStingFire(float damage) { | ||
super("fire_sting", 0xC62B13); | ||
|
||
this.damage = damage; | ||
} | ||
|
||
@Override | ||
public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { | ||
// Apply bonus damage if it hasn't been applied yet | ||
if (!TinkerUtil.hasTrait(rootCompound, identifier)) { | ||
ToolNBT data = TagUtil.getToolStats(rootCompound); | ||
data.attack += damage; | ||
TagUtil.setToolTag(rootCompound, data.get()); | ||
} | ||
super.applyEffect(rootCompound, modifierTag); | ||
} | ||
|
||
@Override | ||
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damageDealt, boolean wasCritical, boolean wasHit) { | ||
if (wasHit && target.isEntityAlive()) { | ||
target.setFire(5); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/resources/assets/mocreatures/materials/dark_chitin.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "multicolor", | ||
"suffix": "contrast", | ||
"parameters": { | ||
"dark": "363844", | ||
"mid": "363844", | ||
"bright": "363844" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/resources/assets/mocreatures/materials/earth_chitin.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "multicolor", | ||
"suffix": "contrast", | ||
"parameters": { | ||
"dark": "F37A07", | ||
"mid": "F37A07", | ||
"bright": "F37A07" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/resources/assets/mocreatures/materials/fire_chitin.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "multicolor", | ||
"suffix": "contrast", | ||
"parameters": { | ||
"dark": "C62B13", | ||
"mid": "C62B13", | ||
"bright": "C62B13" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/resources/assets/mocreatures/materials/frost_chitin.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "multicolor", | ||
"suffix": "contrast", | ||
"parameters": { | ||
"dark": "1B7A87", | ||
"mid": "1B7A87", | ||
"bright": "1B7A87" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/resources/assets/mocreatures/materials/undead_chitin.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "multicolor", | ||
"suffix": "contrast", | ||
"parameters": { | ||
"dark": "92B859", | ||
"mid": "92B859", | ||
"bright": "92B859" | ||
} | ||
} |