Aether API fixes/changes

It is 100% independent from Aether Legacy. Now, just need to work on it
a bit more and it will be ready.
This commit is contained in:
Kino 2017-11-01 21:08:34 -04:00
parent 20a5f95ac5
commit 1cb8768143
7 changed files with 53 additions and 37 deletions

View file

@ -14,7 +14,6 @@ import com.legacy.aether.api.enchantments.AetherEnchantmentFuel;
import com.legacy.aether.api.freezables.AetherFreezable;
import com.legacy.aether.api.freezables.AetherFreezableFuel;
import com.legacy.aether.api.moa.AetherMoaType;
import com.legacy.aether.api.moa.MoaProperties;
import com.legacy.aether.common.Aether;
public class AetherRegistry
@ -40,66 +39,70 @@ public class AetherRegistry
this.iFreezableRegistry = PersistentRegistryManager.createRegistry(Aether.locate("freezables"), AetherFreezable.class, null, 0, MAX_REGISTRY_ID, false, null, null, null, null);
this.iFreezableFuelRegistry = PersistentRegistryManager.createRegistry(Aether.locate("freezable_fuels"), AetherFreezableFuel.class, null, 0, MAX_REGISTRY_ID, false, null, null, null, null);
this.iMoaTypeRegistry = PersistentRegistryManager.createRegistry(Aether.locate("moa_types"), AetherMoaType.class, null, 0, MAX_REGISTRY_ID, false, null, null, null, null);
initialization();
}
private void initialization()
{
register(new ResourceLocation("aether_legacy", "blue"), new AetherMoaType(0x7777FF, new MoaProperties(3, 100, 0.3F)));
register(new ResourceLocation("aether_legacy", "orange"), new AetherMoaType(-0xC3D78, new MoaProperties(2, 50, 0.6F)));
register(new ResourceLocation("aether_legacy", "white"), new AetherMoaType(0xFFFFFF, new MoaProperties(4, 20, 0.3F)));
register(new ResourceLocation("aether_legacy", "black"), new AetherMoaType(0x222222, new MoaProperties(8, 5, 0.3F)));
}
public void register(AetherAccessory type)
public AetherAccessory register(AetherAccessory type)
{
ItemStack stack = type.getAccessoryStack();
ResourceLocation registryName = new ResourceLocation(Aether.modid, stack.getItem().getRegistryName().getResourcePath() + "_meta_" + stack.getMetadata());
this.iAccessoryRegistry.register(type.setRegistryName(registryName));
return type;
}
public void register(AetherEnchantment type)
public AetherEnchantment register(AetherEnchantment type)
{
ItemStack stack = type.getInput();
ResourceLocation registryName = new ResourceLocation(Aether.modid, stack.getItem().getRegistryName().getResourcePath() + "_meta_" + stack.getMetadata());
this.iEnchantmentRegistry.register(type.setRegistryName(registryName));
return type;
}
public void register(AetherEnchantmentFuel type)
public AetherEnchantmentFuel register(AetherEnchantmentFuel type)
{
ItemStack stack = type.getFuelStack();
ResourceLocation registryName = new ResourceLocation(Aether.modid, stack.getItem().getRegistryName().getResourcePath() + "_meta_" + stack.getMetadata());
this.iEnchantmentFuelRegistry.register(type.setRegistryName(registryName));
return type;
}
public void register(AetherFreezable type)
public AetherFreezable register(AetherFreezable type)
{
ItemStack stack = type.getInput();
ResourceLocation registryName = new ResourceLocation(Aether.modid, stack.getItem().getRegistryName().getResourcePath() + "_meta_" + stack.getMetadata());
this.iFreezableRegistry.register(type.setRegistryName(registryName));
return type;
}
public void register(AetherFreezableFuel type)
public AetherFreezableFuel register(AetherFreezableFuel type)
{
ItemStack stack = type.getFuelStack();
ResourceLocation registryName = new ResourceLocation(Aether.modid, stack.getItem().getRegistryName().getResourcePath() + "_meta_" + stack.getMetadata());
this.iFreezableFuelRegistry.register(type.setRegistryName(registryName));
return type;
}
public void register(String modId, String name, AetherMoaType type)
public AetherMoaType register(String modId, String name, AetherMoaType type)
{
this.iMoaTypeRegistry.register(type.setRegistryName(modId, name));
return type;
}
public void register(ResourceLocation registryName, AetherMoaType type)
public AetherMoaType register(ResourceLocation registryName, AetherMoaType type)
{
this.iMoaTypeRegistry.register(type.setRegistryName(registryName));
return type;
}
public boolean isAccessory(ItemStack stack)

