mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-20 03:59:56 +00:00
- AuraCore: <init>
- AuraPylon: Finishing touches
This commit is contained in:
1 parent
c0f0d9924e
commit
27ac4caf63
16 files changed
+140
-62
No files matched your search
@@ -147,6 +147,7 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemFamiliar, new ItemRenderFamiliar());
|
||||
MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemCreativeNode, new ItemCreativeNodeRenderer());
|
||||
|
||||
//Entities
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityPermNoClipItem.class, new RenderSpecialItem());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityAuraCore.class, new RenderEntityItem());
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
@@ -29,7 +30,10 @@ public class RenderEntityItem extends Render {
|
||||
public void doRender(Entity entity, double x, double y, double z, float parf1, float parf2) {
|
||||
if(!(entity instanceof EntityAuraCore)) return;
|
||||
|
||||
|
||||
EntityItem ei = new EntityItem(entity.worldObj, x, y, z, ((EntityAuraCore) entity).getEntityItem());
|
||||
ei.age = ((EntityAuraCore) entity).age;
|
||||
ei.hoverStart = ((EntityAuraCore) entity).hoverStart;
|
||||
ri.doRender(ei, x, y, z, parf1, parf2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -117,8 +117,8 @@ public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
|
||||
}
|
||||
|
||||
private void addNewOrbitalPoint(Orbital orbital, Random rand, Color color) {
|
||||
Orbital.OrbitalRenderProperties properties = new Orbital.OrbitalRenderProperties(Orbital.Axis.persisentRandomAxis(), (rand.nextDouble() * 2) + 1);
|
||||
properties.setColor(color).setTicksForFullCircle(80).setOffsetTicks(rand.nextInt(80));
|
||||
Orbital.OrbitalRenderProperties properties = new Orbital.OrbitalRenderProperties(Orbital.Axis.persisentRandomAxis(), rand.nextDouble() + 2D);
|
||||
properties.setColor(color).setTicksForFullCircle(60 + rand.nextInt(40)).setOffsetTicks(rand.nextInt(80));
|
||||
orbital.addOrbitalPoint(properties);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import makeo.gadomancy.client.ClientProxy;
|
||||
import makeo.gadomancy.common.containers.ContainerArcanePackager;
|
||||
import makeo.gadomancy.common.containers.ContainerInfusionClaw;
|
||||
import makeo.gadomancy.common.data.ModConfig;
|
||||
import makeo.gadomancy.common.entities.EntityAuraCore;
|
||||
import makeo.gadomancy.common.entities.EntityPermNoClipItem;
|
||||
import makeo.gadomancy.common.events.EventHandlerEntity;
|
||||
import makeo.gadomancy.common.events.EventHandlerGolem;
|
||||
@@ -27,6 +28,7 @@ import makeo.gadomancy.common.registration.RegisteredResearches;
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
import makeo.gadomancy.common.utils.world.WorldProviderTCEldrich;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.world.World;
|
||||
@@ -87,7 +89,14 @@ public class CommonProxy implements IGuiHandler {
|
||||
DimensionManager.registerProviderType(ModConfig.dimOuterId, WorldProviderTCEldrich.class, true);
|
||||
DimensionManager.registerDimension(ModConfig.dimOuterId, ModConfig.dimOuterId);
|
||||
|
||||
EntityRegistry.registerModEntity(EntityPermNoClipItem.class, "EntityPermItem", EntityRegistry.findGlobalUniqueEntityId(), Gadomancy.instance, 32, 40, false);
|
||||
registerEntity(EntityPermNoClipItem.class, "EntityPermItem", 32, 40, false);
|
||||
registerEntity(EntityAuraCore.class, "EntityAuraCore", 32, 10, true);
|
||||
}
|
||||
|
||||
private void registerEntity(Class<? extends Entity> entityClass, String name, int trackingRange, int updateFreq, boolean sendVelUpdates) {
|
||||
int id = EntityRegistry.findGlobalUniqueEntityId();
|
||||
EntityRegistry.registerGlobalEntityID(entityClass, name, id);
|
||||
EntityRegistry.registerModEntity(entityClass, name, id, Gadomancy.instance, trackingRange, updateFreq, sendVelUpdates);
|
||||
}
|
||||
|
||||
public void postInitalize() {
|
||||
|
||||
@@ -24,7 +24,6 @@ public class AuraEffectHandler {
|
||||
|
||||
public static Map<Aspect, AuraEffect> registeredEffects = new HashMap<Aspect, AuraEffect>();
|
||||
|
||||
//Called once every 8 ticks!
|
||||
public static void distributeEffects(Aspect aspect, World worldObj, double x, double y, double z, double range, int tick) {
|
||||
if(!registeredEffects.containsKey(aspect) || worldObj.isRemote) return;
|
||||
AuraEffect effect = registeredEffects.get(aspect);
|
||||
@@ -34,7 +33,10 @@ public class AuraEffectHandler {
|
||||
Iterator it = entitiesInRange.iterator();
|
||||
while(it.hasNext()) {
|
||||
Entity e = (Entity) it.next();
|
||||
if(e.isDead) it.remove();
|
||||
if(e.isDead) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
if(!effect.isEntityApplicable(e)) it.remove();
|
||||
}
|
||||
for(Object e : entitiesInRange) {
|
||||
|
||||
@@ -68,7 +68,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
|
||||
timeSinceLastItemInfo++;
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
if ((ticksExisted & 7) == 0) {
|
||||
if ((ticksExisted & 3) == 0) {
|
||||
if (checkComponents()) return;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,8 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
|
||||
public boolean isEntityApplicable(Entity e) {
|
||||
return !(e instanceof EntityPermanentItem) && !(e instanceof EntitySpecialItem) &&
|
||||
e instanceof EntityItem && ((EntityItem) e).getEntityItem() != null &&
|
||||
((EntityItem) e).getEntityItem().getItem() instanceof ItemCrystalEssence;
|
||||
((EntityItem) e).getEntityItem().getItem() instanceof ItemCrystalEssence &&
|
||||
((ItemCrystalEssence) ((EntityItem) e).getEntityItem().getItem()).getAspects(((EntityItem) e).getEntityItem()) != null;
|
||||
}
|
||||
});
|
||||
Entity dummy = new EntityItem(worldObj);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class TileAuraPylonTop extends SynchronizedTileEntity implements IAspectC
|
||||
TileAuraPylon pylon = (TileAuraPylon) te;
|
||||
if(pylon.isPartOfMultiblock() && !pylon.isMasterTile()) breakTile();
|
||||
} else {
|
||||
shouldRender = !(te == null || !(te instanceof TileAuraPylon));
|
||||
shouldRender = !(te == null || !(te instanceof TileAuraPylon) || !((TileAuraPylon) te).isPartOfMultiblock());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,10 @@ public class ModConfig {
|
||||
@Sync
|
||||
public static int entityNoClipItemDatawatcherMasterId = 19;
|
||||
@Sync
|
||||
public static int entityNoClipItemDatawatcherFixedXId = 20;
|
||||
public static int entityNoClipItemDatawatcherFixedId = 20;
|
||||
|
||||
@Sync
|
||||
public static int entityNoClipItemDatawatcherFixedYId = 21;
|
||||
@Sync
|
||||
public static int entityNoClipItemDatawatcherFixedZId = 22;
|
||||
public static int entityAuraCoreDatawatcherAspectId = 21;
|
||||
|
||||
@Sync
|
||||
public static int golemDatawatcherId = 29;
|
||||
@@ -52,9 +51,9 @@ public class ModConfig {
|
||||
|
||||
private static void loadFromConfig() {
|
||||
entityNoClipItemDatawatcherMasterId = config.getInt("itemNoClipDatawatcherMasterId", "entities", 19, 0, 31, "Do not edit unless you know what are you doing! - Datawatcher ID of the Master-Coordinates for EntityNoClipItem");
|
||||
entityNoClipItemDatawatcherFixedXId = config.getInt("itemNoClipDatawatchetFixXId", "entities", 20, 0, 31, "Do not edit unless you know what are you doing! - Datawatcher ID of the X-Coordinates for EntityNoClipItem");
|
||||
entityNoClipItemDatawatcherFixedYId = config.getInt("itemNoClipDatawatchetFixYId", "entities", 21, 0, 31, "Do not edit unless you know what are you doing! - Datawatcher ID of the Y-Coordinates for EntityNoClipItem");
|
||||
entityNoClipItemDatawatcherFixedZId = config.getInt("itemNoClipDatawatchetFixZId", "entities", 22, 0, 31, "Do not edit unless you know what are you doing! - Datawatcher ID of the Z-Coordinates for EntityNoClipItem");
|
||||
entityNoClipItemDatawatcherFixedId = config.getInt("itemNoClipDatawatcherFixId", "entities", 20, 0, 31, "Do not edit unless you know what are you doing! - Datawatcher ID of the Fixed-Coordinates for EntityNoClipItem");
|
||||
|
||||
entityAuraCoreDatawatcherAspectId = config.getInt("auraCoreDatawatcherAuraId", "entities", 21, 0, 31, "Do not edit unless you know what are you doing! - Datawatcher ID of the Auracore's current main aspect");
|
||||
|
||||
golemDatawatcherId = config.getInt("datawatcherId", "golem", 29, 0, 31, "Do not edit unless you know what are you doing!");
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package makeo.gadomancy.common.entities;
|
||||
|
||||
import makeo.gadomancy.common.data.ModConfig;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
@@ -15,17 +17,32 @@ import thaumcraft.common.entities.EntitySpecialItem;
|
||||
*
|
||||
* Created by HellFirePvP @ 16.11.2015 14:42
|
||||
*/
|
||||
public class EntityAuraCore extends EntitySpecialItem {
|
||||
public class EntityAuraCore extends EntityItem {
|
||||
|
||||
private int ticksExisted = 0;
|
||||
private AspectList internalAuraList = new AspectList();
|
||||
private Aspect dominatingAspect = null;
|
||||
|
||||
public EntityAuraCore(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {}
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
|
||||
getDataWatcher().addObjectByDataType(ModConfig.entityAuraCoreDatawatcherAspectId, 4);
|
||||
|
||||
getDataWatcher().updateObject(ModConfig.entityAuraCoreDatawatcherAspectId, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
if (this.age + 5 >= this.lifespan) {
|
||||
this.age = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound compound) {
|
||||
@@ -39,6 +56,8 @@ public class EntityAuraCore extends EntitySpecialItem {
|
||||
internalAuraList.add(Aspect.getAspect(cmp.getString("tag")), cmp.getInteger("amt"));
|
||||
}
|
||||
}
|
||||
String tag = compound.getString("domAspect");
|
||||
dominatingAspect = Aspect.getAspect(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,12 +67,14 @@ public class EntityAuraCore extends EntitySpecialItem {
|
||||
compound.setInteger("ticksExisted", ticksExisted);
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(Aspect a : internalAuraList.getAspects()) {
|
||||
if(a == null) continue;
|
||||
NBTTagCompound aspectCompound = new NBTTagCompound();
|
||||
aspectCompound.setString("tag", a.getTag());
|
||||
aspectCompound.setInteger("amt", internalAuraList.getAmount(a));
|
||||
list.appendTag(aspectCompound);
|
||||
}
|
||||
compound.setTag("auraList", list);
|
||||
compound.setString("domAspect", dominatingAspect == null ? "" : dominatingAspect.getTag());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import java.util.List;
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
*
|
||||
* Created by HellFirePvP @ 16.11.2015 19:59
|
||||
*/
|
||||
public class EntityPermNoClipItem extends EntityPermanentItem {
|
||||
@@ -42,9 +42,11 @@ public class EntityPermNoClipItem extends EntityPermanentItem {
|
||||
|
||||
ChunkCoordinates masterCoords = new ChunkCoordinates(this.masterX, this.masterY, this.masterZ);
|
||||
getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherMasterId, masterCoords);
|
||||
getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedXId, x);
|
||||
getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedYId, y);
|
||||
getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedZId, z);
|
||||
int fixX = Float.floatToIntBits(x);
|
||||
int fixY = Float.floatToIntBits(y);
|
||||
int fixZ = Float.floatToIntBits(z);
|
||||
ChunkCoordinates fixCoords = new ChunkCoordinates(fixX, fixY, fixZ);
|
||||
getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedId, fixCoords);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,14 +54,10 @@ public class EntityPermNoClipItem extends EntityPermanentItem {
|
||||
super.entityInit();
|
||||
|
||||
getDataWatcher().addObjectByDataType(ModConfig.entityNoClipItemDatawatcherMasterId, 6);
|
||||
getDataWatcher().addObjectByDataType(ModConfig.entityNoClipItemDatawatcherFixedXId, 3);
|
||||
getDataWatcher().addObjectByDataType(ModConfig.entityNoClipItemDatawatcherFixedYId, 3);
|
||||
getDataWatcher().addObjectByDataType(ModConfig.entityNoClipItemDatawatcherFixedZId, 3);
|
||||
getDataWatcher().addObjectByDataType(ModConfig.entityNoClipItemDatawatcherFixedId, 6);
|
||||
|
||||
getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherMasterId, new ChunkCoordinates(0, 0, 0));
|
||||
getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedXId, -1F);
|
||||
getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedYId, -1F);
|
||||
getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedZId, -1F);
|
||||
getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedId, new ChunkCoordinates(0, 0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +65,7 @@ public class EntityPermNoClipItem extends EntityPermanentItem {
|
||||
noClip = true;
|
||||
super.onUpdate();
|
||||
setVelocity(0, 0, 0);
|
||||
if (getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherFixedXId).getObject() == null)
|
||||
if (getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherFixedId).getObject() == null)
|
||||
return;
|
||||
|
||||
if((ticksExisted & 1) == 0) {
|
||||
@@ -79,9 +77,10 @@ public class EntityPermNoClipItem extends EntityPermanentItem {
|
||||
}
|
||||
}
|
||||
|
||||
float fX = getDataWatcher().getWatchableObjectFloat(ModConfig.entityNoClipItemDatawatcherFixedXId);
|
||||
float fY = getDataWatcher().getWatchableObjectFloat(ModConfig.entityNoClipItemDatawatcherFixedYId);
|
||||
float fZ = getDataWatcher().getWatchableObjectFloat(ModConfig.entityNoClipItemDatawatcherFixedZId);
|
||||
ChunkCoordinates fixC = (ChunkCoordinates) getDataWatcher().getWatchedObject(ModConfig.entityNoClipItemDatawatcherFixedId).getObject();
|
||||
float fX = Float.intBitsToFloat(fixC.posX);
|
||||
float fY = Float.intBitsToFloat(fixC.posY);
|
||||
float fZ = Float.intBitsToFloat(fixC.posZ);
|
||||
setPositionAndRotation(fX, fY, fZ, 0, 0);
|
||||
|
||||
if ((ticksExisted & 7) == 0 && !worldObj.isRemote) {
|
||||
@@ -114,9 +113,8 @@ public class EntityPermNoClipItem extends EntityPermanentItem {
|
||||
this.masterZ = com.getInteger("mZ");
|
||||
|
||||
getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherMasterId, new ChunkCoordinates(masterX, masterY, masterZ));
|
||||
getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedXId, fixPosX);
|
||||
getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedYId, fixPosY);
|
||||
getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedZId, fixPosZ);
|
||||
ChunkCoordinates cc = new ChunkCoordinates(Float.floatToIntBits(fixPosX), Float.floatToIntBits(fixPosY), Float.floatToIntBits(fixPosZ));
|
||||
getDataWatcher().updateObject(ModConfig.entityNoClipItemDatawatcherFixedId, cc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,16 +5,22 @@ import makeo.gadomancy.common.aura.AuraResearchManager;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileAuraPylon;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileBlockProtector;
|
||||
import makeo.gadomancy.common.data.ModConfig;
|
||||
import makeo.gadomancy.common.entities.EntityAuraCore;
|
||||
import makeo.gadomancy.common.entities.EntityPermNoClipItem;
|
||||
import makeo.gadomancy.common.familiar.FamiliarAIController;
|
||||
import makeo.gadomancy.common.items.ItemAuraCore;
|
||||
import makeo.gadomancy.common.utils.world.TCMazeHandler;
|
||||
import net.minecraft.entity.boss.IBossDisplayData;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
@@ -65,6 +71,30 @@ public class EventHandlerEntity {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onJoin(EntityJoinWorldEvent event) {
|
||||
if(event.entity != null && event.entity instanceof EntityItem) {
|
||||
ItemStack stack = ((EntityItem) event.entity).getEntityItem();
|
||||
if(stack == null) return;
|
||||
if(event.entity instanceof EntityAuraCore) return;
|
||||
Item i = stack.getItem();
|
||||
if(i instanceof ItemAuraCore) {
|
||||
event.setCanceled(true);
|
||||
if(event.world.isRemote) return;
|
||||
EntityAuraCore e = new EntityAuraCore(event.world);
|
||||
e.setEntityItemStack(((EntityItem) event.entity).getEntityItem());
|
||||
e.setPosition(event.entity.posX, event.entity.posY, event.entity.posZ);
|
||||
e.age = ((EntityItem) event.entity).age;
|
||||
e.hoverStart = ((EntityItem) event.entity).hoverStart;
|
||||
e.delayBeforeCanPickup = ((EntityItem) event.entity).delayBeforeCanPickup;
|
||||
e.motionX = event.entity.motionX;
|
||||
e.motionY = event.entity.motionY;
|
||||
e.motionZ = event.entity.motionZ;
|
||||
event.world.spawnEntityInWorld(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void on(EntityItemPickupEvent event) {
|
||||
if(!event.entityPlayer.worldObj.isRemote) {
|
||||
|
||||
@@ -71,32 +71,6 @@ public class EventHandlerWorld {
|
||||
rules.theGameRules.put("mobGriefing", new ValueOverride(this, String.valueOf(rules.getGameRuleBooleanValue("mobGriefing"))));
|
||||
}
|
||||
|
||||
private static class ValueOverride extends GameRules.Value {
|
||||
private final EventHandlerWorld handler;
|
||||
public ValueOverride(EventHandlerWorld handler, String value) {
|
||||
super(value);
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGameRuleBooleanValue() {
|
||||
boolean mobGriefing = super.getGameRuleBooleanValue();
|
||||
if(mobGriefing) {
|
||||
Entity lastUpdated = handler.lastUpdated;
|
||||
if(lastUpdated != null) {
|
||||
StackTraceElement[] elements = Thread.currentThread().getStackTrace();
|
||||
for(StackTraceElement element : elements) {
|
||||
if(element.getClassName().equals(EntityLivingBase.class.getName())
|
||||
&& (element.getMethodName().equals("func_70071_h") || element.getMethodName().equals("onUpdate"))) {
|
||||
return !TileBlockProtector.isSpotProtected(lastUpdated.worldObj, lastUpdated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return mobGriefing;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void on(ExplosionEvent.Start e) {
|
||||
Explosion expl = e.explosion;
|
||||
@@ -217,4 +191,30 @@ public class EventHandlerWorld {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class ValueOverride extends GameRules.Value {
|
||||
private final EventHandlerWorld handler;
|
||||
public ValueOverride(EventHandlerWorld handler, String value) {
|
||||
super(value);
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGameRuleBooleanValue() {
|
||||
boolean mobGriefing = super.getGameRuleBooleanValue();
|
||||
if(mobGriefing) {
|
||||
Entity lastUpdated = handler.lastUpdated;
|
||||
if(lastUpdated != null) {
|
||||
StackTraceElement[] elements = Thread.currentThread().getStackTrace();
|
||||
for(StackTraceElement element : elements) {
|
||||
if(element.getClassName().equals(EntityLivingBase.class.getName())
|
||||
&& (element.getMethodName().equals("func_70071_h") || element.getMethodName().equals("onUpdate"))) {
|
||||
return !TileBlockProtector.isSpotProtected(lastUpdated.worldObj, lastUpdated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return mobGriefing;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package makeo.gadomancy.common.items;
|
||||
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.utils.NBTHelper;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@@ -21,8 +23,16 @@ import java.util.List;
|
||||
public class ItemAuraCore extends Item {
|
||||
|
||||
public ItemAuraCore() {
|
||||
setUnlocalizedName("ItemAuraCore");
|
||||
setMaxDamage(0);
|
||||
setMaxStackSize(1);
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(RegisteredItems.creativeTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack p_77613_1_) {
|
||||
return RegisteredItems.raritySacred;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,6 +43,7 @@ public class RegisteredItems {
|
||||
public static Item itemFamiliar;
|
||||
public static Item itemCreativeNode;
|
||||
public static ItemArcanePackage itemPackage;
|
||||
public static Item itemAuraCore;
|
||||
|
||||
public static void preInit() {
|
||||
creativeTab = new CreativeTabs(Gadomancy.MODID) {
|
||||
@@ -74,6 +75,7 @@ public class RegisteredItems {
|
||||
itemFamiliar = registerItem(new ItemFamiliar());
|
||||
itemCreativeNode = registerItem(new ItemCreativeNode());
|
||||
itemPackage = registerItem(new ItemArcanePackage());
|
||||
itemAuraCore = registerItem(new ItemAuraCore());
|
||||
}
|
||||
|
||||
private static <T extends Item> T registerItem(T item, String name) {
|
||||
|
||||
@@ -230,7 +230,7 @@ public class RegisteredResearches {
|
||||
new AspectList(),
|
||||
10, 10, 0, new ItemStack(RegisteredItems.itemFakeModIcon, 1, 0))
|
||||
.setAutoUnlock()
|
||||
.setPages(new ResearchPage("gadomancy.research_page.AURA_EFFECTS_1.1")).registerResearchItem();
|
||||
.setPages(new ResearchPage("gadomancy.research_page.AURA_EFFECTS.1")).registerResearchItem();
|
||||
|
||||
if(ModConfig.ancientStoneRecipes)
|
||||
researchAncientStones = new AlternatingResearchItem("ANCIENT_STONES",
|
||||
|
||||
Reference in new issue
Block a user