-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
35 changed files
with
1,369 additions
and
42 deletions.
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
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
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
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
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
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
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
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,51 @@ | ||
package thaumcraft.api.golems; | ||
|
||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraft.util.StatCollector; | ||
|
||
public enum EnumGolemTrait { | ||
SMART(new ResourceLocation("thaumcraft","textures/misc/golem/tag_smart.png")), | ||
DEFT(new ResourceLocation("thaumcraft","textures/misc/golem/tag_deft.png")), | ||
CLUMSY(new ResourceLocation("thaumcraft","textures/misc/golem/tag_clumsy.png")), | ||
FIGHTER(new ResourceLocation("thaumcraft","textures/misc/golem/tag_fighter.png")), | ||
WHEELED(new ResourceLocation("thaumcraft","textures/misc/golem/tag_wheeled.png")), | ||
FLYER(new ResourceLocation("thaumcraft","textures/misc/golem/tag_flyer.png")), | ||
CLIMBER(new ResourceLocation("thaumcraft","textures/misc/golem/tag_climber.png")), | ||
HEAVY(new ResourceLocation("thaumcraft","textures/misc/golem/tag_heavy.png")), | ||
LIGHT(new ResourceLocation("thaumcraft","textures/misc/golem/tag_light.png")), | ||
FRAGILE(new ResourceLocation("thaumcraft","textures/misc/golem/tag_fragile.png")), | ||
REPAIR(new ResourceLocation("thaumcraft","textures/misc/golem/tag_repair.png")), | ||
SCOUT(new ResourceLocation("thaumcraft","textures/misc/golem/tag_scout.png")), | ||
ARMORED(new ResourceLocation("thaumcraft","textures/misc/golem/tag_armored.png")), | ||
BRUTAL(new ResourceLocation("thaumcraft","textures/misc/golem/tag_brutal.png")), | ||
FIREPROOF(new ResourceLocation("thaumcraft","textures/misc/golem/tag_fireproof.png")), | ||
BREAKER(new ResourceLocation("thaumcraft","textures/misc/golem/tag_breaker.png")), | ||
HAULER(new ResourceLocation("thaumcraft","textures/misc/golem/tag_hauler.png")), | ||
RANGED(new ResourceLocation("thaumcraft","textures/misc/golem/tag_ranged.png")); | ||
|
||
static { | ||
CLUMSY.opposite = DEFT; | ||
DEFT.opposite = CLUMSY; | ||
|
||
HEAVY.opposite = LIGHT; | ||
LIGHT.opposite = HEAVY; | ||
|
||
FRAGILE.opposite = ARMORED; | ||
ARMORED.opposite = FRAGILE; | ||
} | ||
|
||
public ResourceLocation icon; | ||
public EnumGolemTrait opposite; | ||
|
||
private EnumGolemTrait(ResourceLocation icon) { | ||
this.icon = icon; | ||
} | ||
|
||
public String getLocalizedName() { | ||
return StatCollector.translateToLocal("golem.trait."+this.name().toLowerCase()); | ||
} | ||
|
||
public String getLocalizedDescription() { | ||
return StatCollector.translateToLocal("golem.trait.text."+this.name().toLowerCase()); | ||
} | ||
} |
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,103 @@ | ||
package thaumcraft.api.golems; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
|
||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.AxisAlignedBB; | ||
import net.minecraft.util.BlockPos; | ||
import net.minecraft.world.World; | ||
import thaumcraft.api.ThaumcraftApi; | ||
import thaumcraft.api.golems.seals.ISeal; | ||
import thaumcraft.api.golems.seals.ISealEntity; | ||
import thaumcraft.api.golems.seals.SealPos; | ||
import thaumcraft.api.golems.tasks.Task; | ||
|
||
public class GolemHelper { | ||
|
||
/** | ||
* Make sure to register your seals during the preInit phase. | ||
* @param seal | ||
*/ | ||
public static void registerSeal(ISeal seal) { | ||
ThaumcraftApi.internalMethods.registerSeal(seal); | ||
} | ||
|
||
public static ISeal getSeal(String key) { | ||
return ThaumcraftApi.internalMethods.getSeal(key); | ||
} | ||
|
||
public static ISealEntity getSealEntity(int dim, SealPos pos) { | ||
return ThaumcraftApi.internalMethods.getSealEntity(dim, pos); | ||
} | ||
|
||
public static void addGolemTask(int dim, Task task) { | ||
ThaumcraftApi.internalMethods.addGolemTask(dim, task); | ||
} | ||
|
||
public static HashMap<Integer,ArrayList<ProvisionRequest>> provisionRequests = new HashMap<Integer,ArrayList<ProvisionRequest>>(); | ||
|
||
public static void requestProvisioning(World world, ISealEntity seal, ItemStack stack) { | ||
if (!provisionRequests.containsKey(world.provider.getDimensionId())) | ||
provisionRequests.put(world.provider.getDimensionId(), new ArrayList<ProvisionRequest>()); | ||
ArrayList<ProvisionRequest> list = provisionRequests.get(world.provider.getDimensionId()); | ||
ProvisionRequest pr = new ProvisionRequest(seal,stack); | ||
if (!list.contains(pr)) | ||
list.add(pr); | ||
} | ||
|
||
/** | ||
* This method is used to get a single blockpos from within a designated seal area. | ||
* This method is best used if you want to increment through the blocks in the area. | ||
* @param seal | ||
* @param count a value used to derive a specific pos | ||
* @return | ||
*/ | ||
public static BlockPos getPosInArea(ISealEntity seal, int count) { | ||
int xx = 1 + (seal.getArea().getX()-1) * (seal.getSealPos().face.getFrontOffsetX()==0?2:1); | ||
int yy = 1 + (seal.getArea().getY()-1) * (seal.getSealPos().face.getFrontOffsetY()==0?2:1); | ||
int zz = 1 + (seal.getArea().getZ()-1) * (seal.getSealPos().face.getFrontOffsetZ()==0?2:1); | ||
|
||
int qx = seal.getSealPos().face.getFrontOffsetX()!=0?seal.getSealPos().face.getFrontOffsetX():1; | ||
int qy = seal.getSealPos().face.getFrontOffsetY()!=0?seal.getSealPos().face.getFrontOffsetY():1; | ||
int qz = seal.getSealPos().face.getFrontOffsetZ()!=0?seal.getSealPos().face.getFrontOffsetZ():1; | ||
|
||
int y = qy*((count/zz)/xx)%yy + seal.getSealPos().face.getFrontOffsetY(); | ||
int x = qx*(count/zz)%xx + seal.getSealPos().face.getFrontOffsetX(); | ||
int z = qz*count%zz + seal.getSealPos().face.getFrontOffsetZ(); | ||
|
||
BlockPos p = seal.getSealPos().pos.add( | ||
x - (seal.getSealPos().face.getFrontOffsetX()==0?xx/2:0), | ||
y - (seal.getSealPos().face.getFrontOffsetY()==0?yy/2:0), | ||
z - (seal.getSealPos().face.getFrontOffsetZ()==0?zz/2:0)); | ||
|
||
return p; | ||
} | ||
|
||
|
||
/** | ||
* Returns the designated seal area as a AxisAlignedBB | ||
* @param seal | ||
* @return | ||
*/ | ||
public static AxisAlignedBB getBoundsForArea(ISealEntity seal) { | ||
return AxisAlignedBB.fromBounds( | ||
seal.getSealPos().pos.getX(), seal.getSealPos().pos.getY(), seal.getSealPos().pos.getZ(), | ||
seal.getSealPos().pos.getX()+1, seal.getSealPos().pos.getY()+1, seal.getSealPos().pos.getZ()+1) | ||
.offset( | ||
seal.getSealPos().face.getFrontOffsetX(), | ||
seal.getSealPos().face.getFrontOffsetY(), | ||
seal.getSealPos().face.getFrontOffsetZ()) | ||
.addCoord( | ||
seal.getSealPos().face.getFrontOffsetX()!=0?(seal.getArea().getX()-1) * seal.getSealPos().face.getFrontOffsetX():0, | ||
seal.getSealPos().face.getFrontOffsetY()!=0?(seal.getArea().getY()-1) * seal.getSealPos().face.getFrontOffsetY():0, | ||
seal.getSealPos().face.getFrontOffsetZ()!=0?(seal.getArea().getZ()-1) * seal.getSealPos().face.getFrontOffsetZ():0) | ||
.expand( | ||
seal.getSealPos().face.getFrontOffsetX()==0?seal.getArea().getX()-1:0, | ||
seal.getSealPos().face.getFrontOffsetY()==0?seal.getArea().getY()-1:0, | ||
seal.getSealPos().face.getFrontOffsetZ()==0?seal.getArea().getZ()-1:0 ); | ||
} | ||
|
||
|
||
|
||
} |
Oops, something went wrong.