View file

@ -3,8 +3,6 @@ package com.legacy.aether.api.moa;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.ResourceLocation;
import com.legacy.aether.common.registry.creative_tabs.AetherCreativeTabs;
public class AetherMoaType extends net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl<AetherMoaType>
{
@ -19,7 +17,7 @@ public class AetherMoaType extends net.minecraftforge.fml.common.registry.IForge
this.hexColor = hexColor;
this.properties = properties;
this.creativeTab = AetherCreativeTabs.misc;
this.creativeTab = CreativeTabs.MISC;
}
public AetherMoaType(int hexColor, MoaProperties properties, CreativeTabs creativeTab)

View file

@ -10,7 +10,7 @@ import net.minecraft.client.gui.inventory.GuiInventory;
import org.lwjgl.input.Keyboard;
import com.legacy.aether.api.AetherRegistry;
import com.legacy.aether.common.entities.AetherEntities;
import com.legacy.aether.common.entities.passive.mountable.EntityMoa;
import com.legacy.aether.common.networking.AetherNetworkingManager;
import com.legacy.aether.common.networking.packets.PacketPerkChanged;
@ -48,7 +48,7 @@ public class GuiAetherPerks extends GuiScreen
this.player = PlayerAether.get(this.mc.thePlayer);
this.moaSkin = this.player.donatorMoaSkin;
this.moa = this.player.thePlayer.getRidingEntity() instanceof EntityMoa ? (EntityMoa) this.player.thePlayer.getRidingEntity() : new EntityMoa(this.mc.theWorld, AetherRegistry.getInstance().getMoaType(2));
this.moa = this.player.thePlayer.getRidingEntity() instanceof EntityMoa ? (EntityMoa) this.player.thePlayer.getRidingEntity() : new EntityMoa(this.mc.theWorld, AetherEntities.WHITE_MOA);
}
@Override

View file

