Added hull creative tabs
This commit is contained in:
parent
64ae1f4178
commit
03e5336582
23 changed files with 136 additions and 58 deletions
|
@ -1,26 +0,0 @@
|
|||
package cr0s.warpdrive;
|
||||
|
||||
import cr0s.warpdrive.data.EnumComponentType;
|
||||
import cr0s.warpdrive.item.ItemComponent;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class CreativeTabWarpDrive extends CreativeTabs {
|
||||
|
||||
public CreativeTabWarpDrive(final String label) {
|
||||
super(label);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getTabIconItem() {
|
||||
return ItemComponent.getItemStack(EnumComponentType.EMERALD_CRYSTAL);
|
||||
}
|
||||
}
|
|
@ -56,6 +56,8 @@ import cr0s.warpdrive.block.passive.BlockHighlyAdvancedMachine;
|
|||
import cr0s.warpdrive.block.passive.BlockIridium;
|
||||
import cr0s.warpdrive.block.weapon.BlockLaserCamera;
|
||||
import cr0s.warpdrive.block.weapon.BlockWeaponController;
|
||||
import cr0s.warpdrive.client.CreativeTabHull;
|
||||
import cr0s.warpdrive.client.CreativeTabMain;
|
||||
import cr0s.warpdrive.command.CommandDebug;
|
||||
import cr0s.warpdrive.command.CommandDump;
|
||||
import cr0s.warpdrive.command.CommandEntity;
|
||||
|
@ -265,7 +267,8 @@ public class WarpDrive {
|
|||
public static Method methodBlock_getSilkTouch = null;
|
||||
|
||||
// Client settings
|
||||
public static final CreativeTabs creativeTabWarpDrive = new CreativeTabWarpDrive(MODID.toLowerCase());
|
||||
public static final CreativeTabs creativeTabMain = new CreativeTabMain(MODID.toLowerCase() + ".main");
|
||||
public static final CreativeTabs creativeTabHull = new CreativeTabHull(MODID.toLowerCase() + ".hull");
|
||||
|
||||
@Instance(WarpDrive.MODID)
|
||||
public static WarpDrive instance;
|
||||
|
|
|
@ -34,11 +34,9 @@ public abstract class BlockAbstractBase extends Block implements IBlockBase {
|
|||
setHardness(5.0F);
|
||||
setResistance(6.0F * 5 / 3);
|
||||
setSoundType(SoundType.METAL);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
if (registryName != null) {
|
||||
setRegistryName(registryName);
|
||||
WarpDrive.register(this);
|
||||
}
|
||||
setCreativeTab(WarpDrive.creativeTabMain);
|
||||
setRegistryName(registryName);
|
||||
WarpDrive.register(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -89,7 +87,7 @@ public abstract class BlockAbstractBase extends Block implements IBlockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(final World world, @Nonnull final BlockPos blockPos, final EnumFacing axis) {
|
||||
public boolean rotateBlock(final World world, @Nonnull final BlockPos blockPos, @Nonnull final EnumFacing axis) {
|
||||
// already handled by vanilla
|
||||
return super.rotateBlock(world, blockPos, axis);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public abstract class BlockAbstractContainer extends BlockContainer implements I
|
|||
setHardness(5.0F);
|
||||
setResistance(6.0F * 5 / 3);
|
||||
setSoundType(SoundType.METAL);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
setCreativeTab(WarpDrive.creativeTabMain);
|
||||
setRegistryName(registryName);
|
||||
WarpDrive.register(this);
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class BlockHullGlass extends BlockColored implements IBlockBase, IDamageR
|
|||
setHardness(WarpDriveConfig.HULL_HARDNESS[tier - 1]);
|
||||
setResistance(WarpDriveConfig.HULL_BLAST_RESISTANCE[tier - 1] * 5 / 3);
|
||||
setSoundType(SoundType.GLASS);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
setCreativeTab(WarpDrive.creativeTabHull);
|
||||
setUnlocalizedName("warpdrive.hull" + tier + ".glass.");
|
||||
setRegistryName(registryName);
|
||||
WarpDrive.register(this, new ItemBlockHull(this));
|
||||
|
|
|
@ -8,6 +8,7 @@ import cr0s.warpdrive.data.EnumHullPlainType;
|
|||
import cr0s.warpdrive.data.Vector3;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.block.material.EnumPushReaction;
|
||||
|
@ -17,6 +18,7 @@ import net.minecraft.block.state.BlockStateContainer;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
@ -33,15 +35,20 @@ public class BlockHullPlain extends BlockAbstractBase implements IDamageReceiver
|
|||
final EnumHullPlainType enumHullPlainType;
|
||||
|
||||
public BlockHullPlain(final String registryName, final byte tier, final EnumHullPlainType enumHullPlainType) {
|
||||
super(null, Material.ROCK);
|
||||
super(registryName, Material.ROCK);
|
||||
this.tier = tier;
|
||||
this.enumHullPlainType = enumHullPlainType;
|
||||
setHardness(WarpDriveConfig.HULL_HARDNESS[tier - 1]);
|
||||
setResistance(WarpDriveConfig.HULL_BLAST_RESISTANCE[tier - 1] * 5 / 3);
|
||||
setUnlocalizedName("warpdrive.hull" + tier + ".plain.");
|
||||
setDefaultState(blockState.getBaseState().withProperty(BlockColored.COLOR, EnumDyeColor.WHITE));
|
||||
setRegistryName(registryName);
|
||||
WarpDrive.register(this, new ItemBlockHull(this));
|
||||
setCreativeTab(WarpDrive.creativeTabHull);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemBlock createItemBlock() {
|
||||
return new ItemBlockHull(this);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
|
|
@ -68,7 +68,7 @@ public class BlockHullSlab extends BlockSlab implements IBlockBase, IDamageRecei
|
|||
setHardness(WarpDriveConfig.HULL_HARDNESS[tier - 1]);
|
||||
setResistance(WarpDriveConfig.HULL_BLAST_RESISTANCE[tier - 1] * 5 / 3);
|
||||
setSoundType(SoundType.METAL);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
setCreativeTab(WarpDrive.creativeTabHull);
|
||||
setUnlocalizedName("warpdrive.hull" + tier + ".slab." + EnumDyeColor.byMetadata(blockStateHull.getBlock().getMetaFromState(blockStateHull)).getUnlocalizedName());
|
||||
setRegistryName(registryName);
|
||||
WarpDrive.register(this, new ItemBlockHullSlab(this));
|
||||
|
|
|
@ -34,7 +34,7 @@ public class BlockHullStairs extends BlockStairs implements IBlockBase, IDamageR
|
|||
super(blockStateHull);
|
||||
this.blockStateHull = blockStateHull;
|
||||
this.tier = tier;
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
setCreativeTab(WarpDrive.creativeTabHull);
|
||||
setUnlocalizedName("warpdrive.hull" + tier + ".stairs." + EnumDyeColor.byMetadata(blockStateHull.getBlock().getMetaFromState(blockStateHull)).getUnlocalizedName());
|
||||
setRegistryName(registryName);
|
||||
WarpDrive.register(this, new ItemBlockHull(this));
|
||||
|
|
|
@ -38,9 +38,6 @@ public class ClientProxy extends CommonProxy {
|
|||
public void onForgeInitialisation() {
|
||||
super.onForgeInitialisation();
|
||||
|
||||
// creative tab
|
||||
WarpDrive.creativeTabWarpDrive.setBackgroundImageName("items.png");
|
||||
|
||||
// event handlers
|
||||
MinecraftForge.EVENT_BUS.register(new ClientHandler());
|
||||
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package cr0s.warpdrive.client;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public abstract class CreativeTabAbstractBase extends CreativeTabs {
|
||||
|
||||
static protected Random random = new Random();
|
||||
private ItemStack itemStack = ItemStack.EMPTY;
|
||||
private long timeLastChange;
|
||||
private long period;
|
||||
|
||||
public CreativeTabAbstractBase(final String label, final long period) {
|
||||
super(label);
|
||||
this.period = period;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
final long timeCurrent = System.currentTimeMillis();
|
||||
if (timeLastChange < timeCurrent) {
|
||||
timeLastChange = timeCurrent + period;
|
||||
itemStack = getTabIconItem();
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
}
|
36
src/main/java/cr0s/warpdrive/client/CreativeTabHull.java
Normal file
36
src/main/java/cr0s/warpdrive/client/CreativeTabHull.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package cr0s.warpdrive.client;
|
||||
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class CreativeTabHull extends CreativeTabAbstractBase {
|
||||
|
||||
public CreativeTabHull(final String label) {
|
||||
super(label, 1618);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getTabIconItem() {
|
||||
final int tier = random.nextInt(3);
|
||||
final int metadata = random.nextInt(16);
|
||||
switch (random.nextInt(6)) {
|
||||
case 0: return new ItemStack(WarpDrive.blockHulls_plain[tier][0], 1, metadata);
|
||||
case 1: return new ItemStack(WarpDrive.blockHulls_plain[tier][1], 1, metadata);
|
||||
case 2: return new ItemStack(WarpDrive.blockHulls_glass[tier], 1, metadata);
|
||||
case 3: return new ItemStack(WarpDrive.blockHulls_slab[tier][metadata], 1, 0);
|
||||
case 4: return new ItemStack(WarpDrive.blockHulls_slab[tier][metadata], 1, 2);
|
||||
case 5: return new ItemStack(WarpDrive.blockHulls_stairs[tier][metadata], 1);
|
||||
case 6: return new ItemStack(WarpDrive.blockHulls_omnipanel[tier], 1, metadata);
|
||||
}
|
||||
return new ItemStack(Blocks.OBSIDIAN, 1);
|
||||
}
|
||||
}
|
24
src/main/java/cr0s/warpdrive/client/CreativeTabMain.java
Normal file
24
src/main/java/cr0s/warpdrive/client/CreativeTabMain.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package cr0s.warpdrive.client;
|
||||
|
||||
import cr0s.warpdrive.item.ItemShipToken;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class CreativeTabMain extends CreativeTabAbstractBase {
|
||||
|
||||
public CreativeTabMain(final String label) {
|
||||
super(label, 2861);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getTabIconItem() {
|
||||
return ItemShipToken.getItemStack(random);
|
||||
}
|
||||
}
|
|
@ -26,7 +26,7 @@ public class ItemAbstractBase extends Item implements IItemBase {
|
|||
public ItemAbstractBase(final String registryName) {
|
||||
super();
|
||||
setRegistryName(registryName);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
setCreativeTab(WarpDrive.creativeTabMain);
|
||||
WarpDrive.register(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,10 @@ import cr0s.warpdrive.Commons;
|
|||
import cr0s.warpdrive.WarpDrive;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
@ -28,11 +26,15 @@ public class ItemShipToken extends ItemAbstractBase {
|
|||
super(registryName);
|
||||
setHasSubtypes(true);
|
||||
setUnlocalizedName("warpdrive.tool.ship_token");
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
setCreativeTab(WarpDrive.creativeTabMain);
|
||||
|
||||
itemStackCache = new ItemStack[VALID_METADATAS.length];
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(final Random random) {
|
||||
return getItemStack(VALID_METADATAS[random.nextInt(VALID_METADATAS.length)]);
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(final int metadataWanted) {
|
||||
for (int index = 0; index < VALID_METADATAS.length; index++) {
|
||||
if (metadataWanted == VALID_METADATAS[index]) {
|
||||
|
|
|
@ -18,7 +18,6 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
|||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -48,7 +47,7 @@ public class ItemTuningDriver extends ItemAbstractBase implements IWarpTool {
|
|||
public ItemTuningDriver(final String registryName) {
|
||||
super(registryName);
|
||||
setMaxDamage(0);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
setCreativeTab(WarpDrive.creativeTabMain);
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName("warpdrive.tool.tuning_driver");
|
||||
setFull3D();
|
||||
|
|
|
@ -19,7 +19,7 @@ public class ItemWarpArmor extends ItemArmor implements IBreathingHelmet {
|
|||
super(armorMaterial, renderIndex, entityEquipmentSlot);
|
||||
setUnlocalizedName("warpdrive.armor." + suffixes[entityEquipmentSlot.getIndex()]);
|
||||
setRegistryName(registryName);
|
||||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
setCreativeTab(WarpDrive.creativeTabMain);
|
||||
WarpDrive.register(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@ death.attack.warpdrive.teleportation.player=%1$s wurde durch %2$s beim teleporti
|
|||
death.attack.warpdrive.warm=%1$s verglühte
|
||||
death.attack.warpdrive.warm.player=%1$s wurde von %2$s gebruzelt
|
||||
|
||||
itemGroup.warpdrive=WarpDrive
|
||||
itemGroup.warpdrive.hull=WarpDrive (hull)
|
||||
itemGroup.warpdrive.main=WarpDrive (main)
|
||||
|
||||
item.warpdrive.component.malformed.name=Fehlerhaftes Item
|
||||
item.warpdrive.component.emerald_crystal.name=Smaragdkristall
|
||||
|
|
|
@ -14,7 +14,8 @@ death.attack.warpdrive.teleportation.player=%1$s was teleporkilled by %2$s
|
|||
death.attack.warpdrive.warm=%1$s died from excessive temperature
|
||||
death.attack.warpdrive.warm.player=%1$s was cooked by %2$s
|
||||
|
||||
itemGroup.warpdrive=WarpDrive
|
||||
itemGroup.warpdrive.hull=WarpDrive (hull)
|
||||
itemGroup.warpdrive.main=WarpDrive (main)
|
||||
|
||||
item.warpdrive.component.malformed.name=Bad Item
|
||||
item.warpdrive.component.emerald_crystal.name=Emerald Tuned Crystal
|
||||
|
|
|
@ -14,7 +14,8 @@ death.attack.warpdrive.teleportation.player=%1$s a été tué par %2$s durant sa
|
|||
death.attack.warpdrive.warm=%1$s est mort de brûlure sévère
|
||||
death.attack.warpdrive.warm.player=%1$s a été cuit par %2$s
|
||||
|
||||
itemGroup.warpdrive=WarpDrive
|
||||
itemGroup.warpdrive.hull=WarpDrive (hull)
|
||||
itemGroup.warpdrive.main=WarpDrive (main)
|
||||
|
||||
item.warpdrive.component.malformed.name=Item invalide
|
||||
item.warpdrive.component.emerald_crystal.name=Cristal d'émeraude accordé
|
||||
|
|
|
@ -14,7 +14,8 @@ death.attack.warpdrive.teleportation.player=%1$s was gedoos door teleportatie va
|
|||
death.attack.warpdrive.warm=%1$s is doodgegaan door oververhitting
|
||||
death.attack.warpdrive.warm.player=%1$s is gekookt door %2$s
|
||||
|
||||
itemGroup.warpdrive=WarpDrive
|
||||
itemGroup.warpdrive.hull=WarpDrive (hull)
|
||||
itemGroup.warpdrive.main=WarpDrive (main)
|
||||
|
||||
item.warpdrive.component.malformed.name=Verkeerd item
|
||||
item.warpdrive.component.emerald_crystal.name=Smaragd afgestemd kristal
|
||||
|
|
|
@ -14,7 +14,8 @@ death.attack.warpdrive.teleportation.player=%2$s убил %1$s телепорт
|
|||
death.attack.warpdrive.warm=%1$s died from excessive temperature
|
||||
death.attack.warpdrive.warm.player=%1$s was cooked by %2$s
|
||||
|
||||
itemGroup.warpdrive=WarpDrive
|
||||
itemGroup.warpdrive.hull=WarpDrive (hull)
|
||||
itemGroup.warpdrive.main=WarpDrive (main)
|
||||
|
||||
item.warpdrive.component.malformed.name=Поврежденный предмет
|
||||
item.warpdrive.component.emerald_crystal.name=Изумрудный настраиваемый кристалл
|
||||
|
|
|
@ -14,7 +14,8 @@ death.attack.warpdrive.teleportation.player=%2$s传送%1$s时“失误”了
|
|||
death.attack.warpdrive.warm=%1$s死于高温
|
||||
death.attack.warpdrive.warm.player=%1$s被%2$s煮熟了
|
||||
|
||||
itemGroup.warpdrive=曲率驱动
|
||||
itemGroup.warpdrive.hull=曲率驱动 (hull)
|
||||
itemGroup.warpdrive.main=曲率驱动 (main)
|
||||
|
||||
item.warpdrive.component.malformed.name=畸变废品
|
||||
item.warpdrive.component.emerald_crystal.name=绿宝石调谐水晶
|
||||
|
|
|
@ -14,7 +14,8 @@ death.attack.warpdrive.teleportation.player=%2$s 對 %1$s 使出了超時空傳
|
|||
death.attack.warpdrive.warm=%1$s 在傳送中失去聯係了
|
||||
death.attack.warpdrive.warm.player=%2$s 把 %1$s 變成了綠色香蕉
|
||||
|
||||
itemGroup.warpdrive=WarpDrive
|
||||
itemGroup.warpdrive.hull=WarpDrive (hull)
|
||||
itemGroup.warpdrive.main=WarpDrive (main)
|
||||
|
||||
item.warpdrive.component.malformed.name=不良道具[WD]
|
||||
item.warpdrive.component.emerald_crystal.name=翡翠調諧水晶
|
||||
|
|
Loading…
Reference in a new issue