@ -1,8 +1,12 @@
package com.legacy.aether.common.entities;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import com.legacy.aether.api.AetherRegistry;
import com.legacy.aether.api.moa.AetherMoaType;
import com.legacy.aether.api.moa.MoaProperties;
import com.legacy.aether.common.Aether;
import com.legacy.aether.common.entities.block.EntityFloatingBlock;
import com.legacy.aether.common.entities.block.EntityTNTPresent;
@ -36,10 +40,13 @@ import com.legacy.aether.common.entities.projectile.crystals.EntityThunderBall;
import com.legacy.aether.common.entities.projectile.darts.EntityDartEnchanted;
import com.legacy.aether.common.entities.projectile.darts.EntityDartGolden;
import com.legacy.aether.common.entities.projectile.darts.EntityDartPoison;
import com.legacy.aether.common.registry.creative_tabs.AetherCreativeTabs;
public class AetherEntities
{
public static AetherMoaType BLUE_MOA, ORANGE_MOA, WHITE_MOA, BLACK_MOA;
public static void initialization()
{
register(EntityMoa.class, "moa", 0, 0x9fc3f7, 0x343e44);
@ -81,6 +88,11 @@ public class AetherEntities
register(EntityLightningKnife.class, "lightning_knife", 30);
register(EntityParachute.class, "parachute", 31);
BLUE_MOA = AetherRegistry.getInstance().register(new ResourceLocation("aether_legacy", "blue"), new AetherMoaType(0x7777FF, new MoaProperties(3, 100, 0.3F), AetherCreativeTabs.misc));
ORANGE_MOA = AetherRegistry.getInstance().register(new ResourceLocation("aether_legacy", "orange"), new AetherMoaType(-0xC3D78, new MoaProperties(2, 50, 0.6F), AetherCreativeTabs.misc));
WHITE_MOA = AetherRegistry.getInstance().register(new ResourceLocation("aether_legacy", "white"), new AetherMoaType(0xFFFFFF, new MoaProperties(4, 20, 0.3F), AetherCreativeTabs.misc));
BLACK_MOA = AetherRegistry.getInstance().register(new ResourceLocation("aether_legacy", "black"), new AetherMoaType(0x222222, new MoaProperties(8, 5, 0.3F), AetherCreativeTabs.misc));
DataSerializerRegistry.initialize();
}

View file

@ -60,7 +60,7 @@ public class TileEntityEnchanter extends AetherTileEntity
if (this.currentEnchantment != null)
{
if (this.getStackInSlot(0) == null || AetherRegistry.getInstance().getEnchantment(this.getStackInSlot(0)).equals(this.currentEnchantment))
if (this.getStackInSlot(0) == null || AetherRegistry.getInstance().hasEnchantment(this.getStackInSlot(0)) && AetherRegistry.getInstance().getEnchantment(this.getStackInSlot(0)).equals(this.currentEnchantment))
{
this.currentEnchantment = null;
this.enchantmentProgress = 0;
@ -111,17 +111,20 @@ public class TileEntityEnchanter extends AetherTileEntity
}
else
{
ItemStack itemstack = this.getStackInSlot(0);
AetherEnchantment enchantment = AetherRegistry.getInstance().getEnchantment(itemstack);
if (enchantment != null)
if (this.getStackInSlot(0) != null)
{
if (this.getStackInSlot(2) == null || enchantment.getOutput().getItem() == this.getStackInSlot(2).getItem() && enchantment.getOutput().getMetadata() == this.getStackInSlot(2).getMetadata())
ItemStack itemstack = this.getStackInSlot(0);
AetherEnchantment enchantment = AetherRegistry.getInstance().getEnchantment(itemstack);
if (enchantment != null)
{
this.currentEnchantment = enchantment;
this.enchantmentTime = this.currentEnchantment.getTimeRequired();
this.addEnchantmentWeight(itemstack);
this.enchantmentTime = AetherHooks.onSetEnchantmentTime(this, this.currentEnchantment, this.enchantmentTime);
if (this.getStackInSlot(2) == null || enchantment.getOutput().getItem() == this.getStackInSlot(2).getItem() && enchantment.getOutput().getMetadata() == this.getStackInSlot(2).getMetadata())
{
this.currentEnchantment = enchantment;
this.enchantmentTime = this.currentEnchantment.getTimeRequired();
this.addEnchantmentWeight(itemstack);
this.enchantmentTime = AetherHooks.onSetEnchantmentTime(this, this.currentEnchantment, this.enchantmentTime);
}
}
}
}

View file

@ -60,7 +60,7 @@ public class TileEntityFreezer extends AetherTileEntity
if (this.currentFreezable != null)
{
if (this.getStackInSlot(0) == null || AetherRegistry.getInstance().getFreezable(this.getStackInSlot(0)).equals(this.currentFreezable))
if (this.getStackInSlot(0) == null || AetherRegistry.getInstance().hasFreezable(this.getStackInSlot(0)) && AetherRegistry.getInstance().getFreezable(this.getStackInSlot(0)).equals(this.currentFreezable))
{
this.currentFreezable = null;
this.freezeProgress = 0;
@ -108,7 +108,7 @@ public class TileEntityFreezer extends AetherTileEntity
}
}
}
else
else if (this.getStackInSlot(0) != null)
{
ItemStack itemstack = this.getStackInSlot(0);
AetherFreezable freezable = AetherRegistry.getInstance().getFreezable(itemstack);

View file

@ -11,11 +11,11 @@ import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import com.legacy.aether.api.AetherRegistry;
import com.legacy.aether.common.blocks.BlocksAether;
import com.legacy.aether.common.blocks.dungeon.BlockDungeonBase;
import com.legacy.aether.common.blocks.util.EnumCloudType;
import com.legacy.aether.common.blocks.util.EnumStoneType;
import com.legacy.aether.common.entities.AetherEntities;
import com.legacy.aether.common.entities.bosses.valkyrie_queen.EntityValkyrieQueen;
import com.legacy.aether.common.items.ItemMoaEgg;
import com.legacy.aether.common.items.ItemsAether;
@ -455,7 +455,7 @@ public class SilverDungeon extends AetherDungeon
case 2 :
return new ItemStack(ItemsAether.dart_shooter);
case 3 :
return ItemMoaEgg.getStackFromType(AetherRegistry.getInstance().getMoaType(2));
return ItemMoaEgg.getStackFromType(AetherEntities.WHITE_MOA);
case 4 :
return new ItemStack(ItemsAether.ambrosium_shard, random.nextInt(10) + 1);
case 5 :