Code cleanup

This commit is contained in:
Unknown 2019-04-22 12:39:27 +02:00 committed by unknown
parent 8e9d2822ea
commit 57a2c222f1
49 changed files with 397 additions and 319 deletions

View file

@ -12,6 +12,7 @@ import cr0s.warpdrive.event.ChunkHandler;
import cr0s.warpdrive.world.SpaceTeleporter; import cr0s.warpdrive.world.SpaceTeleporter;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid; import net.minecraft.block.BlockLiquid;
@ -100,7 +101,8 @@ public class Commons {
} }
@SuppressWarnings("ConstantConditions") // IDE says "§" == CHAR_FORMATTING, execution says otherwise @SuppressWarnings("ConstantConditions") // IDE says "§" == CHAR_FORMATTING, execution says otherwise
public static String updateEscapeCodes(final String message) { @Nonnull
public static String updateEscapeCodes(@Nonnull final String message) {
return message return message
.replace("§", CHAR_FORMATTING) .replace("§", CHAR_FORMATTING)
.replace("\\n", "\n") .replace("\\n", "\n")
@ -108,7 +110,8 @@ public class Commons {
.replaceAll("\u00A0", " "); // u00A0 is 'NO-BREAK SPACE' .replaceAll("\u00A0", " "); // u00A0 is 'NO-BREAK SPACE'
} }
public static String removeFormatting(final String message) { @Nonnull
public static String removeFormatting(@Nonnull final String message) {
return updateEscapeCodes(message) return updateEscapeCodes(message)
.replaceAll("(" + CHAR_FORMATTING + ".)", ""); .replaceAll("(" + CHAR_FORMATTING + ".)", "");
} }
@ -127,7 +130,8 @@ public class Commons {
} }
// inspired by FontRender.getFormatFromString // inspired by FontRender.getFormatFromString
private static String getFormatFromString(final String message) { @Nonnull
private static String getFormatFromString(@Nonnull final String message) {
final int indexLastChar = message.length() - 1; final int indexLastChar = message.length() - 1;
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
int indexEscapeCode = -1; int indexEscapeCode = -1;
@ -153,22 +157,33 @@ public class Commons {
public static Style styleValue = new Style().setColor(TextFormatting.YELLOW); public static Style styleValue = new Style().setColor(TextFormatting.YELLOW);
public static Style styleVoltage = new Style().setColor(TextFormatting.DARK_GREEN); public static Style styleVoltage = new Style().setColor(TextFormatting.DARK_GREEN);
public static WarpDriveText getChatPrefix(final Block block) { @Nonnull
public static WarpDriveText getChatPrefix(@Nonnull final Block block) {
return getChatPrefix(block.getTranslationKey() + ".name"); return getChatPrefix(block.getTranslationKey() + ".name");
} }
public static WarpDriveText getChatPrefix(final ItemStack itemStack) { @Nonnull
public static WarpDriveText getChatPrefix(@Nonnull final ItemStack itemStack) {
return getChatPrefix(itemStack.getTranslationKey() + ".name"); return getChatPrefix(itemStack.getTranslationKey() + ".name");
} }
public static WarpDriveText getChatPrefix(final String translationKey) { @Nonnull
return new WarpDriveText(styleHeader, "warpdrive.guide.prefix", new TextComponentTranslation(translationKey)); public static WarpDriveText getChatPrefix(@Nonnull final String translationKey) {
return new WarpDriveText(styleHeader, "warpdrive.guide.prefix",
new TextComponentTranslation(translationKey));
} }
public static void addChatMessage(final ICommandSender commandSender, final ITextComponent textComponent) { @Nonnull
public static WarpDriveText getNamedPrefix(@Nonnull final String name) {
return new WarpDriveText(styleHeader, "warpdrive.guide.prefix",
new TextComponentString(name));
}
public static void addChatMessage(final ICommandSender commandSender, @Nonnull final ITextComponent textComponent) {
final String message = textComponent.getFormattedText(); final String message = textComponent.getFormattedText();
if (commandSender == null) { if (commandSender == null) {
WarpDrive.logger.error(String.format("Unable to send message to NULL sender: %s", message)); WarpDrive.logger.error(String.format("Unable to send message to NULL sender: %s",
message));
return; return;
} }
@ -187,17 +202,17 @@ public class Commons {
// add tooltip information with text formatting and line splitting // add tooltip information with text formatting and line splitting
// will ensure it fits on minimum screen width // will ensure it fits on minimum screen width
public static void addTooltip(final List<String> list, final String tooltip) { public static void addTooltip(final List<String> list, @Nonnull final String tooltip) {
// skip empty tooltip // skip empty tooltip
if (tooltip.isEmpty()) { if (tooltip.isEmpty()) {
return; return;
} }
// apply requested formatting // apply requested formatting
final String[] split = updateEscapeCodes(tooltip).split("\n"); final String[] lines = updateEscapeCodes(tooltip).split("\n");
// add new lines // add new lines
for (final String line : split) { for (final String line : lines) {
// skip redundant information // skip redundant information
boolean isExisting = false; boolean isExisting = false;
final String cleanToAdd = removeFormatting(line).trim().toLowerCase(); final String cleanToAdd = removeFormatting(line).trim().toLowerCase();
@ -288,6 +303,7 @@ public class Commons {
return String.format("%,d", Math.round(value)); return String.format("%,d", Math.round(value));
} }
@Nonnull
public static String format(final Object[] arguments) { public static String format(final Object[] arguments) {
final StringBuilder result = new StringBuilder(); final StringBuilder result = new StringBuilder();
if (arguments != null && arguments.length > 0) { if (arguments != null && arguments.length > 0) {
@ -305,6 +321,7 @@ public class Commons {
return result.toString(); return result.toString();
} }
@Nonnull
public static String format(final World world) { public static String format(final World world) {
if (world == null) { if (world == null) {
return "~NULL~"; return "~NULL~";
@ -360,7 +377,7 @@ public class Commons {
x, y, z); x, y, z);
} }
public static String format(final ItemStack itemStack) { public static String format(@Nonnull final ItemStack itemStack) {
final String stringNBT; final String stringNBT;
if (itemStack.hasTagCompound()) { if (itemStack.hasTagCompound()) {
stringNBT = " " + itemStack.getTagCompound(); stringNBT = " " + itemStack.getTagCompound();
@ -382,7 +399,7 @@ public class Commons {
.replace("\\", "."); .replace("\\", ".");
} }
public static ItemStack copyWithSize(final ItemStack itemStack, final int newSize) { public static ItemStack copyWithSize(@Nonnull final ItemStack itemStack, final int newSize) {
final ItemStack ret = itemStack.copy(); final ItemStack ret = itemStack.copy();
ret.setCount(newSize); ret.setCount(newSize);
return ret; return ret;
@ -472,8 +489,10 @@ public class Commons {
return iterated; return iterated;
} }
public static Set<BlockStatePos> getConnectedBlockStatePos(final IBlockAccess blockAccess, final Collection<BlockPos> start, final VectorI[] directions, @Nonnull
final Set<Block> blockConnecting, final Set<Block> blockResults, final int maxRange) { public static Set<BlockStatePos> getConnectedBlockStatePos(@Nonnull final IBlockAccess blockAccess, @Nonnull final Collection<BlockPos> start,
@Nonnull final VectorI[] directions, @Nonnull final Set<Block> blockConnecting,
@Nonnull final Set<Block> blockResults, final int maxRange) {
Set<BlockPos> toIterate = new HashSet<>(start.size() * 4); Set<BlockPos> toIterate = new HashSet<>(start.size() * 4);
final Set<BlockPos> blockPosIterated = new HashSet<>(64); final Set<BlockPos> blockPosIterated = new HashSet<>(64);
final Set<BlockStatePos> blockStatePosResults = new HashSet<>(64); final Set<BlockStatePos> blockStatePosResults = new HashSet<>(64);
@ -602,7 +621,7 @@ public class Commons {
// configurable interpolation // configurable interpolation
public static double interpolate(final double[] xValues, final double[] yValues, final double xInput) { public static double interpolate(@Nonnull final double[] xValues, @Nonnull final double[] yValues, final double xInput) {
if (WarpDrive.isDev) { if (WarpDrive.isDev) {
assert xValues.length == yValues.length; assert xValues.length == yValues.length;
assert xValues.length > 1; assert xValues.length > 1;
@ -627,7 +646,7 @@ public class Commons {
return yMin + (x - xMin) * (yMax - yMin) / (xMax - xMin); return yMin + (x - xMin) * (yMax - yMin) / (xMax - xMin);
} }
public static EnumFacing getHorizontalDirectionFromEntity(final EntityLivingBase entityLiving) { public static EnumFacing getHorizontalDirectionFromEntity(@Nullable final EntityLivingBase entityLiving) {
if (entityLiving != null) { if (entityLiving != null) {
final int direction = Math.round(entityLiving.rotationYaw / 90.0F) & 3; final int direction = Math.round(entityLiving.rotationYaw / 90.0F) & 3;
switch (direction) { switch (direction) {
@ -645,7 +664,7 @@ public class Commons {
return EnumFacing.NORTH; return EnumFacing.NORTH;
} }
public static EnumFacing getFacingFromEntity(final EntityLivingBase entityLivingBase) { public static EnumFacing getFacingFromEntity(@Nullable final EntityLivingBase entityLivingBase) {
if (entityLivingBase != null) { if (entityLivingBase != null) {
final EnumFacing facing; final EnumFacing facing;
if (entityLivingBase.rotationPitch > 45) { if (entityLivingBase.rotationPitch > 45) {
@ -715,6 +734,7 @@ public class Commons {
WarpDrive.logger.error(stringBuilder.toString()); WarpDrive.logger.error(stringBuilder.toString());
} }
@Nonnull
public static String getMethodName(final int depth) { public static String getMethodName(final int depth) {
try { try {
final StackTraceElement stackTraceElement = (StackTraceElement) methodThrowable_getStackTraceElement.invoke( final StackTraceElement stackTraceElement = (StackTraceElement) methodThrowable_getStackTraceElement.invoke(
@ -726,7 +746,7 @@ public class Commons {
} }
} }
public static void writeNBTToFile(final String fileName, final NBTTagCompound tagCompound) { public static void writeNBTToFile(@Nonnull final String fileName, @Nonnull final NBTTagCompound tagCompound) {
if (WarpDrive.isDev) { if (WarpDrive.isDev) {
WarpDrive.logger.info(String.format("writeNBTToFile %s", WarpDrive.logger.info(String.format("writeNBTToFile %s",
fileName)); fileName));
@ -749,7 +769,7 @@ public class Commons {
} }
} }
public static NBTTagCompound readNBTFromFile(final String fileName) { public static NBTTagCompound readNBTFromFile(@Nonnull final String fileName) {
if (WarpDrive.isDev) { if (WarpDrive.isDev) {
WarpDrive.logger.info(String.format("readNBTFromFile %s", fileName)); WarpDrive.logger.info(String.format("readNBTFromFile %s", fileName));
} }
@ -773,21 +793,21 @@ public class Commons {
return null; return null;
} }
public static BlockPos createBlockPosFromNBT(final NBTTagCompound tagCompound) { public static BlockPos createBlockPosFromNBT(@Nonnull final NBTTagCompound tagCompound) {
final int x = tagCompound.getInteger("x"); final int x = tagCompound.getInteger("x");
final int y = tagCompound.getInteger("y"); final int y = tagCompound.getInteger("y");
final int z = tagCompound.getInteger("z"); final int z = tagCompound.getInteger("z");
return new BlockPos(x, y, z); return new BlockPos(x, y, z);
} }
public static NBTTagCompound writeBlockPosToNBT(final BlockPos blockPos, final NBTTagCompound tagCompound) { public static NBTTagCompound writeBlockPosToNBT(@Nonnull final BlockPos blockPos, @Nonnull final NBTTagCompound tagCompound) {
tagCompound.setInteger("x", blockPos.getX()); tagCompound.setInteger("x", blockPos.getX());
tagCompound.setInteger("y", blockPos.getY()); tagCompound.setInteger("y", blockPos.getY());
tagCompound.setInteger("z", blockPos.getZ()); tagCompound.setInteger("z", blockPos.getZ());
return tagCompound; return tagCompound;
} }
public static EntityPlayerMP[] getOnlinePlayerByNameOrSelector(final ICommandSender commandSender, final String playerNameOrSelector) { public static EntityPlayerMP[] getOnlinePlayerByNameOrSelector(@Nonnull final ICommandSender commandSender, final String playerNameOrSelector) {
final MinecraftServer server = commandSender.getServer(); final MinecraftServer server = commandSender.getServer();
assert server != null; assert server != null;
final List<EntityPlayerMP> onlinePlayers = server.getPlayerList().getPlayers(); final List<EntityPlayerMP> onlinePlayers = server.getPlayerList().getPlayers();
@ -834,7 +854,7 @@ public class Commons {
} }
} }
public static void messageToAllPlayersInArea(final IStarMapRegistryTileEntity tileEntity, final WarpDriveText textComponent) { public static void messageToAllPlayersInArea(@Nonnull final IStarMapRegistryTileEntity tileEntity, @Nonnull final WarpDriveText textComponent) {
assert tileEntity instanceof TileEntity; assert tileEntity instanceof TileEntity;
final AxisAlignedBB starMapArea = tileEntity.getStarMapArea(); final AxisAlignedBB starMapArea = tileEntity.getStarMapArea();
final ITextComponent messageFormatted = Commons.getChatPrefix(tileEntity.getStarMapName()) final ITextComponent messageFormatted = Commons.getChatPrefix(tileEntity.getStarMapName())
@ -851,7 +871,7 @@ public class Commons {
} }
} }
public static void moveEntity(final Entity entity, final World worldDestination, final Vector3 v3Destination) { public static void moveEntity(@Nonnull final Entity entity, @Nonnull final World worldDestination, @Nonnull final Vector3 v3Destination) {
if (entity.world.isRemote) { if (entity.world.isRemote) {
WarpDrive.logger.error(String.format("Skipping remote movement for entity %s destination %s", WarpDrive.logger.error(String.format("Skipping remote movement for entity %s destination %s",
entity, Commons.format(worldDestination, v3Destination) )); entity, Commons.format(worldDestination, v3Destination) ));
@ -913,10 +933,10 @@ public class Commons {
// server side version of EntityLivingBase.rayTrace // server side version of EntityLivingBase.rayTrace
private static final double BLOCK_REACH_DISTANCE = 5.0D; // this is a client side hardcoded value, applicable to creative players private static final double BLOCK_REACH_DISTANCE = 5.0D; // this is a client side hardcoded value, applicable to creative players
public static RayTraceResult getInteractingBlock(final World world, final EntityPlayer entityPlayer) { public static RayTraceResult getInteractingBlock(@Nonnull final World world, @Nonnull final EntityPlayer entityPlayer) {
return getInteractingBlock(world, entityPlayer, BLOCK_REACH_DISTANCE); return getInteractingBlock(world, entityPlayer, BLOCK_REACH_DISTANCE);
} }
public static RayTraceResult getInteractingBlock(final World world, final EntityPlayer entityPlayer, final double distance) { public static RayTraceResult getInteractingBlock(@Nonnull final World world, @Nonnull final EntityPlayer entityPlayer, final double distance) {
final Vec3d vec3Position = new Vec3d(entityPlayer.posX, entityPlayer.posY + entityPlayer.eyeHeight, entityPlayer.posZ); final Vec3d vec3Position = new Vec3d(entityPlayer.posX, entityPlayer.posY + entityPlayer.eyeHeight, entityPlayer.posZ);
final Vec3d vec3Look = entityPlayer.getLook(1.0F); final Vec3d vec3Look = entityPlayer.getLook(1.0F);
final Vec3d vec3Target = vec3Position.add(vec3Look.x * distance, vec3Look.y * distance, vec3Look.z * distance); final Vec3d vec3Target = vec3Position.add(vec3Look.x * distance, vec3Look.y * distance, vec3Look.z * distance);
@ -929,7 +949,7 @@ public class Commons {
// We're remapping it using unlocalized names, since those don't change // We're remapping it using unlocalized names, since those don't change
private static HashMap<String, Fluid> fluidByBlockName; private static HashMap<String, Fluid> fluidByBlockName;
public static Fluid fluid_getByBlock(final Block block) { public static Fluid fluid_getByBlock(@Nonnull final Block block) {
// validate context // validate context
if (!(block instanceof BlockLiquid)) { if (!(block instanceof BlockLiquid)) {
// if (WarpDrive.isDev) { // if (WarpDrive.isDev) {
@ -964,14 +984,14 @@ public class Commons {
return EnumFacing.byIndex(index); return EnumFacing.byIndex(index);
} }
public static int getOrdinal(final EnumFacing direction) { public static int getOrdinal(@Nullable final EnumFacing direction) {
if (direction == null) { if (direction == null) {
return 6; return 6;
} }
return direction.ordinal(); return direction.ordinal();
} }
public static boolean isValidCamouflage(final IBlockState blockState) { public static boolean isValidCamouflage(@Nullable final IBlockState blockState) {
// fast check // fast check
if ( blockState == null if ( blockState == null
|| blockState == Blocks.AIR || blockState == Blocks.AIR
@ -1021,7 +1041,7 @@ public class Commons {
return true; return true;
} }
public static IBlockState getBlockState_noChunkLoading(final IBlockAccess blockAccess, final BlockPos blockPos) { public static IBlockState getBlockState_noChunkLoading(@Nullable final IBlockAccess blockAccess, @Nonnull final BlockPos blockPos) {
// skip unloaded worlds // skip unloaded worlds
if (blockAccess == null) { if (blockAccess == null) {
return null; return null;
@ -1033,7 +1053,7 @@ public class Commons {
return blockAccess.getBlockState(blockPos); return blockAccess.getBlockState(blockPos);
} }
public static boolean isReplaceableOreGen(final World world, final BlockPos blockPos) { public static boolean isReplaceableOreGen(@Nonnull final World world, @Nonnull final BlockPos blockPos) {
final IBlockState blockStateActual = world.getBlockState(blockPos); final IBlockState blockStateActual = world.getBlockState(blockPos);
final Block blockActual = blockStateActual.getBlock(); final Block blockActual = blockStateActual.getBlock();
return blockActual.isReplaceableOreGen(blockStateActual, world, blockPos, return blockActual.isReplaceableOreGen(blockStateActual, world, blockPos,

View file

@ -184,6 +184,7 @@ import org.apache.logging.log4j.Logger;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@Mod(modid = WarpDrive.MODID, @Mod(modid = WarpDrive.MODID,
@ -288,6 +289,7 @@ public class WarpDrive {
public static DamageTeleportation damageTeleportation; public static DamageTeleportation damageTeleportation;
public static DamageWarm damageWarm; public static DamageWarm damageWarm;
// world generation
public static Biome biomeSpace; public static Biome biomeSpace;
public static DimensionType dimensionTypeSpace; public static DimensionType dimensionTypeSpace;
public static DimensionType dimensionTypeHyperSpace; public static DimensionType dimensionTypeHyperSpace;
@ -776,19 +778,19 @@ public class WarpDrive {
final public static ArrayList<VillagerProfession> villagerProfessions = new ArrayList<>(10); final public static ArrayList<VillagerProfession> villagerProfessions = new ArrayList<>(10);
// Register a Biome. // Register a Biome.
public static <BIOME extends Biome> BIOME register(final BIOME biome) { public static <BIOME extends Biome> BIOME register(@Nonnull final BIOME biome) {
biomes.add(biome); biomes.add(biome);
return biome; return biome;
} }
// Register a Block with the default ItemBlock class. // Register a Block with the default ItemBlock class.
public static <BLOCK extends Block> BLOCK register(final BLOCK block) { public static <BLOCK extends Block> BLOCK register(@Nonnull final BLOCK block) {
assert block instanceof IBlockBase; assert block instanceof IBlockBase;
return register(block, ((IBlockBase) block).createItemBlock()); return register(block, ((IBlockBase) block).createItemBlock());
} }
// Register a Block with a custom ItemBlock class. // Register a Block with a custom ItemBlock class.
public static <BLOCK extends Block> BLOCK register(final BLOCK block, @Nullable final ItemBlock itemBlock) { public static <BLOCK extends Block> BLOCK register(@Nonnull final BLOCK block, @Nullable final ItemBlock itemBlock) {
final ResourceLocation resourceLocation = block.getRegistryName(); final ResourceLocation resourceLocation = block.getRegistryName();
if (resourceLocation == null) { if (resourceLocation == null) {
WarpDrive.logger.error(String.format("Missing registry name for block %s, ignoring registration...", WarpDrive.logger.error(String.format("Missing registry name for block %s, ignoring registration...",
@ -807,34 +809,34 @@ public class WarpDrive {
} }
// Register an Enchantment. // Register an Enchantment.
public static <ENCHANTMENT extends Enchantment> ENCHANTMENT register(final ENCHANTMENT enchantment) { public static <ENCHANTMENT extends Enchantment> ENCHANTMENT register(@Nonnull final ENCHANTMENT enchantment) {
enchantments.add(enchantment); enchantments.add(enchantment);
return enchantment; return enchantment;
} }
// Register an Item. // Register an Item.
public static <ITEM extends Item> ITEM register(final ITEM item) { public static <ITEM extends Item> ITEM register(@Nonnull final ITEM item) {
items.add(item); items.add(item);
return item; return item;
} }
// Register an Potion. // Register an Potion.
public static <POTION extends Potion> POTION register(final POTION potion) { public static <POTION extends Potion> POTION register(@Nonnull final POTION potion) {
potions.add(potion); potions.add(potion);
return potion; return potion;
} }
// Register an PotionType. // Register an PotionType.
public static <POTION_TYPE extends PotionType> POTION_TYPE register(final POTION_TYPE potionType) { public static <POTION_TYPE extends PotionType> POTION_TYPE register(@Nonnull final POTION_TYPE potionType) {
potionTypes.add(potionType); potionTypes.add(potionType);
return potionType; return potionType;
} }
// Register a recipe. // Register a recipe.
public static <RECIPE extends IRecipe> RECIPE register(final RECIPE recipe) { public static <RECIPE extends IRecipe> RECIPE register(@Nonnull final RECIPE recipe) {
return register(recipe, ""); return register(recipe, "");
} }
public static <RECIPE extends IRecipe> RECIPE register(final RECIPE recipe, final String suffix) { public static <RECIPE extends IRecipe> RECIPE register(@Nonnull final RECIPE recipe, final String suffix) {
ResourceLocation registryName = recipe.getRegistryName(); ResourceLocation registryName = recipe.getRegistryName();
if (registryName == null) { if (registryName == null) {
final String path; final String path;
@ -874,19 +876,19 @@ public class WarpDrive {
} }
// Register a SoundEvent. // Register a SoundEvent.
public static <SOUND_EVENT extends SoundEvent> SOUND_EVENT register(final SOUND_EVENT soundEvent) { public static <SOUND_EVENT extends SoundEvent> SOUND_EVENT register(@Nonnull final SOUND_EVENT soundEvent) {
soundEvents.add(soundEvent); soundEvents.add(soundEvent);
return soundEvent; return soundEvent;
} }
// Register a VillagerProfession. // Register a VillagerProfession.
public static <VILLAGER_PROFESSION extends VillagerProfession> VILLAGER_PROFESSION register(final VILLAGER_PROFESSION villagerProfession) { public static <VILLAGER_PROFESSION extends VillagerProfession> VILLAGER_PROFESSION register(@Nonnull final VILLAGER_PROFESSION villagerProfession) {
villagerProfessions.add(villagerProfession); villagerProfessions.add(villagerProfession);
return villagerProfession; return villagerProfession;
} }
@SubscribeEvent @SubscribeEvent
public void onRegisterBiomes(final RegistryEvent.Register<Biome> event) { public void onRegisterBiomes(@Nonnull final RegistryEvent.Register<Biome> event) {
WarpDrive.logger.debug(String.format("Registering %s", event.getName())); WarpDrive.logger.debug(String.format("Registering %s", event.getName()));
for (final Biome biome : biomes) { for (final Biome biome : biomes) {
event.getRegistry().register(biome); event.getRegistry().register(biome);
@ -896,7 +898,7 @@ public class WarpDrive {
} }
@SubscribeEvent @SubscribeEvent
public void onRegisterBlocks(final RegistryEvent.Register<Block> event) { public void onRegisterBlocks(@Nonnull final RegistryEvent.Register<Block> event) {
WarpDrive.logger.debug(String.format("Registering %s", event.getName())); WarpDrive.logger.debug(String.format("Registering %s", event.getName()));
for (final Block block : blocks) { for (final Block block : blocks) {
event.getRegistry().register(block); event.getRegistry().register(block);
@ -936,7 +938,7 @@ public class WarpDrive {
} }
@SubscribeEvent @SubscribeEvent
public void onRegisterEnchantments(final RegistryEvent.Register<Enchantment> event) { public void onRegisterEnchantments(@Nonnull final RegistryEvent.Register<Enchantment> event) {
WarpDrive.logger.debug(String.format("Registering %s", event.getName())); WarpDrive.logger.debug(String.format("Registering %s", event.getName()));
for (final Enchantment enchantment : enchantments) { for (final Enchantment enchantment : enchantments) {
event.getRegistry().register(enchantment); event.getRegistry().register(enchantment);
@ -944,7 +946,7 @@ public class WarpDrive {
} }
@SubscribeEvent @SubscribeEvent
public void onRegisterEntities(final RegistryEvent.Register<EntityEntry> event) { public void onRegisterEntities(@Nonnull final RegistryEvent.Register<EntityEntry> event) {
WarpDrive.logger.debug(String.format("Registering %s", event.getName())); WarpDrive.logger.debug(String.format("Registering %s", event.getName()));
EntityEntry entityEntry; EntityEntry entityEntry;
@ -979,7 +981,7 @@ public class WarpDrive {
} }
@SubscribeEvent @SubscribeEvent
public void onRegisterItems(final RegistryEvent.Register<Item> event) { public void onRegisterItems(@Nonnull final RegistryEvent.Register<Item> event) {
WarpDrive.logger.debug(String.format("Registering %s", event.getName())); WarpDrive.logger.debug(String.format("Registering %s", event.getName()));
for (final Item item : items) { for (final Item item : items) {
event.getRegistry().register(item); event.getRegistry().register(item);
@ -991,7 +993,7 @@ public class WarpDrive {
} }
@SubscribeEvent @SubscribeEvent
public void onRegisterPotions(final RegistryEvent.Register<Potion> event) { public void onRegisterPotions(@Nonnull final RegistryEvent.Register<Potion> event) {
WarpDrive.logger.debug(String.format("Registering %s", event.getName())); WarpDrive.logger.debug(String.format("Registering %s", event.getName()));
for (final Potion potion : potions) { for (final Potion potion : potions) {
event.getRegistry().register(potion); event.getRegistry().register(potion);
@ -999,7 +1001,7 @@ public class WarpDrive {
} }
@SubscribeEvent @SubscribeEvent
public void onRegisterPotionTypes(final RegistryEvent.Register<PotionType> event) { public void onRegisterPotionTypes(@Nonnull final RegistryEvent.Register<PotionType> event) {
WarpDrive.logger.debug(String.format("Registering %s", event.getName())); WarpDrive.logger.debug(String.format("Registering %s", event.getName()));
for (final PotionType potionType : potionTypes) { for (final PotionType potionType : potionTypes) {
event.getRegistry().register(potionType); event.getRegistry().register(potionType);
@ -1007,7 +1009,7 @@ public class WarpDrive {
} }
@SubscribeEvent @SubscribeEvent
public void onRegisterRecipes(final RegistryEvent.Register<IRecipe> event) { public void onRegisterRecipes(@Nonnull final RegistryEvent.Register<IRecipe> event) {
WarpDrive.logger.debug(String.format("Registering %s", event.getName())); WarpDrive.logger.debug(String.format("Registering %s", event.getName()));
Recipes.initOreDictionary(); Recipes.initOreDictionary();
@ -1020,7 +1022,7 @@ public class WarpDrive {
} }
@SubscribeEvent @SubscribeEvent
public void onRegisterSoundEvents(final RegistryEvent.Register<SoundEvent> event) { public void onRegisterSoundEvents(@Nonnull final RegistryEvent.Register<SoundEvent> event) {
WarpDrive.logger.debug(String.format("Registering %s", event.getName())); WarpDrive.logger.debug(String.format("Registering %s", event.getName()));
cr0s.warpdrive.data.SoundEvents.registerSounds(); cr0s.warpdrive.data.SoundEvents.registerSounds();
for (final SoundEvent soundEvent : soundEvents) { for (final SoundEvent soundEvent : soundEvents) {
@ -1029,7 +1031,7 @@ public class WarpDrive {
} }
@SubscribeEvent @SubscribeEvent
public void onRegisterVillagerProfessions(final RegistryEvent.Register<VillagerProfession> event) { public void onRegisterVillagerProfessions(@Nonnull final RegistryEvent.Register<VillagerProfession> event) {
WarpDrive.logger.debug(String.format("Registering %s", event.getName())); WarpDrive.logger.debug(String.format("Registering %s", event.getName()));
for (final VillagerProfession villagerProfession : villagerProfessions) { for (final VillagerProfession villagerProfession : villagerProfessions) {
event.getRegistry().register(villagerProfession); event.getRegistry().register(villagerProfession);

View file

@ -62,6 +62,7 @@ public abstract class BlockAbstractBase extends Block implements IBlockBase {
// Force a single model through a custom state mapper // Force a single model through a custom state mapper
final StateMapperBase stateMapperBase = new StateMapperBase() { final StateMapperBase stateMapperBase = new StateMapperBase() {
@Nonnull @Nonnull
@SideOnly(Side.CLIENT)
@Override @Override
protected ModelResourceLocation getModelResourceLocation(@Nonnull final IBlockState blockState) { protected ModelResourceLocation getModelResourceLocation(@Nonnull final IBlockState blockState) {
return modelResourceLocation; return modelResourceLocation;

View file

@ -108,7 +108,7 @@ public abstract class BlockAbstractContainer extends BlockContainer implements I
@Nonnull final EntityLivingBase entityLivingBase, final EnumHand enumHand) { @Nonnull final EntityLivingBase entityLivingBase, final EnumHand enumHand) {
final IBlockState blockState = super.getStateForPlacement(world, blockPos, facing, hitX, hitY, hitZ, metadata, entityLivingBase, enumHand); final IBlockState blockState = super.getStateForPlacement(world, blockPos, facing, hitX, hitY, hitZ, metadata, entityLivingBase, enumHand);
final boolean isRotating = !ignoreFacingOnPlacement final boolean isRotating = !ignoreFacingOnPlacement
&& blockState.getProperties().containsKey(BlockProperties.FACING); && blockState.getProperties().containsKey(BlockProperties.FACING);
if (isRotating) { if (isRotating) {
if (blockState.isFullBlock()) { if (blockState.isFullBlock()) {
final EnumFacing enumFacing = Commons.getFacingFromEntity(entityLivingBase); final EnumFacing enumFacing = Commons.getFacingFromEntity(entityLivingBase);
@ -153,7 +153,7 @@ public abstract class BlockAbstractContainer extends BlockContainer implements I
} }
@Override @Override
public void dropBlockAsItemWithChance(final World world, @Nonnull final BlockPos blockPos, @Nonnull final IBlockState blockState, public void dropBlockAsItemWithChance(@Nonnull final World world, @Nonnull final BlockPos blockPos, @Nonnull final IBlockState blockState,
final float chance, final int fortune) { final float chance, final int fortune) {
super.dropBlockAsItemWithChance(world, blockPos, blockState, chance, fortune); // calls getDrops() here below super.dropBlockAsItemWithChance(world, blockPos, blockState, chance, fortune); // calls getDrops() here below
if ( !world.isRemote if ( !world.isRemote
@ -222,14 +222,14 @@ public abstract class BlockAbstractContainer extends BlockContainer implements I
final ResourceLocation registryName = blockNeighbor.getRegistryName(); final ResourceLocation registryName = blockNeighbor.getRegistryName();
WarpDrive.logger.error(String.format("Bad multithreading detected from mod %s %s, please report to mod author", WarpDrive.logger.error(String.format("Bad multithreading detected from mod %s %s, please report to mod author",
registryName == null ? blockNeighbor : registryName.getNamespace(), registryName == null ? blockNeighbor : registryName.getNamespace(),
Commons.format(blockAccess, blockPosNeighbor) )); Commons.format(blockAccess, blockPosNeighbor)));
new ConcurrentModificationException().printStackTrace(); new ConcurrentModificationException().printStackTrace();
} }
return; return;
} }
final TileEntity tileEntity = blockAccess.getTileEntity(blockPos); final TileEntity tileEntity = blockAccess.getTileEntity(blockPos);
if ( tileEntity == null if (tileEntity == null
|| tileEntity.getWorld().isRemote ) { || tileEntity.getWorld().isRemote) {
return; return;
} }
if (tileEntity instanceof IBlockUpdateDetector) { if (tileEntity instanceof IBlockUpdateDetector) {
@ -263,7 +263,7 @@ public abstract class BlockAbstractContainer extends BlockContainer implements I
} }
} }
public void onEMP(final World world, final BlockPos blockPos, final float efficiency) { public void onEMP(@Nonnull final World world, @Nonnull final BlockPos blockPos, final float efficiency) {
final TileEntity tileEntity = world.getTileEntity(blockPos); final TileEntity tileEntity = world.getTileEntity(blockPos);
if (tileEntity instanceof TileEntityAbstractEnergy) { if (tileEntity instanceof TileEntityAbstractEnergy) {
final TileEntityAbstractEnergy tileEntityAbstractEnergy = (TileEntityAbstractEnergy) tileEntity; final TileEntityAbstractEnergy tileEntityAbstractEnergy = (TileEntityAbstractEnergy) tileEntity;

View file

@ -113,15 +113,15 @@ public class ItemBlockAbstractBase extends ItemBlock implements IItemBase {
ClientProxy.modelInitialisation(this); ClientProxy.modelInitialisation(this);
} }
@SideOnly(Side.CLIENT)
@Nonnull @Nonnull
@SideOnly(Side.CLIENT)
@Override @Override
public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) { public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) {
return ClientProxy.getModelResourceLocation(itemStack); return ClientProxy.getModelResourceLocation(itemStack);
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override
public void addInformation(@Nonnull final ItemStack itemStack, @Nullable final World world, public void addInformation(@Nonnull final ItemStack itemStack, @Nullable final World world,
@Nonnull final List<String> list, @Nullable final ITooltipFlag advancedItemTooltips) { @Nonnull final List<String> list, @Nullable final ITooltipFlag advancedItemTooltips) {
super.addInformation(itemStack, world, list, advancedItemTooltips); super.addInformation(itemStack, world, list, advancedItemTooltips);

View file

@ -242,6 +242,7 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
} }
} }
@Nonnull
protected WarpDriveText getStatusPrefix() { protected WarpDriveText getStatusPrefix() {
if (world != null) { if (world != null) {
final Item item = Item.getItemFromBlock(getBlockType()); final Item item = Item.getItemFromBlock(getBlockType());
@ -253,6 +254,7 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
return new WarpDriveText(); return new WarpDriveText();
} }
@Nonnull
protected WarpDriveText getBeamFrequencyStatus(final int beamFrequency) { protected WarpDriveText getBeamFrequencyStatus(final int beamFrequency) {
if (beamFrequency == -1) { if (beamFrequency == -1) {
return new WarpDriveText(Commons.styleWarning, "warpdrive.beam_frequency.status_line.undefined"); return new WarpDriveText(Commons.styleWarning, "warpdrive.beam_frequency.status_line.undefined");
@ -263,6 +265,7 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
} }
} }
@Nonnull
protected WarpDriveText getVideoChannelStatus(final int videoChannel) { protected WarpDriveText getVideoChannelStatus(final int videoChannel) {
if (videoChannel == -1) { if (videoChannel == -1) {
return new WarpDriveText(Commons.styleWarning, "warpdrive.video_channel.status_line.undefined"); return new WarpDriveText(Commons.styleWarning, "warpdrive.video_channel.status_line.undefined");

View file

@ -27,6 +27,7 @@ import li.cil.oc.api.network.Node;
import li.cil.oc.api.network.Visibility; import li.cil.oc.api.network.Visibility;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -243,7 +244,7 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
// - block connection when missing the Computer interface upgrade // - block connection when missing the Computer interface upgrade
// note: direct API calls remains possible without upgrade, as it's lore dependant // note: direct API calls remains possible without upgrade, as it's lore dependant
@Optional.Method(modid = "opencomputers") @Optional.Method(modid = "opencomputers")
protected Object[] OC_convertArgumentsAndLogCall(final Context context, final Arguments args) { protected Object[] OC_convertArgumentsAndLogCall(@Nonnull final Context context, @Nonnull final Arguments args) {
final Object[] arguments = new Object[args.count()]; final Object[] arguments = new Object[args.count()];
int index = 0; int index = 0;
for (final Object arg : args) { for (final Object arg : args) {
@ -341,7 +342,7 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
return false; return false;
} }
protected VectorI computer_getVectorI(final VectorI vDefault, final Object[] arguments) { protected VectorI computer_getVectorI(final VectorI vDefault, @Nonnull final Object[] arguments) {
try { try {
if (arguments.length == 3) { if (arguments.length == 3) {
final int x = Commons.toInt(arguments[0]); final int x = Commons.toInt(arguments[0]);
@ -355,7 +356,10 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
return vDefault; return vDefault;
} }
protected Object[] computer_getOrSetVector3(final FunctionGet<Vector3> getVector, final FunctionSetVector<Float> setVector, final Object[] arguments) { @Nonnull
protected Object[] computer_getOrSetVector3(@Nonnull final FunctionGet<Vector3> getVector,
@Nonnull final FunctionSetVector<Float> setVector,
final Object[] arguments) {
if ( arguments != null if ( arguments != null
&& arguments.length > 0 && arguments.length > 0
&& arguments[0] != null ) { && arguments[0] != null ) {
@ -388,7 +392,7 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
return new Double[] { v3Actual.x, v3Actual.y, v3Actual.z }; return new Double[] { v3Actual.x, v3Actual.y, v3Actual.z };
} }
protected UUID computer_getUUID(final UUID uuidDefault, final Object[] arguments) { protected UUID computer_getUUID(final UUID uuidDefault, @Nonnull final Object[] arguments) {
try { try {
if (arguments.length == 1 && arguments[0] != null) { if (arguments.length == 1 && arguments[0] != null) {
if (arguments[0] instanceof UUID) { if (arguments[0] instanceof UUID) {
@ -697,7 +701,7 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
@Override @Override
@Optional.Method(modid = "opencomputers") @Optional.Method(modid = "opencomputers")
public void onConnect(final Node node) { public void onConnect(@Nonnull final Node node) {
if (node.host() instanceof Context) { if (node.host() instanceof Context) {
// Attach our file system to new computers we get connected to. // Attach our file system to new computers we get connected to.
// Note that this is also called for all already present computers // Note that this is also called for all already present computers
@ -711,7 +715,7 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
@Override @Override
@Optional.Method(modid = "opencomputers") @Optional.Method(modid = "opencomputers")
public void onDisconnect(final Node node) { public void onDisconnect(@Nonnull final Node node) {
if (OC_fileSystem != null) { if (OC_fileSystem != null) {
if (node.host() instanceof Context) { if (node.host() instanceof Context) {
// Disconnecting from a single computer // Disconnecting from a single computer
@ -725,7 +729,7 @@ public abstract class TileEntityAbstractInterfaced extends TileEntityAbstractBas
@Override @Override
@Optional.Method(modid = "opencomputers") @Optional.Method(modid = "opencomputers")
public void onMessage(final Message message) { public void onMessage(@Nonnull final Message message) {
// nothing special // nothing special
} }
} }

View file

@ -25,7 +25,7 @@ public abstract class BlockAbstractAccelerator extends BlockAbstractBase impleme
} }
@Override @Override
public boolean canCreatureSpawn(@Nonnull IBlockState blockState, @Nonnull IBlockAccess blockAccess, @Nonnull BlockPos blockPos, SpawnPlacementType type) { public boolean canCreatureSpawn(@Nonnull final IBlockState blockState, @Nonnull final IBlockAccess blockAccess, @Nonnull final BlockPos blockPos, final SpawnPlacementType type) {
return false; return false;
} }
} }

View file

@ -135,6 +135,7 @@ public class BlockShipScanner extends BlockAbstractContainer {
|| !entityPlayer.isSneaking() ) { || !entityPlayer.isSneaking() ) {
Commons.addChatMessage(entityPlayer, ((TileEntityShipScanner) tileEntity).getStatus()); Commons.addChatMessage(entityPlayer, ((TileEntityShipScanner) tileEntity).getStatus());
return true; return true;
} else if (blockStateAbove.getBlock() != this) { } else if (blockStateAbove.getBlock() != this) {
((TileEntityShipScanner) tileEntity).blockCamouflage = blockStateAbove.getBlock(); ((TileEntityShipScanner) tileEntity).blockCamouflage = blockStateAbove.getBlock();
((TileEntityShipScanner) tileEntity).metadataCamouflage = blockStateAbove.getBlock().getMetaFromState(blockStateAbove); ((TileEntityShipScanner) tileEntity).metadataCamouflage = blockStateAbove.getBlock().getMetaFromState(blockStateAbove);

View file

@ -8,6 +8,7 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.BlockRenderLayer;
@ -115,15 +116,16 @@ public class BlockDecorative extends BlockAbstractBase {
return blockState.getBlock().getMetaFromState(blockState); return blockState.getBlock().getMetaFromState(blockState);
} }
@Nonnull
public static ItemStack getItemStack(final EnumDecorativeType enumDecorativeType) { public static ItemStack getItemStack(final EnumDecorativeType enumDecorativeType) {
if (enumDecorativeType != null) { if (enumDecorativeType != null) {
int damage = enumDecorativeType.ordinal(); final int damage = enumDecorativeType.ordinal();
if (itemStackCache[damage] == null) { if (itemStackCache[damage] == null) {
itemStackCache[damage] = new ItemStack(WarpDrive.blockDecorative, 1, damage); itemStackCache[damage] = new ItemStack(WarpDrive.blockDecorative, 1, damage);
} }
return itemStackCache[damage]; return itemStackCache[damage];
} }
return null; return new ItemStack(Blocks.FIRE);
} }
public static ItemStack getItemStackNoCache(final EnumDecorativeType enumDecorativeType, final int amount) { public static ItemStack getItemStackNoCache(final EnumDecorativeType enumDecorativeType, final int amount) {

View file

@ -48,7 +48,7 @@ public class BlockCloakingCore extends BlockAbstractContainer {
} }
@Override @Override
public int getMetaFromState(final IBlockState blockState) { public int getMetaFromState(@Nonnull final IBlockState blockState) {
return blockState.getValue(BlockProperties.ACTIVE) ? 1 : 0; return blockState.getValue(BlockProperties.ACTIVE) ? 1 : 0;
} }

View file

@ -19,9 +19,8 @@ public class ItemBlockCapacitor extends ItemBlockAbstractBase {
} }
@Nonnull @Nonnull
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@SuppressWarnings("deprecation") @Override
public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) { public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) {
final int damage = itemStack.getItemDamage(); final int damage = itemStack.getItemDamage();
if (damage < 0 || damage > 15) { if (damage < 0 || damage > 15) {

View file

@ -10,6 +10,7 @@ import cr0s.warpdrive.data.Vector3;
import cr0s.warpdrive.network.PacketHandler; import cr0s.warpdrive.network.PacketHandler;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.util.Arrays; import java.util.Arrays;
@ -153,7 +154,7 @@ public class TileEntityEnanReactorCore extends TileEntityEnanReactorController {
} }
} }
void decreaseInstability(final ReactorFace reactorFace, final int energy) { void decreaseInstability(@Nonnull final ReactorFace reactorFace, final int energy) {
if (reactorFace.indexStability < 0) { if (reactorFace.indexStability < 0) {
return; return;
} }
@ -231,7 +232,8 @@ public class TileEntityEnanReactorCore extends TileEntityEnanReactorController {
} }
} }
private TileEntityEnanReactorLaser getLaser(final ReactorFace reactorFace) { @Nullable
private TileEntityEnanReactorLaser getLaser(@Nonnull final ReactorFace reactorFace) {
final WeakReference<TileEntityEnanReactorLaser> weakTileEntityLaser = weakTileEntityLasers[reactorFace.indexStability]; final WeakReference<TileEntityEnanReactorLaser> weakTileEntityLaser = weakTileEntityLasers[reactorFace.indexStability];
TileEntityEnanReactorLaser tileEntityEnanReactorLaser; TileEntityEnanReactorLaser tileEntityEnanReactorLaser;
if (weakTileEntityLaser != null) { if (weakTileEntityLaser != null) {

View file

@ -35,7 +35,7 @@ public abstract class BlockAbstractForceField extends BlockAbstractContainer {
} }
@Override @Override
public void onEMP(World world, final BlockPos blockPos, final float efficiency) { public void onEMP(@Nonnull final World world, @Nonnull final BlockPos blockPos, final float efficiency) {
super.onEMP(world, blockPos, efficiency * (1.0F - 0.2F * (enumTier.getIndex() - 1))); super.onEMP(world, blockPos, efficiency * (1.0F - 0.2F * (enumTier.getIndex() - 1)));
} }
} }

View file

@ -531,7 +531,7 @@ public class BlockForceField extends BlockAbstractForceField implements IDamageR
} }
@Override @Override
public void onEMP(final World world, final BlockPos blockPos, final float efficiency) { public void onEMP(@Nonnull final World world, @Nonnull final BlockPos blockPos, final float efficiency) {
if (efficiency * (1.0F - 0.20F * (enumTier.getIndex() - 1)) > world.rand.nextFloat()) { if (efficiency * (1.0F - 0.20F * (enumTier.getIndex() - 1)) > world.rand.nextFloat()) {
downgrade(world, blockPos); downgrade(world, blockPos);
} }

View file

@ -229,7 +229,7 @@ public class BlockForceFieldProjector extends BlockAbstractForceField {
|| (enumFacing != blockState.getValue(BlockProperties.FACING) && (!tileEntityForceFieldProjector.isDoubleSided || enumFacing.getOpposite() != blockState.getValue(BlockProperties.FACING))) ) { || (enumFacing != blockState.getValue(BlockProperties.FACING) && (!tileEntityForceFieldProjector.isDoubleSided || enumFacing.getOpposite() != blockState.getValue(BlockProperties.FACING))) ) {
// find a valid upgrade to dismount // find a valid upgrade to dismount
if (!tileEntityForceFieldProjector.hasUpgrade(enumForceFieldUpgrade)) { if (!tileEntityForceFieldProjector.hasUpgrade(enumForceFieldUpgrade)) {
enumForceFieldUpgrade = (EnumForceFieldUpgrade)tileEntityForceFieldProjector.getFirstUpgradeOfType(EnumForceFieldUpgrade.class, EnumForceFieldUpgrade.NONE); enumForceFieldUpgrade = (EnumForceFieldUpgrade) tileEntityForceFieldProjector.getFirstUpgradeOfType(EnumForceFieldUpgrade.class, EnumForceFieldUpgrade.NONE);
} }
if (enumForceFieldUpgrade == EnumForceFieldUpgrade.NONE) { if (enumForceFieldUpgrade == EnumForceFieldUpgrade.NONE) {

View file

@ -19,8 +19,8 @@ public class ItemBlockForceFieldProjector extends ItemBlockAbstractBase {
} }
@Nonnull @Nonnull
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override
public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) { public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) {
final ResourceLocation resourceLocation = getRegistryName(); final ResourceLocation resourceLocation = getRegistryName();
assert resourceLocation != null; assert resourceLocation != null;

View file

@ -19,9 +19,8 @@ public class ItemBlockHull extends ItemBlockAbstractBase {
} }
@Nonnull @Nonnull
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@SuppressWarnings("deprecation") @Override
public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) { public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) {
if (block instanceof BlockHullStairs) { if (block instanceof BlockHullStairs) {
final ResourceLocation resourceLocation = getRegistryName(); final ResourceLocation resourceLocation = getRegistryName();

View file

@ -35,11 +35,11 @@ public class ItemBlockHullSlab extends ItemBlockHull {
@Nonnull @Nonnull
@Override @Override
public EnumActionResult onItemUse(@Nonnull final EntityPlayer entityPlayer, final World world, @Nonnull final BlockPos blockPos, public EnumActionResult onItemUse(@Nonnull final EntityPlayer entityPlayer,
@Nonnull final EnumHand enumHand, @Nonnull EnumFacing facing, @Nonnull final World world, @Nonnull final BlockPos blockPos, @Nonnull final EnumHand hand,
final float hitX, final float hitY, final float hitZ) { @Nonnull final EnumFacing facing, final float hitX, final float hitY, final float hitZ) {
// get context // get context
final ItemStack itemStackHeld = entityPlayer.getHeldItem(enumHand); final ItemStack itemStackHeld = entityPlayer.getHeldItem(hand);
if (itemStackHeld.isEmpty()) { if (itemStackHeld.isEmpty()) {
return EnumActionResult.FAIL; return EnumActionResult.FAIL;
} }
@ -65,7 +65,7 @@ public class ItemBlockHullSlab extends ItemBlockHull {
if (variantWorld.getFacing() == facing.getOpposite()) { if (variantWorld.getFacing() == facing.getOpposite()) {
final AxisAlignedBB boundingBox = blockStateWorld.getCollisionBoundingBox(world, blockPos); final AxisAlignedBB boundingBox = blockStateWorld.getCollisionBoundingBox(world, blockPos);
if (boundingBox != null && world.checkNoEntityCollision(boundingBox)) { if (boundingBox != null && world.checkNoEntityCollision(boundingBox)) {
EnumVariant variantNew; final EnumVariant variantNew;
if (variantWorld.getIsPlain()) {// plain if (variantWorld.getIsPlain()) {// plain
variantNew = EnumVariant.PLAIN_FULL; variantNew = EnumVariant.PLAIN_FULL;
} else { } else {
@ -111,7 +111,7 @@ public class ItemBlockHullSlab extends ItemBlockHull {
} }
// try to place ignoring the existing block // try to place ignoring the existing block
final IBlockState blockStatePlaced = blockSlab.getStateForPlacement(world, blockPosSide, facing, hitX, hitY, hitZ, metadataItem, entityPlayer, enumHand); final IBlockState blockStatePlaced = blockSlab.getStateForPlacement(world, blockPosSide, facing, hitX, hitY, hitZ, metadataItem, entityPlayer, hand);
final EnumFacing enumFacingPlaced = blockStatePlaced.getValue(BlockHullSlab.VARIANT).getFacing().getOpposite(); final EnumFacing enumFacingPlaced = blockStatePlaced.getValue(BlockHullSlab.VARIANT).getFacing().getOpposite();
// try to merge slabs when right-clicking on a side block // try to merge slabs when right-clicking on a side block
@ -152,11 +152,12 @@ public class ItemBlockHullSlab extends ItemBlockHull {
} }
} }
return super.onItemUse(entityPlayer, world, blockPos, enumHand, facing, hitX, hitY, hitZ); return super.onItemUse(entityPlayer, world, blockPos, hand, facing, hitX, hitY, hitZ);
} }
@Override @Override
public boolean canPlaceBlockOnSide(final World world, @Nonnull final BlockPos blockPos, @Nonnull final EnumFacing facing, final EntityPlayer entityPlayer, @Nonnull final ItemStack itemStack) { public boolean canPlaceBlockOnSide(@Nonnull final World world, @Nonnull final BlockPos blockPos, @Nonnull final EnumFacing facing,
@Nonnull final EntityPlayer entityPlayer, @Nonnull final ItemStack itemStack) {
// check if clicked block can be interacted with // check if clicked block can be interacted with
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
final IBlockState blockStateItem = blockSlab.getStateFromMeta(itemStack.getItemDamage()); final IBlockState blockStateItem = blockSlab.getStateFromMeta(itemStack.getItemDamage());

View file

@ -125,6 +125,7 @@ public class BlockShipCore extends BlockAbstractRotatingContainer {
} }
Commons.addChatMessage(entityPlayer, tileEntityShipCore.getBoundingBoxStatus()); Commons.addChatMessage(entityPlayer, tileEntityShipCore.getBoundingBoxStatus());
return true; return true;
} else if ( !world.isRemote } else if ( !world.isRemote
&& !entityPlayer.isSneaking() ) { && !entityPlayer.isSneaking() ) {
Commons.addChatMessage(entityPlayer, tileEntityShipCore.getStatus()); Commons.addChatMessage(entityPlayer, tileEntityShipCore.getStatus());

View file

@ -118,7 +118,7 @@ public class ItemBlockTransporterBeacon extends ItemBlockAbstractBase implements
return 0; return 0;
} }
private static ItemStack setEnergy(final ItemStack itemStack, final int energy) { private static ItemStack setEnergy(@Nonnull final ItemStack itemStack, final int energy) {
if (!(itemStack.getItem() instanceof ItemBlockTransporterBeacon)) { if (!(itemStack.getItem() instanceof ItemBlockTransporterBeacon)) {
return itemStack; return itemStack;
} }
@ -131,7 +131,7 @@ public class ItemBlockTransporterBeacon extends ItemBlockAbstractBase implements
return itemStack; return itemStack;
} }
private static ItemStack updateDamage(final ItemStack itemStack, final int energy, final boolean isActive) { private static ItemStack updateDamage(@Nonnull final ItemStack itemStack, final int energy, final boolean isActive) {
final int maxDamage = itemStack.getMaxDamage(); final int maxDamage = itemStack.getMaxDamage();
final int metadataEnergy = maxDamage - maxDamage * energy / WarpDriveConfig.TRANSPORTER_BEACON_MAX_ENERGY_STORED; final int metadataEnergy = maxDamage - maxDamage * energy / WarpDriveConfig.TRANSPORTER_BEACON_MAX_ENERGY_STORED;
final int metadataNew = (metadataEnergy & ~0x3) + (isActive ? 2 : 0); final int metadataNew = (metadataEnergy & ~0x3) + (isActive ? 2 : 0);
@ -145,7 +145,7 @@ public class ItemBlockTransporterBeacon extends ItemBlockAbstractBase implements
// ITransporterBeacon overrides // ITransporterBeacon overrides
@Override @Override
public boolean isActive(final ItemStack itemStack) { public boolean isActive(@Nonnull final ItemStack itemStack) {
return getEnergy(itemStack) > WarpDriveConfig.TRANSPORTER_BEACON_ENERGY_PER_TICK; return getEnergy(itemStack) > WarpDriveConfig.TRANSPORTER_BEACON_ENERGY_PER_TICK;
} }
@ -212,15 +212,15 @@ public class ItemBlockTransporterBeacon extends ItemBlockAbstractBase implements
@Nonnull @Nonnull
@Override @Override
public EnumActionResult onItemUse(@Nonnull final EntityPlayer entityPlayer, final World world, @Nonnull final BlockPos blockPos, public EnumActionResult onItemUse(@Nonnull final EntityPlayer entityPlayer,
@Nonnull final EnumHand enumHand, @Nonnull final EnumFacing enumFacing, @Nonnull final World world, @Nonnull final BlockPos blockPos, @Nonnull final EnumHand hand,
final float hitX, final float hitY, final float hitZ) { @Nonnull final EnumFacing facing, final float hitX, final float hitY, final float hitZ) {
if (world.isRemote) { if (world.isRemote) {
return EnumActionResult.FAIL; return EnumActionResult.FAIL;
} }
// get context // get context
final ItemStack itemStackHeld = entityPlayer.getHeldItem(enumHand); final ItemStack itemStackHeld = entityPlayer.getHeldItem(hand);
if (itemStackHeld.isEmpty()) { if (itemStackHeld.isEmpty()) {
return EnumActionResult.FAIL; return EnumActionResult.FAIL;
} }
@ -230,9 +230,9 @@ public class ItemBlockTransporterBeacon extends ItemBlockAbstractBase implements
final TileEntity tileEntity = world.getTileEntity(blockPos); final TileEntity tileEntity = world.getTileEntity(blockPos);
if (!(tileEntity instanceof ITransporterCore)) { if (!(tileEntity instanceof ITransporterCore)) {
return super.onItemUse(entityPlayer, world, blockPos, enumHand, enumFacing, hitX, hitY, hitZ); return super.onItemUse(entityPlayer, world, blockPos, hand, facing, hitX, hitY, hitZ);
} }
if (!entityPlayer.canPlayerEdit(blockPos, enumFacing, itemStackHeld)) { if (!entityPlayer.canPlayerEdit(blockPos, facing, itemStackHeld)) {
return EnumActionResult.FAIL; return EnumActionResult.FAIL;
} }

View file

@ -13,15 +13,15 @@ import net.minecraft.world.IBlockAccess;
class ShipScanner { class ShipScanner {
// inputs // inputs
private IBlockAccess blockAccess; private final IBlockAccess blockAccess;
private int minX, minY, minZ; private final int minX, minY, minZ;
private int maxX, maxY, maxZ; private final int maxX, maxY, maxZ;
// execution // execution
private int x; private int x;
private int y; private int y;
private int z; private int z;
private MutableBlockPos mutableBlockPos; private final MutableBlockPos mutableBlockPos;
// output // output
public int mass = 0; public int mass = 0;

View file

@ -31,9 +31,10 @@ public abstract class TileEntityAbstractShipController extends TileEntityAbstrac
private int moveUp = 0; private int moveUp = 0;
private int moveRight = 0; private int moveRight = 0;
private byte rotationSteps = 0; private byte rotationSteps = 0;
protected String nameTarget = "";
protected EnumShipCommand enumShipCommand = EnumShipCommand.IDLE; protected EnumShipCommand enumShipCommand = EnumShipCommand.IDLE;
protected boolean isCommandConfirmed = false; protected boolean isCommandConfirmed = false;
protected String nameTarget = "";
public TileEntityAbstractShipController() { public TileEntityAbstractShipController() {
super(); super();
@ -75,9 +76,6 @@ public abstract class TileEntityAbstractShipController extends TileEntityAbstrac
public void readFromNBT(final NBTTagCompound tagCompound) { public void readFromNBT(final NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound); super.readFromNBT(tagCompound);
final boolean isConfirmed = tagCompound.hasKey("commandConfirmed") && tagCompound.getBoolean("commandConfirmed");
setCommand(tagCompound.getString("commandName"), isConfirmed);
setFront(tagCompound.getInteger("front")); setFront(tagCompound.getInteger("front"));
setRight(tagCompound.getInteger("right")); setRight(tagCompound.getInteger("right"));
setUp (tagCompound.getInteger("up")); setUp (tagCompound.getInteger("up"));
@ -91,6 +89,9 @@ public abstract class TileEntityAbstractShipController extends TileEntityAbstrac
tagCompound.getInteger("moveRight") ); tagCompound.getInteger("moveRight") );
setRotationSteps(tagCompound.getByte("rotationSteps")); setRotationSteps(tagCompound.getByte("rotationSteps"));
nameTarget = tagCompound.getString("nameTarget"); nameTarget = tagCompound.getString("nameTarget");
final boolean isConfirmed = tagCompound.hasKey("commandConfirmed") && tagCompound.getBoolean("commandConfirmed");
setCommand(tagCompound.getString("commandName"), isConfirmed);
} }
@Nonnull @Nonnull
@ -98,9 +99,6 @@ public abstract class TileEntityAbstractShipController extends TileEntityAbstrac
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) { public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
tagCompound = super.writeToNBT(tagCompound); tagCompound = super.writeToNBT(tagCompound);
tagCompound.setString("commandName", enumShipCommand.getName());
tagCompound.setBoolean("commandConfirmed", isCommandConfirmed);
tagCompound.setInteger("front", getFront()); tagCompound.setInteger("front", getFront());
tagCompound.setInteger("right", getRight()); tagCompound.setInteger("right", getRight());
tagCompound.setInteger("up", getUp()); tagCompound.setInteger("up", getUp());
@ -113,6 +111,10 @@ public abstract class TileEntityAbstractShipController extends TileEntityAbstrac
tagCompound.setInteger("moveRight", moveRight); tagCompound.setInteger("moveRight", moveRight);
tagCompound.setByte("rotationSteps", rotationSteps); tagCompound.setByte("rotationSteps", rotationSteps);
tagCompound.setString("nameTarget", nameTarget); tagCompound.setString("nameTarget", nameTarget);
tagCompound.setString("commandName", enumShipCommand.getName());
tagCompound.setBoolean("commandConfirmed", isCommandConfirmed);
return tagCompound; return tagCompound;
} }
@ -120,9 +122,6 @@ public abstract class TileEntityAbstractShipController extends TileEntityAbstrac
public NBTTagCompound writeItemDropNBT(NBTTagCompound tagCompound) { public NBTTagCompound writeItemDropNBT(NBTTagCompound tagCompound) {
tagCompound = super.writeItemDropNBT(tagCompound); tagCompound = super.writeItemDropNBT(tagCompound);
tagCompound.removeTag("commandName");
tagCompound.removeTag("commandConfirmed");
tagCompound.removeTag("front"); tagCompound.removeTag("front");
tagCompound.removeTag("right"); tagCompound.removeTag("right");
tagCompound.removeTag("up"); tagCompound.removeTag("up");
@ -135,6 +134,10 @@ public abstract class TileEntityAbstractShipController extends TileEntityAbstrac
tagCompound.removeTag("moveRight"); tagCompound.removeTag("moveRight");
tagCompound.removeTag("rotationSteps"); tagCompound.removeTag("rotationSteps");
tagCompound.removeTag("nameTarget"); tagCompound.removeTag("nameTarget");
tagCompound.removeTag("commandName");
tagCompound.removeTag("commandConfirmed");
return tagCompound; return tagCompound;
} }

View file

@ -83,7 +83,7 @@ public class ClientProxy extends CommonProxy {
} }
@Nonnull @Nonnull
public static ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) { public static ModelResourceLocation getModelResourceLocation(@Nonnull final ItemStack itemStack) {
final Item item = itemStack.getItem(); final Item item = itemStack.getItem();
ResourceLocation resourceLocation = item.getRegistryName(); ResourceLocation resourceLocation = item.getRegistryName();
assert resourceLocation != null; assert resourceLocation != null;
@ -107,9 +107,9 @@ public class ClientProxy extends CommonProxy {
return new ModelResourceLocation(resourceLocation, "inventory"); return new ModelResourceLocation(resourceLocation, "inventory");
} }
public static void modelInitialisation(final Item item) { public static void modelInitialisation(@Nonnull final Item item) {
if (!(item instanceof IItemBase)) { if (!(item instanceof IItemBase)) {
throw new RuntimeException(String.format("Unable to item, expecting an IItemBase instance: %s", throw new RuntimeException(String.format("Unable to initialize item's model, expecting an IItemBase instance: %s",
item)); item));
} }

View file

@ -9,7 +9,8 @@ import net.minecraft.util.text.TextComponentString;
public abstract class AbstractCommand extends CommandBase { public abstract class AbstractCommand extends CommandBase {
public ITextComponent getPrefix() { public ITextComponent getPrefix() {
return new TextComponentString("/" + getName()).setStyle(Commons.styleHeader).appendSibling(new TextComponentString(" ")); return new TextComponentString("/" + getName()).setStyle(Commons.styleHeader)
.appendSibling(new TextComponentString(" "));
} }
} }

View file

@ -15,21 +15,27 @@ import javax.annotation.Nonnull;
public class CommandBed extends AbstractCommand { public class CommandBed extends AbstractCommand {
@Override
public int getRequiredPermissionLevel() {
return 2;
}
@Nonnull @Nonnull
@Override @Override
public String getName() { public String getName() {
return "wbed"; return "wbed";
} }
@Override
public int getRequiredPermissionLevel() {
return 2;
}
@Nonnull
@Override
public String getUsage(@Nonnull final ICommandSender commandSender) {
return getName() + " (<playerName>)"
+ "\nplayerName: name of the player home to find. Exact casing is required.";
}
@Override @Override
public void execute(@Nonnull final MinecraftServer server, @Nonnull final ICommandSender commandSender, @Nonnull final String[] args) { public void execute(@Nonnull final MinecraftServer server, @Nonnull final ICommandSender commandSender, @Nonnull final String[] args) {
// parse arguments // parse arguments
//noinspection StatementWithEmptyBody
EntityPlayerMP[] entityPlayerMPs = null; EntityPlayerMP[] entityPlayerMPs = null;
if (args.length == 0) { if (args.length == 0) {
if (commandSender instanceof EntityPlayerMP) { if (commandSender instanceof EntityPlayerMP) {
@ -105,11 +111,4 @@ public class CommandBed extends AbstractCommand {
} }
} }
} }
@Nonnull
@Override
public String getUsage(@Nonnull final ICommandSender commandSender) {
return getName() + " (<playerName>)"
+ "\nplayerName: name of the player home to find. Exact casing is required.";
}
} }

View file

@ -97,7 +97,7 @@ public class CommandEntity extends AbstractCommand {
WarpDrive.logger.info(String.format("/%s %d '*%s*' %s", getName(), radius, filter, kill)); WarpDrive.logger.info(String.format("/%s %d '*%s*' %s", getName(), radius, filter, kill));
List<Entity> entities; final List<Entity> entities;
if (radius <= 0) { if (radius <= 0) {
final World world; final World world;
if (commandSender instanceof EntityPlayerMP) { if (commandSender instanceof EntityPlayerMP) {

View file

@ -11,22 +11,28 @@ import javax.annotation.Nonnull;
public class CommandFind extends AbstractCommand { public class CommandFind extends AbstractCommand {
@Override
public int getRequiredPermissionLevel() {
return 2;
}
@Nonnull @Nonnull
@Override @Override
public String getName() { public String getName() {
return "wfind"; return "wfind";
} }
@Override
public int getRequiredPermissionLevel() {
return 2;
}
@Nonnull
@Override
public String getUsage(@Nonnull final ICommandSender commandSender) {
return getName() + " (<shipName>)"
+ "\nshipName: name of the ship to find. Exact casing is preferred.";
}
@Override @Override
public void execute(@Nonnull final MinecraftServer server, @Nonnull final ICommandSender commandSender, @Nonnull final String[] args) { public void execute(@Nonnull final MinecraftServer server, @Nonnull final ICommandSender commandSender, @Nonnull final String[] args) {
// parse arguments // parse arguments
//noinspection StatementWithEmptyBody final String nameToken;
String nameToken;
if (args.length == 0) { if (args.length == 0) {
Commons.addChatMessage(commandSender, new TextComponentString(getUsage(commandSender))); Commons.addChatMessage(commandSender, new TextComponentString(getUsage(commandSender)));
return; return;
@ -51,11 +57,4 @@ public class CommandFind extends AbstractCommand {
final String result = WarpDrive.starMap.find(nameToken); final String result = WarpDrive.starMap.find(nameToken);
Commons.addChatMessage(commandSender, new TextComponentString(result)); Commons.addChatMessage(commandSender, new TextComponentString(result));
} }
@Nonnull
@Override
public String getUsage(@Nonnull final ICommandSender commandSender) {
return getName() + " (<shipName>)"
+ "\nshipName: name of the ship to find. Exact casing is preferred.";
}
} }

View file

@ -36,7 +36,7 @@ public class CommandGenerate extends AbstractCommand {
@Nonnull @Nonnull
@Override @Override
public String getUsage(@Nonnull final ICommandSender commandSender) { public String getUsage(@Nonnull final ICommandSender commandSender) {
return String.format("/%s <structure group> [<structure name>]\nStructure groups are ship, station, astfield, %s", return String.format("/%s <structure group> (<structure name>)\nStructure groups are ship, station, astfield, %s",
getName(), getName(),
StructureManager.getGroups().replace("\"", "") ); StructureManager.getGroups().replace("\"", "") );
} }

View file

@ -12,6 +12,12 @@ import net.minecraft.server.MinecraftServer;
public class CommandInvisible extends AbstractCommand { public class CommandInvisible extends AbstractCommand {
@Nonnull
@Override
public String getName() {
return "invisible";
}
@Override @Override
public int getRequiredPermissionLevel() { public int getRequiredPermissionLevel() {
return 4; return 4;
@ -19,10 +25,10 @@ public class CommandInvisible extends AbstractCommand {
@Nonnull @Nonnull
@Override @Override
public String getName() { public String getUsage(@Nonnull final ICommandSender commandSender) {
return "invisible"; return "/invisible [player]";
} }
@Override @Override
public void execute(@Nonnull final MinecraftServer server, @Nonnull final ICommandSender commandSender, @Nonnull final String[] args) { public void execute(@Nonnull final MinecraftServer server, @Nonnull final ICommandSender commandSender, @Nonnull final String[] args) {
EntityPlayer player = commandSender instanceof EntityPlayer ? (EntityPlayer) commandSender : null; EntityPlayer player = commandSender instanceof EntityPlayer ? (EntityPlayer) commandSender : null;
@ -47,10 +53,4 @@ public class CommandInvisible extends AbstractCommand {
// Toggle invisibility // Toggle invisibility
player.setInvisible(!player.isInvisible()); player.setInvisible(!player.isInvisible());
} }
@Nonnull
@Override
public String getUsage(@Nonnull final ICommandSender commandSender) {
return "/invisible [player]";
}
} }

View file

@ -11,6 +11,12 @@ import net.minecraft.util.text.TextComponentTranslation;
public class CommandReload extends AbstractCommand { public class CommandReload extends AbstractCommand {
@Nonnull
@Override
public String getName() {
return "wreload";
}
@Override @Override
public int getRequiredPermissionLevel() { public int getRequiredPermissionLevel() {
return 2; return 2;
@ -18,8 +24,8 @@ public class CommandReload extends AbstractCommand {
@Nonnull @Nonnull
@Override @Override
public String getName() { public String getUsage(@Nonnull final ICommandSender commandSender) {
return "wreload"; return "/wreload";
} }
@Override @Override
@ -28,10 +34,4 @@ public class CommandReload extends AbstractCommand {
Commons.addChatMessage(commandSender, new TextComponentTranslation("warpdrive.command.configuration_reloaded").setStyle(Commons.styleCorrect)); Commons.addChatMessage(commandSender, new TextComponentTranslation("warpdrive.command.configuration_reloaded").setStyle(Commons.styleCorrect));
Commons.addChatMessage(commandSender, new TextComponentTranslation("warpdrive.command.liability_warning").setStyle(Commons.styleWarning)); Commons.addChatMessage(commandSender, new TextComponentTranslation("warpdrive.command.liability_warning").setStyle(Commons.styleWarning));
} }
@Nonnull
@Override
public String getUsage(@Nonnull final ICommandSender commandSender) {
return "/wreload";
}
} }

View file

@ -23,6 +23,12 @@ import net.minecraft.world.WorldServer;
public class CommandSpace extends AbstractCommand { public class CommandSpace extends AbstractCommand {
@Nonnull
@Override
public String getName() {
return "space";
}
@Override @Override
public int getRequiredPermissionLevel() { public int getRequiredPermissionLevel() {
return 2; return 2;
@ -30,8 +36,8 @@ public class CommandSpace extends AbstractCommand {
@Nonnull @Nonnull
@Override @Override
public String getName() { public String getUsage(@Nonnull final ICommandSender commandSender) {
return "space"; return "/space (<playerName>) ([overworld|nether|end|theend|space|hyper|hyperspace|<dimensionId>])";
} }
@Override @Override
@ -207,10 +213,4 @@ public class CommandSpace extends AbstractCommand {
Commons.moveEntity(entityPlayerMP, worldTarget, new Vector3(xTarget + 0.5D, yTarget + 0.2D, zTarget + 0.5D)); Commons.moveEntity(entityPlayerMP, worldTarget, new Vector3(xTarget + 0.5D, yTarget + 0.2D, zTarget + 0.5D));
} }
} }
@Nonnull
@Override
public String getUsage(@Nonnull final ICommandSender commandSender) {
return "/space (<playerName>) ([overworld|nether|end|theend|space|hyper|hyperspace|<dimensionId>])";
}
} }

View file

@ -8,6 +8,7 @@ import cr0s.warpdrive.block.hull.BlockHullGlass;
import cr0s.warpdrive.block.hull.BlockHullSlab; import cr0s.warpdrive.block.hull.BlockHullSlab;
import cr0s.warpdrive.block.hull.BlockHullStairs; import cr0s.warpdrive.block.hull.BlockHullStairs;
import javax.annotation.Nonnull;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -689,7 +690,8 @@ public class Dictionary {
} }
} }
private static String getHashMessage(final HashSet hashSet) { @Nonnull
private static String getHashMessage(@Nonnull final HashSet hashSet) {
final StringBuilder message = new StringBuilder(); final StringBuilder message = new StringBuilder();
for (final Object object : hashSet) { for (final Object object : hashSet) {
if (message.length() > 0) { if (message.length() > 0) {
@ -706,7 +708,8 @@ public class Dictionary {
return message.toString(); return message.toString();
} }
private static String getHashMessage(final HashMap<Block, Integer> hashMap) { @Nonnull
private static String getHashMessage(@Nonnull final HashMap<Block, Integer> hashMap) {
final StringBuilder message = new StringBuilder(); final StringBuilder message = new StringBuilder();
for (final Entry<Block, Integer> entry : hashMap.entrySet()) { for (final Entry<Block, Integer> entry : hashMap.entrySet()) {
if (message.length() > 0) { if (message.length() > 0) {
@ -717,9 +720,9 @@ public class Dictionary {
return message.toString(); return message.toString();
} }
public static NBTBase writeItemsToNBT(final HashSet<Item> hashSetItem) { @Nonnull
public static NBTBase writeItemsToNBT(@Nonnull final HashSet<Item> hashSetItem) {
final NBTTagList nbtTagList = new NBTTagList(); final NBTTagList nbtTagList = new NBTTagList();
assert hashSetItem != null;
for (final Item item : hashSetItem) { for (final Item item : hashSetItem) {
assert item.getRegistryName() != null; assert item.getRegistryName() != null;
final String registryName = item.getRegistryName().toString(); final String registryName = item.getRegistryName().toString();
@ -728,8 +731,8 @@ public class Dictionary {
return nbtTagList; return nbtTagList;
} }
public static HashSet<Item> readItemsFromNBT(final NBTTagList nbtTagList) { @Nonnull
assert nbtTagList != null; public static HashSet<Item> readItemsFromNBT(@Nonnull final NBTTagList nbtTagList) {
final int size = nbtTagList.tagCount(); final int size = nbtTagList.tagCount();
final HashSet<Item> hashSetItem = new HashSet<>(Math.max(8, size)); final HashSet<Item> hashSetItem = new HashSet<>(Math.max(8, size));
@ -747,6 +750,7 @@ public class Dictionary {
return hashSetItem; return hashSetItem;
} }
@Nonnull
public static String getId(final Entity entity) { public static String getId(final Entity entity) {
final ResourceLocation resourceLocation = EntityList.getKey(entity); final ResourceLocation resourceLocation = EntityList.getKey(entity);
return resourceLocation == null ? "-null-" : resourceLocation.toString(); return resourceLocation == null ? "-null-" : resourceLocation.toString();

View file

@ -212,26 +212,32 @@ public class Recipes {
itemStackMotors = new ItemStack[] { itemStackMotorLV, itemStackMotorMV, itemStackMotorHV, itemStackMotorEV }; itemStackMotors = new ItemStack[] { itemStackMotorLV, itemStackMotorMV, itemStackMotorHV, itemStackMotorEV };
// integrate with iron bars from all mods // integrate with iron bars from all mods
barsIron = WarpDriveConfig.getOreOrItemStack("ore:barsIron", 0, barsIron = WarpDriveConfig.getOreOrItemStack(
"minecraft:iron_bars", 0); "ore:barsIron", 0,
"minecraft:iron_bars", 0 );
// integrate with steel and aluminium ingots from all mods // integrate with steel and aluminium ingots from all mods
ingotIronOrSteel = WarpDriveConfig.getOreOrItemStack("ore:ingotSteel", 0, ingotIronOrSteel = WarpDriveConfig.getOreOrItemStack(
"ore:ingotAluminium", 0, "ore:ingotSteel", 0,
"ore:ingotAluminum", 0, "ore:ingotAluminium", 0,
"ore:ingotIron", 0); "ore:ingotAluminum", 0,
"ore:ingotIron", 0 );
// integrate with rubber from all mods // integrate with rubber from all mods
rubber = WarpDriveConfig.getOreOrItemStack("ore:plateRubber", 0, // comes with GregTech rubber = WarpDriveConfig.getOreOrItemStack(
"ore:itemRubber", 0 ); // comes with WarpDrive, IndustrialCraft2, IndustrialForegoing, TechReborn "ore:plateRubber", 0, // comes with GregTech
"ore:itemRubber", 0 ); // comes with WarpDrive, IndustrialCraft2, IndustrialForegoing, TechReborn
// integrate with circuits from all mods // integrate with circuits from all mods
goldNuggetOrBasicCircuit = WarpDriveConfig.getOreOrItemStack("ore:circuitBasic", 0, // comes with IndustrialCraft2, Mekanism, VoltzEngine goldNuggetOrBasicCircuit = WarpDriveConfig.getOreOrItemStack(
"ore:nuggetGold", 0); "ore:circuitBasic", 0, // comes with IndustrialCraft2, Mekanism, VoltzEngine
goldIngotOrAdvancedCircuit = WarpDriveConfig.getOreOrItemStack("ore:circuitAdvanced", 0, // comes with IndustrialCraft2, Mekanism, VoltzEngine "ore:nuggetGold", 0 );
"ore:ingotGold", 0); goldIngotOrAdvancedCircuit = WarpDriveConfig.getOreOrItemStack(
emeraldOrSuperiorCircuit = WarpDriveConfig.getOreOrItemStack("ore:circuitElite", 0, // comes with Mekanism, VoltzEngine "ore:circuitAdvanced", 0, // comes with IndustrialCraft2, Mekanism, VoltzEngine
"ore:gemEmerald", 0); "ore:ingotGold", 0 );
emeraldOrSuperiorCircuit = WarpDriveConfig.getOreOrItemStack(
"ore:circuitElite", 0, // comes with Mekanism, VoltzEngine
"ore:gemEmerald", 0 );
// Iridium block is just that // Iridium block is just that
if (WarpDriveConfig.isGregtechLoaded) { if (WarpDriveConfig.isGregtechLoaded) {
@ -343,10 +349,11 @@ public class Recipes {
} }
// Capacitive crystal is 2 Redstone block, 4 Paper, 1 Regeneration potion, 2 (lithium dust or electrum dust or electrical steel ingot or gold ingot) // Capacitive crystal is 2 Redstone block, 4 Paper, 1 Regeneration potion, 2 (lithium dust or electrum dust or electrical steel ingot or gold ingot)
final Object lithiumOrElectrum = WarpDriveConfig.getOreOrItemStack("ore:dustLithium", 0, // comes with GregTech, Industrial Craft 2 and Mekanism final Object lithiumOrElectrum = WarpDriveConfig.getOreOrItemStack(
"ore:dustElectrum", 0, // comes with ImmersiveEngineering, ThermalFoundation, Metallurgy "ore:dustLithium", 0, // comes with GregTech, Industrial Craft 2 and Mekanism
"ore:ingotElectricalSteel", 0, // comes with EnderIO "ore:dustElectrum", 0, // comes with ImmersiveEngineering, ThermalFoundation, Metallurgy
"ore:ingotGold", 0); "ore:ingotElectricalSteel", 0, // comes with EnderIO
"ore:ingotGold", 0 );
// (Lithium is processed from nether quartz) // (Lithium is processed from nether quartz)
// (IC2 Experimental is 1 Lithium dust from 18 nether quartz) // (IC2 Experimental is 1 Lithium dust from 18 nether quartz)
// Regeneration II (ghast tear + glowstone) // Regeneration II (ghast tear + glowstone)
@ -356,7 +363,7 @@ public class Recipes {
'R', itemStackStrongRegeneration, 'R', itemStackStrongRegeneration,
'r', "blockRedstone", 'r', "blockRedstone",
'l', lithiumOrElectrum, 'l', lithiumOrElectrum,
'p', Items.PAPER)); 'p', Items.PAPER ));
// Diamond crystal // Diamond crystal
WarpDrive.register(new ShapedOreRecipe(groupComponents, WarpDrive.register(new ShapedOreRecipe(groupComponents,
@ -384,17 +391,18 @@ public class Recipes {
'e', Items.ENDER_PEARL, 'e', Items.ENDER_PEARL,
'B', barsIron, 'B', barsIron,
'r', Items.REDSTONE, 'r', Items.REDSTONE,
'g', nuggetGoldOrSilver)); 'g', nuggetGoldOrSilver ));
// Diamond coil is 6 Iron bars, 2 Gold ingots, 1 Diamond crystal, gives 12 // Diamond coil is 6 Iron bars, 2 Gold ingots, 1 Diamond crystal, gives 12
final Object ingotGoldOrSilver = WarpDriveConfig.getOreOrItemStack("ore:ingotElectrum", 0, final Object ingotGoldOrSilver = WarpDriveConfig.getOreOrItemStack(
"ore:ingotSilver", 0, "ore:ingotElectrum", 0,
"ore:ingotGold", 0); "ore:ingotSilver", 0,
"ore:ingotGold", 0 );
WarpDrive.register(new ShapedOreRecipe(groupComponents, WarpDrive.register(new ShapedOreRecipe(groupComponents,
ItemComponent.getItemStackNoCache(EnumComponentType.DIAMOND_COIL, 12), false, "bbg", "bdb", "gbb", ItemComponent.getItemStackNoCache(EnumComponentType.DIAMOND_COIL, 12), false, "bbg", "bdb", "gbb",
'b', barsIron, 'b', barsIron,
'g', ingotGoldOrSilver, 'g', ingotGoldOrSilver,
'd', ItemComponent.getItemStack(EnumComponentType.DIAMOND_CRYSTAL))); 'd', ItemComponent.getItemStack(EnumComponentType.DIAMOND_CRYSTAL) ));
// Computer interface is 2 Gold ingot, 2 Wired modems (or redstone), 1 Lead/Tin ingot // Computer interface is 2 Gold ingot, 2 Wired modems (or redstone), 1 Lead/Tin ingot
Object redstoneOrModem = Items.REDSTONE; Object redstoneOrModem = Items.REDSTONE;
@ -419,46 +427,51 @@ public class Recipes {
'G', oreCircuitOrHeavyPressurePlate, 'G', oreCircuitOrHeavyPressurePlate,
'g', "ingotGold", 'g', "ingotGold",
'r', redstoneOrModem, 'r', redstoneOrModem,
'a', "ingotSolderingAlloy")); 'a', "ingotSolderingAlloy" ));
} }
// Computer interface: simple output // Computer interface: simple output
final Object slimeOrTinOrLead = WarpDriveConfig.getOreOrItemStack("ore:ingotTin", 0, final Object slimeOrTinOrLead = WarpDriveConfig.getOreOrItemStack(
"ore:ingotLead", 0, "ore:ingotTin", 0,
"ore:slimeball", 0); "ore:ingotLead", 0,
"ore:slimeball", 0 );
WarpDrive.register(new ShapedOreRecipe(groupComponents, WarpDrive.register(new ShapedOreRecipe(groupComponents,
ItemComponent.getItemStackNoCache(EnumComponentType.COMPUTER_INTERFACE, outputFactor), false, " ", "rar", "gGg", ItemComponent.getItemStackNoCache(EnumComponentType.COMPUTER_INTERFACE, outputFactor), false, " ", "rar", "gGg",
'G', oreCircuitOrHeavyPressurePlate, 'G', oreCircuitOrHeavyPressurePlate,
'g', "ingotGold", 'g', "ingotGold",
'r', redstoneOrModem, 'r', redstoneOrModem,
'a', slimeOrTinOrLead)); 'a', slimeOrTinOrLead ));
// *** breathing components // *** breathing components
// Bone charcoal is smelting 1 Bone // Bone charcoal is smelting 1 Bone
GameRegistry.addSmelting(Items.BONE, ItemComponent.getItemStackNoCache(EnumComponentType.BONE_CHARCOAL, 1), 1); GameRegistry.addSmelting(Items.BONE, ItemComponent.getItemStackNoCache(EnumComponentType.BONE_CHARCOAL, 1), 1);
// Activated carbon is 3 bone charcoal, 3 leaves, 2 water bottles, 1 sulfur dust or gunpowder // Activated carbon is 3 bone charcoal, 3 leaves, 2 water bottles, 1 sulfur dust or gunpowder
final Object leaves = WarpDriveConfig.getOreOrItemStack("ore:treeLeaves", 0, final Object leaves = WarpDriveConfig.getOreOrItemStack(
"minecraft:leaves", 0); "ore:treeLeaves", 0,
final Object gunpowderOrSulfur = WarpDriveConfig.getOreOrItemStack("ore:dustSulfur", 0, "minecraft:leaves", 0 );
"ore:gunpowder", 0, final Object gunpowderOrSulfur = WarpDriveConfig.getOreOrItemStack(
"minecraft:gunpowder", 0); "ore:dustSulfur", 0,
"ore:gunpowder", 0,
"minecraft:gunpowder", 0 );
final ItemStack itemStackWaterBottle = WarpDriveConfig.getItemStackOrFire("minecraft:potion", 0, "{Potion: \"minecraft:water\"}"); final ItemStack itemStackWaterBottle = WarpDriveConfig.getItemStackOrFire("minecraft:potion", 0, "{Potion: \"minecraft:water\"}");
WarpDrive.register(new ShapedOreRecipe(groupComponents, WarpDrive.register(new ShapedOreRecipe(groupComponents,
ItemComponent.getItemStack(EnumComponentType.ACTIVATED_CARBON), false, "lll", "aaa", "wgw", ItemComponent.getItemStack(EnumComponentType.ACTIVATED_CARBON), false, "lll", "aaa", "wgw",
'l', leaves, 'l', leaves,
'a', ItemComponent.getItemStack(EnumComponentType.BONE_CHARCOAL), 'a', ItemComponent.getItemStack(EnumComponentType.BONE_CHARCOAL),
'w', itemStackWaterBottle, 'w', itemStackWaterBottle,
'g', gunpowderOrSulfur)); 'g', gunpowderOrSulfur ));
// Air canister is 4 iron bars, 2 rubber, 2 yellow wool, 1 tank // Air canister is 4 iron bars, 2 rubber, 2 yellow wool, 1 tank
final Object woolPurple = WarpDriveConfig.getOreOrItemStack("ore:blockWoolPurple", 0, final Object woolPurple = WarpDriveConfig.getOreOrItemStack(
"minecraft:wool", 10); "ore:blockWoolPurple", 0,
"minecraft:wool", 10 );
WarpDrive.register(new ShapedOreRecipe(groupComponents, WarpDrive.register(new ShapedOreRecipe(groupComponents,
ItemComponent.getItemStackNoCache(EnumComponentType.AIR_CANISTER, 4), false, "iyi", "rgr", "iyi", ItemComponent.getItemStackNoCache(EnumComponentType.AIR_CANISTER, 4), false, "iyi", "rgr", "iyi",
'r', rubber, 'r', rubber,
'g', ItemComponent.getItemStack(EnumComponentType.GLASS_TANK), 'g', ItemComponent.getItemStack(EnumComponentType.GLASS_TANK),
'y', woolPurple, 'y', woolPurple,
'i', barsIron)); 'i', barsIron ));
// *** human interface components // *** human interface components
// Flat screen is 3 Dyes, 1 Glowstone dust, 2 Paper, 3 Glass panes // Flat screen is 3 Dyes, 1 Glowstone dust, 2 Paper, 3 Glass panes
@ -469,7 +482,7 @@ public class Recipes {
'B', "dyeBlue", 'B', "dyeBlue",
'd', "dustGlowstone", 'd', "dustGlowstone",
'g', "paneGlassColorless", 'g', "paneGlassColorless",
'p', Items.PAPER)); 'p', Items.PAPER ));
// Holographic projector is 5 Flat screens, 1 Zoom, 1 Emerald crystal, 1 Memory crystal // Holographic projector is 5 Flat screens, 1 Zoom, 1 Emerald crystal, 1 Memory crystal
WarpDrive.register(new ShapedOreRecipe(groupComponents, WarpDrive.register(new ShapedOreRecipe(groupComponents,
@ -486,16 +499,16 @@ public class Recipes {
WarpDrive.register(new ShapedOreRecipe(groupComponents, WarpDrive.register(new ShapedOreRecipe(groupComponents,
ItemComponent.getItemStackNoCache(EnumComponentType.GLASS_TANK, 4), false, "sgs", "g g", "sgs", ItemComponent.getItemStackNoCache(EnumComponentType.GLASS_TANK, 4), false, "sgs", "g g", "sgs",
's', "slimeball", 's', "slimeball",
'g', "blockGlass")); 'g', "blockGlass" ));
// Motor is 2 Gold nuggets (wires), 3 Iron ingots (steel rods), 4 Iron bars (coils) // Motor is 2 Gold nuggets (wires), 3 Iron ingots (steel rods), 4 Iron bars (coils)
WarpDrive.register(new ShapedOreRecipe(groupComponents, WarpDrive.register(new ShapedOreRecipe(groupComponents,
ItemComponent.getItemStack(EnumComponentType.MOTOR), false, "bbn", "iii", "bbn", ItemComponent.getItemStack(EnumComponentType.MOTOR), false, "bbn", "iii", "bbn",
'b', barsIron, 'b', barsIron,
'i', "ingotIron", 'i', "ingotIron",
'n', "nuggetGold")); 'n', "nuggetGold" ));
// Pump is 2 Motor, 1 Iron ingot, 2 Tanks, 4 Rubber, gives 2 // Pump is 2 Motor, 1 Iron ingot, 2 Tank, 4 Rubber, gives 2
WarpDrive.register(new ShapedOreRecipe(groupComponents, WarpDrive.register(new ShapedOreRecipe(groupComponents,
ItemComponent.getItemStackNoCache(EnumComponentType.PUMP, 2), false, "sst", "mim", "tss", ItemComponent.getItemStackNoCache(EnumComponentType.PUMP, 2), false, "sst", "mim", "tss",
's', rubber, 's', rubber,
@ -534,21 +547,21 @@ public class Recipes {
'd', "gemDiamond")); 'd', "gemDiamond"));
} }
// Zoom is 3 Lenses, 2 Iron ingot, 2 Dyes, 2 Redstone // Zoom is 3 Lens, 2 Iron ingot, 2 Dyes, 1 Redstone, 1 Basic motor
WarpDrive.register(new ShapedOreRecipe(groupComponents, WarpDrive.register(new ShapedOreRecipe(groupComponents,
ItemComponent.getItemStack(EnumComponentType.ZOOM), false, "dir", "lll", "dit", ItemComponent.getItemStack(EnumComponentType.ZOOM), false, "dir", "lll", "dit",
'r', Items.REDSTONE, 'r', Items.REDSTONE,
'i', ingotIronOrSteel, 'i', ingotIronOrSteel,
'l', ItemComponent.getItemStack(EnumComponentType.LENS), 'l', ItemComponent.getItemStack(EnumComponentType.LENS),
't', itemStackMotors[0], 't', itemStackMotors[0],
'd', "dye")); 'd', "dye" ));
// Diffraction grating is 1 Ghast tear, 3 Iron bars, 3 Glowstone dust // Diffraction grating is 1 Ghast tear, 3 Iron bar, 3 Glowstone block
WarpDrive.register(new ShapedOreRecipe(groupComponents, WarpDrive.register(new ShapedOreRecipe(groupComponents,
ItemComponent.getItemStack(EnumComponentType.DIFFRACTION_GRATING), false, " t ", "iii", "ggg", ItemComponent.getItemStack(EnumComponentType.DIFFRACTION_GRATING), false, " t ", "iii", "ggg",
't', Items.GHAST_TEAR, 't', Items.GHAST_TEAR,
'i', barsIron, 'i', barsIron,
'g', Blocks.GLOWSTONE)); 'g', Blocks.GLOWSTONE ));
// *** energy components // *** energy components
// Power interface is 4 Redstone, 2 Rubber, 3 Gold ingot // Power interface is 4 Redstone, 2 Rubber, 3 Gold ingot
@ -559,9 +572,10 @@ public class Recipes {
'r', Items.REDSTONE )); 'r', Items.REDSTONE ));
// Superconductor is 1 Ender crystal, 4 Power interface, 4 Cryotheum dust/Lapis block/10k Coolant cell // Superconductor is 1 Ender crystal, 4 Power interface, 4 Cryotheum dust/Lapis block/10k Coolant cell
final Object coolant = WarpDriveConfig.getOreOrItemStack("ore:dustCryotheum", 0, // comes with ThermalFoundation final Object coolant = WarpDriveConfig.getOreOrItemStack(
"ic2:heat_storage", 0, // IC2 Experimental 10k Coolant Cell "ore:dustCryotheum", 0, // comes with ThermalFoundation
"ore:blockLapis", 0); "ic2:heat_storage", 0, // IC2 Experimental 10k Coolant Cell
"ore:blockLapis", 0 );
WarpDrive.register(new ShapedOreRecipe(groupComponents, WarpDrive.register(new ShapedOreRecipe(groupComponents,
ItemComponent.getItemStack(EnumComponentType.SUPERCONDUCTOR), false, "pcp", "cec", "pcp", ItemComponent.getItemStack(EnumComponentType.SUPERCONDUCTOR), false, "pcp", "cec", "pcp",
'p', ItemComponent.getItemStack(EnumComponentType.POWER_INTERFACE), 'p', ItemComponent.getItemStack(EnumComponentType.POWER_INTERFACE),
@ -828,14 +842,15 @@ public class Recipes {
'M', "blockElectromagnet3")); 'M', "blockElectromagnet3"));
// Lower tier coil is iron, copper or coil // Lower tier coil is iron, copper or coil
final Object ironIngotOrCopperIngotOrCoil = WarpDriveConfig.getOreOrItemStack("gregtech:wire_coil", 0, // GregTech Cupronickel Coil block final Object ironIngotOrCopperIngotOrCoil = WarpDriveConfig.getOreOrItemStack(
"ic2:crafting", 5, // IC2 Coil "gregtech:wire_coil", 0, // GregTech Cupronickel Coil block
"thermalfoundation:material", 513, // ThermalFoundation Redstone reception coil "ic2:crafting", 5, // IC2 Coil
"immersiveengineering:wirecoil", 1, // ImmersiveEngineering MV wire coil "thermalfoundation:material", 513, // ThermalFoundation Redstone reception coil
"enderio:item_power_conduit", 1, // EnderIO Enhanced energy conduit "immersiveengineering:wirecoil", 1, // ImmersiveEngineering MV wire coil
"ore:ingotCopper", 0, "enderio:item_power_conduit", 1, // EnderIO Enhanced energy conduit
"ore:ingotSteel", 0, "ore:ingotCopper", 0,
"minecraft:iron_ingot", 0); "ore:ingotSteel", 0,
"minecraft:iron_ingot", 0 );
// Normal electromagnets // Normal electromagnets
WarpDrive.register(new ShapedOreRecipe(groupMachines, WarpDrive.register(new ShapedOreRecipe(groupMachines,
@ -943,11 +958,12 @@ public class Recipes {
WarpDrive.itemAirTanks[EnumAirTankTier.SUPERIOR.getIndex()]), "_uncrafting"); WarpDrive.itemAirTanks[EnumAirTankTier.SUPERIOR.getIndex()]), "_uncrafting");
// Air generator is 1 Power interface, 4 Activated carbon, 1 Motor, 1 MV Machine casing, 2 Glass tanks // Air generator is 1 Power interface, 4 Activated carbon, 1 Motor, 1 MV Machine casing, 2 Glass tanks
final Object bronzeRotorOrIronBars = WarpDriveConfig.getOreOrItemStack("ore:rotorBronze", 0, // GregTech CE Bronze rotor final Object bronzeRotorOrIronBars = WarpDriveConfig.getOreOrItemStack(
"ore:plateBronze", 8, // IC2 or ThermalExpansion Bronze plate "ore:rotorBronze", 0, // GregTech CE Bronze rotor
"ore:gearIronInfinity", 0, // EnderIO Infinity Bimetal Gear "ore:plateBronze", 8, // IC2 or ThermalExpansion Bronze plate
"ore:barsIron", 0, // Ore dictionary iron bars "ore:gearIronInfinity", 0, // EnderIO Infinity Bimetal Gear
"minecraft:iron_bars", 0); // Vanilla iron bars "ore:barsIron", 0, // Ore dictionary iron bars
"minecraft:iron_bars", 0 );
WarpDrive.register(new ShapedOreRecipe(groupMachines, WarpDrive.register(new ShapedOreRecipe(groupMachines,
new ItemStack(WarpDrive.blockAirGeneratorTiered[EnumTier.BASIC.getIndex()]), false, "aba", "ata", "gmp", new ItemStack(WarpDrive.blockAirGeneratorTiered[EnumTier.BASIC.getIndex()]), false, "aba", "ata", "gmp",
'p', ItemComponent.getItemStack(EnumComponentType.POWER_INTERFACE), 'p', ItemComponent.getItemStack(EnumComponentType.POWER_INTERFACE),
@ -1088,15 +1104,17 @@ public class Recipes {
private static void initDetection() { private static void initDetection() {
// Radar is 1 motor, 4 Titanium plate (diamond), 1 Quarztite rod (nether quartz), 1 Computer interface, 1 HV Machine casing, 1 Power interface // Radar is 1 motor, 4 Titanium plate (diamond), 1 Quarztite rod (nether quartz), 1 Computer interface, 1 HV Machine casing, 1 Power interface
final Object oreCloakingPlate = WarpDriveConfig.getOreOrItemStack("ore:plateTitanium", 0, // GregTech final Object oreCloakingPlate = WarpDriveConfig.getOreOrItemStack(
"ore:plateEnderium", 0, // ThermalExpansion "ore:plateTitanium", 0, // GregTech
"ore:ingotVibrantAlloy", 0, // EnderIO "ore:plateEnderium", 0, // ThermalExpansion
"ore:plateAlloyIridium", 0, // IndustrialCraft2 "ore:ingotVibrantAlloy", 0, // EnderIO
"ore:gemQuartz", 0); // vanilla "ore:plateAlloyIridium", 0, // IndustrialCraft2
final Object oreAntenna = WarpDriveConfig.getOreOrItemStack("ore:stickQuartzite", 0, // GregTech "ore:gemQuartz", 0 );
"ore:ingotSignalum", 0, // ThermalExpansion final Object oreAntenna = WarpDriveConfig.getOreOrItemStack(
"ore:nuggetPulsatingIron", 0, // EnderIO "ore:stickQuartzite", 0, // GregTech
"minecraft:ghast_tear", 0); // vanilla "ore:ingotSignalum", 0, // ThermalExpansion
"ore:nuggetPulsatingIron", 0, // EnderIO
"minecraft:ghast_tear", 0 );
WarpDrive.register(new ShapedOreRecipe(groupMachines, WarpDrive.register(new ShapedOreRecipe(groupMachines,
new ItemStack(WarpDrive.blockRadar), false, "PAP", "PtP", "pmc", new ItemStack(WarpDrive.blockRadar), false, "PAP", "PtP", "pmc",
't', itemStackMotors[2], 't', itemStackMotors[2],
@ -1138,24 +1156,27 @@ public class Recipes {
'p', ItemComponent.getItemStack(EnumComponentType.POWER_INTERFACE))); 'p', ItemComponent.getItemStack(EnumComponentType.POWER_INTERFACE)));
// Cloaking coil is 1 Titanium plate, 4 Reinforced iridium plate, 1 EV Machine casing (Ti) or 1 Beacon, 4 Emerald, 4 Diamond // Cloaking coil is 1 Titanium plate, 4 Reinforced iridium plate, 1 EV Machine casing (Ti) or 1 Beacon, 4 Emerald, 4 Diamond
final Object oreGoldIngotOrCoil = WarpDriveConfig.getOreOrItemStack("gregtech:wire_coil", 3, // GregTech Tungstensteel Coil block final Object oreGoldIngotOrCoil = WarpDriveConfig.getOreOrItemStack(
"ic2:crafting", 5, // IC2 Coil "gregtech:wire_coil", 3, // GregTech Tungstensteel Coil block
"thermalfoundation:material", 515, // ThermalFoundation Redstone conductance coil "ic2:crafting", 5, // IC2 Coil
"immersiveengineering:connector", 8, // ImmersiveEngineering HV Transformer (coils wires are too cheap) "thermalfoundation:material", 515, // ThermalFoundation Redstone conductance coil
"enderio:item_power_conduit", 2, // EnderIO Ender energy conduit "immersiveengineering:connector", 8, // ImmersiveEngineering HV Transformer (coils wires are too cheap)
"minecraft:gold_ingot", 0); "enderio:item_power_conduit", 2, // EnderIO Ender energy conduit
final Object oreGoldIngotOrTitaniumPlate = WarpDriveConfig.getOreOrItemStack("ore:plateTitanium", 0, "minecraft:gold_ingot", 0 );
"advanced_solar_panels:crafting", 0, // ASP Sunnarium final Object oreGoldIngotOrTitaniumPlate = WarpDriveConfig.getOreOrItemStack(
"ore:plateDenseSteel", 0, "ore:plateTitanium", 0,
"thermalfoundation:glass", 6, // ThermalFoundation Hardened Platinum Glass "advanced_solar_panels:crafting", 0, // ASP Sunnarium
"immersiveengineering:metal_device1", 3, // ImmersiveEngineering Thermoelectric Generator "ore:plateDenseSteel", 0,
"enderio:item_alloy_ingot", 2, // EnderIO Vibrant alloy (ore:ingotVibrantAlloy) "thermalfoundation:glass", 6, // ThermalFoundation Hardened Platinum Glass
"minecraft:gold_ingot", 0); "immersiveengineering:metal_device1", 3, // ImmersiveEngineering Thermoelectric Generator
final Object oreEmeraldOrIridiumPlate = WarpDriveConfig.getOreOrItemStack("ore:plateIridium", 0, // GregTech "enderio:item_alloy_ingot", 2, // EnderIO Vibrant alloy (ore:ingotVibrantAlloy)
"ore:plateAlloyIridium", 0, // IndustrialCraft2 "minecraft:gold_ingot", 0 );
"enderio:item_material", 42, // EnderIO Frank'N'Zombie final Object oreEmeraldOrIridiumPlate = WarpDriveConfig.getOreOrItemStack(
"ore:ingotLumium", 0, // ThermalFoundation lumium ingot "ore:plateIridium", 0, // GregTech
"ore:gemEmerald", 0); "ore:plateAlloyIridium", 0, // IndustrialCraft2
"enderio:item_material", 42, // EnderIO Frank'N'Zombie
"ore:ingotLumium", 0, // ThermalFoundation lumium ingot
"ore:gemEmerald", 0 );
WarpDrive.register(new ShapedOreRecipe(groupMachines, WarpDrive.register(new ShapedOreRecipe(groupMachines,
new ItemStack(WarpDrive.blockCloakingCoil), false, "iti", "cmc", "iti", new ItemStack(WarpDrive.blockCloakingCoil), false, "iti", "cmc", "iti",
't', oreGoldIngotOrTitaniumPlate, 't', oreGoldIngotOrTitaniumPlate,
@ -1515,11 +1536,12 @@ public class Recipes {
} }
// Tier 2 = 4 Tier 1, 4 GregTech 5 TungstenSteel reinforced block, IC2 Carbon plate, DarkSteel ingots or Obsidian, gives 4 // Tier 2 = 4 Tier 1, 4 GregTech 5 TungstenSteel reinforced block, IC2 Carbon plate, DarkSteel ingots or Obsidian, gives 4
final Object oreObsidianTungstenSteelPlate = WarpDriveConfig.getOreOrItemStack("ore:plateTungstenSteel", 0, // GregTech CE TungstenSteel Plate final Object oreObsidianTungstenSteelPlate = WarpDriveConfig.getOreOrItemStack(
"ic2:crafting", 15, // IC2 Carbon plate "ore:plateTungstenSteel", 0, // GregTech CE TungstenSteel Plate
"thermalfoundation:glass", 3, // ThermalFoundation Hardened glass "ic2:crafting", 15, // IC2 Carbon plate
"ore:ingotDarkSteel", 0, // EnderIO DarkSteel ingot "thermalfoundation:glass", 3, // ThermalFoundation Hardened glass
"minecraft:obsidian", 0); "ore:ingotDarkSteel", 0, // EnderIO DarkSteel ingot
"minecraft:obsidian", 0 );
for (final EnumDyeColor enumDyeColor : EnumDyeColor.values()) { for (final EnumDyeColor enumDyeColor : EnumDyeColor.values()) {
final int metadataColor = enumDyeColor.getMetadata(); final int metadataColor = enumDyeColor.getMetadata();
WarpDrive.register(new ShapedOreRecipe(groupTaintedHulls, WarpDrive.register(new ShapedOreRecipe(groupTaintedHulls,
@ -1534,10 +1556,11 @@ public class Recipes {
} }
// Tier 3 = 4 Tier 2, 1 GregTech Naquadah plate, IC2 Iridium plate, EnderIO Pulsating crystal or Diamond, gives 4 // Tier 3 = 4 Tier 2, 1 GregTech Naquadah plate, IC2 Iridium plate, EnderIO Pulsating crystal or Diamond, gives 4
final Object oreDiamondOrNaquadahPlate = WarpDriveConfig.getOreOrItemStack("ore:plateNaquadah", 0, // GregTech CE Naquadah plate final Object oreDiamondOrNaquadahPlate = WarpDriveConfig.getOreOrItemStack(
"ore:plateAlloyIridium", 0, // IC2 Iridium alloy "ore:plateNaquadah", 0, // GregTech CE Naquadah plate
"ore:itemPulsatingCrystal", 0, // EnderIO Pulsating crystal "ore:plateAlloyIridium", 0, // IC2 Iridium alloy
"ore:gemDiamond", 0); "ore:itemPulsatingCrystal", 0, // EnderIO Pulsating crystal
"ore:gemDiamond", 0 );
for (final EnumDyeColor enumDyeColor : EnumDyeColor.values()) { for (final EnumDyeColor enumDyeColor : EnumDyeColor.values()) {
final int metadataColor = enumDyeColor.getMetadata(); final int metadataColor = enumDyeColor.getMetadata();
WarpDrive.register(new ShapedOreRecipe(groupTaintedHulls, WarpDrive.register(new ShapedOreRecipe(groupTaintedHulls,
@ -1724,10 +1747,11 @@ public class Recipes {
'b', ItemComponent.getItemStack(EnumComponentType.MEMORY_CRYSTAL))); 'b', ItemComponent.getItemStack(EnumComponentType.MEMORY_CRYSTAL)));
// Laser lift is ... // Laser lift is ...
final Object enderPearlOrMagnetizer = WarpDriveConfig.getOreOrItemStack("gregtech:machine", 420, // Gregtech Basic polarizer final Object enderPearlOrMagnetizer = WarpDriveConfig.getOreOrItemStack(
"ic2:te", 37, // IC2 Magnetizer "gregtech:machine", 420, // Gregtech Basic polarizer
"ore:ingotPulsatingIron", 0, // EnderIO iron ingot with ender pearl "ic2:te", 37, // IC2 Magnetizer
"minecraft:ender_pearl", 0); "ore:ingotPulsatingIron", 0, // EnderIO iron ingot with ender pearl
"minecraft:ender_pearl", 0 );
WarpDrive.register(new ShapedOreRecipe(groupMachines, WarpDrive.register(new ShapedOreRecipe(groupMachines,
new ItemStack(WarpDrive.blockLift), false, "wlw", "per", "glg", new ItemStack(WarpDrive.blockLift), false, "wlw", "per", "glg",
'r', Items.REDSTONE, 'r', Items.REDSTONE,

View file

@ -56,7 +56,7 @@ public class GlobalPosition {
if (chunk != null) { if (chunk != null) {
isLoaded = !chunk.unloadQueued; isLoaded = !chunk.unloadQueued;
} }
} catch (NoSuchFieldError exception) { } catch (final NoSuchFieldError exception) {
isLoaded = chunkProviderServer.chunkExists(x >> 4, z >> 4); isLoaded = chunkProviderServer.chunkExists(x >> 4, z >> 4);
} }
// skip unloaded chunks // skip unloaded chunks

View file

@ -8,6 +8,7 @@ import cr0s.warpdrive.block.movement.BlockShipCore;
import cr0s.warpdrive.block.movement.TileEntityShipCore; import cr0s.warpdrive.block.movement.TileEntityShipCore;
import cr0s.warpdrive.config.WarpDriveConfig; import cr0s.warpdrive.config.WarpDriveConfig;
import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -225,7 +226,7 @@ public class StarMapRegistry {
return String.format("No ship found with name '%s'", nameShip); return String.format("No ship found with name '%s'", nameShip);
} }
public StarMapRegistryItem findNearest(final EnumStarMapEntryType enumStarMapEntryType, final World world, final BlockPos blockPos) { public StarMapRegistryItem findNearest(final EnumStarMapEntryType enumStarMapEntryType, @Nonnull final World world, @Nonnull final BlockPos blockPos) {
final CopyOnWriteArraySet<StarMapRegistryItem> setStarMapRegistryItems = registry.get(world.provider.getDimension()); final CopyOnWriteArraySet<StarMapRegistryItem> setStarMapRegistryItems = registry.get(world.provider.getDimension());
if (setStarMapRegistryItems == null) { if (setStarMapRegistryItems == null) {
return null; return null;
@ -253,7 +254,7 @@ public class StarMapRegistry {
return result; return result;
} }
public void onBlockUpdated(final World world, final BlockPos blockPos, final IBlockState blockState) { public void onBlockUpdated(@Nonnull final World world, @Nonnull final BlockPos blockPos, final IBlockState blockState) {
final CopyOnWriteArraySet<StarMapRegistryItem> setStarMapRegistryItems = registry.get(world.provider.getDimension()); final CopyOnWriteArraySet<StarMapRegistryItem> setStarMapRegistryItems = registry.get(world.provider.getDimension());
if (setStarMapRegistryItems == null) { if (setStarMapRegistryItems == null) {
return; return;
@ -435,7 +436,7 @@ public class StarMapRegistry {
} }
} }
public boolean isWarpCoreIntersectsWithOthers(final TileEntityShipCore shipCore1) { public boolean isWarpCoreIntersectsWithOthers(@Nonnull final TileEntityShipCore shipCore1) {
cleanup(); cleanup();
if (!shipCore1.isValid()) { if (!shipCore1.isValid()) {

View file

@ -3,6 +3,7 @@ package cr0s.warpdrive.data;
import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.api.IStarMapRegistryTileEntity; import cr0s.warpdrive.api.IStarMapRegistryTileEntity;
import javax.annotation.Nonnull;
import java.util.UUID; import java.util.UUID;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -87,7 +88,7 @@ public class StarMapRegistryItem extends GlobalPosition {
name = tileEntity.getStarMapName(); name = tileEntity.getStarMapName();
} }
public boolean contains(final BlockPos blockPos) { public boolean contains(@Nonnull final BlockPos blockPos) {
return minX <= blockPos.getX() && blockPos.getX() <= maxX return minX <= blockPos.getX() && blockPos.getX() <= maxX
&& minY <= blockPos.getY() && blockPos.getY() <= maxY && minY <= blockPos.getY() && blockPos.getY() <= maxY
&& minZ <= blockPos.getZ() && blockPos.getZ() <= maxZ; && minZ <= blockPos.getZ() && blockPos.getZ() <= maxZ;

View file

@ -2,6 +2,8 @@ package cr0s.warpdrive.event;
import cr0s.warpdrive.api.IItemBase; import cr0s.warpdrive.api.IItemBase;
import javax.annotation.Nonnull;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -11,7 +13,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class ItemHandler { public class ItemHandler {
@SubscribeEvent @SubscribeEvent
public void onItemExpireEvent(final ItemExpireEvent event) { public void onItemExpireEvent(@Nonnull final ItemExpireEvent event) {
if (event.getEntityItem() == null) { if (event.getEntityItem() == null) {
return; return;
} }

View file

@ -26,6 +26,7 @@ import cr0s.warpdrive.data.Vector3;
import cr0s.warpdrive.data.VectorI; import cr0s.warpdrive.data.VectorI;
import cr0s.warpdrive.network.PacketHandler; import cr0s.warpdrive.network.PacketHandler;
import javax.annotation.Nonnull;
import java.io.File; import java.io.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
@ -95,7 +96,7 @@ public class JumpSequencer extends AbstractSequencer {
protected final JumpShip ship; protected final JumpShip ship;
private boolean betweenWorlds; private boolean betweenWorlds;
private boolean isPluginCheckDone = false; private boolean isPluginCheckDone = false;
private WarpDriveText firstAdjustmentReason = new WarpDriveText(); private WarpDriveText firstAdjustmentReason = null;
private long msCounter = 0; private long msCounter = 0;
private int ticks = 0; private int ticks = 0;
@ -673,13 +674,15 @@ public class JumpSequencer extends AbstractSequencer {
} }
{ {
final BlockPos target1 = transformation.apply(ship.minX, ship.minY, ship.minZ); final BlockPos blockPosMinAtTarget = transformation.apply(ship.minX, ship.minY, ship.minZ);
final BlockPos target2 = transformation.apply(ship.maxX, ship.maxY, ship.maxZ); final BlockPos blockPosMaxAtTarget = transformation.apply(ship.maxX, ship.maxY, ship.maxZ);
final AxisAlignedBB aabbSource = new AxisAlignedBB(ship.minX, ship.minY, ship.minZ, ship.maxX, ship.maxY, ship.maxZ); final AxisAlignedBB aabbSource = new AxisAlignedBB(
ship.minX, ship.minY, ship.minZ,
ship.maxX, ship.maxY, ship.maxZ);
aabbSource.expand(1.0D, 1.0D, 1.0D); aabbSource.expand(1.0D, 1.0D, 1.0D);
final AxisAlignedBB aabbTarget = new AxisAlignedBB( final AxisAlignedBB aabbTarget = new AxisAlignedBB(
Math.min(target1.getX(), target2.getX()), Math.min(target1.getY(), target2.getY()), Math.min(target1.getZ(), target2.getZ()), blockPosMinAtTarget.getX(), blockPosMinAtTarget.getY(), blockPosMinAtTarget.getZ(),
Math.max(target1.getX(), target2.getX()), Math.max(target1.getY(), target2.getY()), Math.max(target1.getZ(), target2.getZ())); blockPosMaxAtTarget.getX(), blockPosMaxAtTarget.getY(), blockPosMaxAtTarget.getZ() );
// Validate positions aren't overlapping // Validate positions aren't overlapping
if ( shipMovementType != EnumShipMovementType.INSTANTIATE if ( shipMovementType != EnumShipMovementType.INSTANTIATE
&& shipMovementType != EnumShipMovementType.RESTORE && shipMovementType != EnumShipMovementType.RESTORE
@ -824,7 +827,7 @@ public class JumpSequencer extends AbstractSequencer {
} }
} }
protected boolean computeTargetWorld(final CelestialObject celestialObjectSource, final EnumShipMovementType shipMovementType, final WarpDriveText reason) { protected boolean computeTargetWorld(final CelestialObject celestialObjectSource, @Nonnull final EnumShipMovementType shipMovementType, final WarpDriveText reason) {
switch (shipMovementType) { switch (shipMovementType) {
case INSTANTIATE: case INSTANTIATE:
case RESTORE: case RESTORE:
@ -1105,7 +1108,7 @@ public class JumpSequencer extends AbstractSequencer {
break; break;
case NONE: case NONE:
break; // break;
} }
} }
@ -1286,7 +1289,6 @@ public class JumpSequencer extends AbstractSequencer {
/** /**
* Finishing jump: cleanup, collision effects and delete self * Finishing jump: cleanup, collision effects and delete self
**/ **/
@SuppressWarnings("unchecked")
protected void state_finishing() { protected void state_finishing() {
LocalProfiler.start("Jump.finishing()"); LocalProfiler.start("Jump.finishing()");
@ -1663,6 +1665,7 @@ public class JumpSequencer extends AbstractSequencer {
WarpDrive.logger.warn(String.format("Second NBT is %s", nbtTagCompound2)); WarpDrive.logger.warn(String.format("Second NBT is %s", nbtTagCompound2));
} }
return 0; return 0;
} else { } else {
return 1; return 1;
} }

View file

@ -45,7 +45,7 @@ public class TooltipHandler {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.HIGHEST) @SubscribeEvent(priority = EventPriority.HIGHEST)
public void onTooltipEvent_first(final ItemTooltipEvent event) { public void onTooltipEvent_first(@Nonnull final ItemTooltipEvent event) {
if (event.getEntityPlayer() == null) { if (event.getEntityPlayer() == null) {
return; return;
} }
@ -64,7 +64,7 @@ public class TooltipHandler {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.LOWEST) @SubscribeEvent(priority = EventPriority.LOWEST)
public void onTooltipEvent_last(final ItemTooltipEvent event) { public void onTooltipEvent_last(@Nonnull final ItemTooltipEvent event) {
if (event.getEntityPlayer() == null) { if (event.getEntityPlayer() == null) {
return; return;
} }

View file

@ -46,9 +46,9 @@ public class ItemAbstractBase extends Item implements IItemBase {
ClientProxy.modelInitialisation(this); ClientProxy.modelInitialisation(this);
} }
@Override
@Nonnull @Nonnull
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override
public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) { public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) {
return ClientProxy.getModelResourceLocation(itemStack); return ClientProxy.getModelResourceLocation(itemStack);
} }

View file

@ -13,6 +13,7 @@ import net.minecraft.block.Block;
import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -34,6 +35,7 @@ public class ItemComponent extends ItemAbstractBase implements IAirContainerItem
itemStackCache = new ItemStack[EnumComponentType.length]; itemStackCache = new ItemStack[EnumComponentType.length];
} }
@Nonnull
public static ItemStack getItemStack(final EnumComponentType enumComponentType) { public static ItemStack getItemStack(final EnumComponentType enumComponentType) {
if (enumComponentType != null) { if (enumComponentType != null) {
final int damage = enumComponentType.ordinal(); final int damage = enumComponentType.ordinal();
@ -42,7 +44,7 @@ public class ItemComponent extends ItemAbstractBase implements IAirContainerItem
} }
return itemStackCache[damage]; return itemStackCache[damage];
} }
return null; return new ItemStack(Blocks.FIRE);
} }
public static ItemStack getItemStackNoCache(final EnumComponentType enumComponentType, final int amount) { public static ItemStack getItemStackNoCache(final EnumComponentType enumComponentType, final int amount) {
@ -70,8 +72,8 @@ public class ItemComponent extends ItemAbstractBase implements IAirContainerItem
} }
@Nonnull @Nonnull
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override
public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) { public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) {
final int damage = itemStack.getItemDamage(); final int damage = itemStack.getItemDamage();
ResourceLocation resourceLocation = getRegistryName(); ResourceLocation resourceLocation = getRegistryName();

View file

@ -45,7 +45,7 @@ public class ItemElectromagneticCell extends ItemAbstractBase implements IPartic
addPropertyOverride(new ResourceLocation(WarpDrive.MODID, "fill"), new IItemPropertyGetter() { addPropertyOverride(new ResourceLocation(WarpDrive.MODID, "fill"), new IItemPropertyGetter() {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public float apply(@Nonnull ItemStack itemStack, @Nullable World world, @Nullable EntityLivingBase entity) { public float apply(@Nonnull final ItemStack itemStack, @Nullable final World world, @Nullable final EntityLivingBase entity) {
final ParticleStack particleStack = getParticleStack(itemStack); final ParticleStack particleStack = getParticleStack(itemStack);
if (particleStack != null) { if (particleStack != null) {
return (float) particleStack.getAmount() / getCapacity(itemStack); return (float) particleStack.getAmount() / getCapacity(itemStack);
@ -56,8 +56,9 @@ public class ItemElectromagneticCell extends ItemAbstractBase implements IPartic
} }
@Nonnull @Nonnull
@SideOnly(Side.CLIENT)
@Override @Override
public ModelResourceLocation getModelResourceLocation(ItemStack itemStack) { public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) {
String variant = "empty"; String variant = "empty";
final ParticleStack particleStack = getParticleStack(itemStack); final ParticleStack particleStack = getParticleStack(itemStack);
if (particleStack != null) { if (particleStack != null) {

View file

@ -15,6 +15,7 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -42,6 +43,7 @@ public class ItemForceFieldShape extends ItemAbstractBase {
itemStackCache = new ItemStack[EnumForceFieldShape.length]; itemStackCache = new ItemStack[EnumForceFieldShape.length];
} }
@Nonnull
public static ItemStack getItemStack(final EnumForceFieldShape forceFieldShape) { public static ItemStack getItemStack(final EnumForceFieldShape forceFieldShape) {
if (forceFieldShape != null) { if (forceFieldShape != null) {
final int damage = forceFieldShape.ordinal(); final int damage = forceFieldShape.ordinal();
@ -50,7 +52,7 @@ public class ItemForceFieldShape extends ItemAbstractBase {
} }
return itemStackCache[damage]; return itemStackCache[damage];
} }
return null; return new ItemStack(Blocks.FIRE);
} }
public static ItemStack getItemStackNoCache(final EnumForceFieldShape forceFieldShape, final int amount) { public static ItemStack getItemStackNoCache(final EnumForceFieldShape forceFieldShape, final int amount) {
@ -80,8 +82,8 @@ public class ItemForceFieldShape extends ItemAbstractBase {
} }
@Nonnull @Nonnull
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override
public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) { public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) {
final int damage = itemStack.getItemDamage(); final int damage = itemStack.getItemDamage();
ResourceLocation resourceLocation = getRegistryName(); ResourceLocation resourceLocation = getRegistryName();

View file

@ -79,8 +79,8 @@ public class ItemForceFieldUpgrade extends ItemAbstractBase {
} }
@Nonnull @Nonnull
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override
public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) { public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) {
final int damage = itemStack.getItemDamage(); final int damage = itemStack.getItemDamage();
ResourceLocation resourceLocation = getRegistryName(); ResourceLocation resourceLocation = getRegistryName();

View file

@ -43,7 +43,7 @@ public class ItemPlasmaTorch extends ItemAbstractBase implements IParticleContai
addPropertyOverride(new ResourceLocation(WarpDrive.MODID, "fill"), new IItemPropertyGetter() { addPropertyOverride(new ResourceLocation(WarpDrive.MODID, "fill"), new IItemPropertyGetter() {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public float apply(@Nonnull ItemStack itemStack, @Nullable World world, @Nullable EntityLivingBase entity) { public float apply(@Nonnull final ItemStack itemStack, @Nullable final World world, @Nullable final EntityLivingBase entity) {
final ParticleStack particleStack = getParticleStack(itemStack); final ParticleStack particleStack = getParticleStack(itemStack);
if (particleStack != null) { if (particleStack != null) {
return (float) particleStack.getAmount() / getCapacity(itemStack); return (float) particleStack.getAmount() / getCapacity(itemStack);
@ -54,8 +54,9 @@ public class ItemPlasmaTorch extends ItemAbstractBase implements IParticleContai
} }
@Nonnull @Nonnull
@SideOnly(Side.CLIENT)
@Override @Override
public ModelResourceLocation getModelResourceLocation(ItemStack itemStack) { public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) {
String variant = "empty"; String variant = "empty";
final ParticleStack particleStack = getParticleStack(itemStack); final ParticleStack particleStack = getParticleStack(itemStack);
if (particleStack != null) { if (particleStack != null) {
@ -175,7 +176,7 @@ public class ItemPlasmaTorch extends ItemAbstractBase implements IParticleContai
} }
@Override @Override
public int getCapacity(ItemStack container) { public int getCapacity(final ItemStack container) {
return WarpDriveConfig.PLASMA_TORCH_CAPACITY_BY_TIER[enumTier.getIndex()]; return WarpDriveConfig.PLASMA_TORCH_CAPACITY_BY_TIER[enumTier.getIndex()];
} }

View file

@ -67,8 +67,8 @@ public class ItemTuningDriver extends ItemAbstractBase implements IWarpTool {
} }
@Nonnull @Nonnull
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override
public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) { public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) {
final int damage = itemStack.getItemDamage(); final int damage = itemStack.getItemDamage();
ResourceLocation resourceLocation = getRegistryName(); ResourceLocation resourceLocation = getRegistryName();
@ -266,9 +266,9 @@ public class ItemTuningDriver extends ItemAbstractBase implements IWarpTool {
@Nonnull @Nonnull
@Override @Override
public EnumActionResult onItemUse(final EntityPlayer entityPlayer, public EnumActionResult onItemUse(@Nonnull final EntityPlayer entityPlayer,
final World world, final BlockPos blockPos, final EnumHand hand, @Nonnull final World world, @Nonnull final BlockPos blockPos, @Nonnull final EnumHand hand,
final EnumFacing facing, final float hitX, final float hitY, final float hitZ) { @Nonnull final EnumFacing facing, final float hitX, final float hitY, final float hitZ) {
if (world.isRemote) { if (world.isRemote) {
return EnumActionResult.FAIL; return EnumActionResult.FAIL;
} }

View file

@ -59,8 +59,8 @@ public class ItemTuningFork extends ItemAbstractBase implements IWarpTool {
} }
@Nonnull @Nonnull
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override
public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) { public ModelResourceLocation getModelResourceLocation(final ItemStack itemStack) {
final int damage = itemStack.getItemDamage(); final int damage = itemStack.getItemDamage();
ResourceLocation resourceLocation = getRegistryName(); ResourceLocation resourceLocation = getRegistryName();
@ -104,9 +104,9 @@ public class ItemTuningFork extends ItemAbstractBase implements IWarpTool {
@Nonnull @Nonnull
@Override @Override
public EnumActionResult onItemUse(final EntityPlayer entityPlayer, public EnumActionResult onItemUse(@Nonnull final EntityPlayer entityPlayer,
final World world, final BlockPos blockPos, final EnumHand hand, @Nonnull final World world, @Nonnull final BlockPos blockPos, @Nonnull final EnumHand hand,
final EnumFacing facing, final float hitX, final float hitY, final float hitZ) { @Nonnull final EnumFacing enumFacing, final float hitX, final float hitY, final float hitZ) {
if (world.isRemote) { if (world.isRemote) {
return EnumActionResult.FAIL; return EnumActionResult.FAIL;
} }

View file

@ -31,9 +31,9 @@ public class ItemWrench extends ItemAbstractBase implements IWarpTool {
@Nonnull @Nonnull
@Override @Override
public EnumActionResult onItemUse(final EntityPlayer entityPlayer, public EnumActionResult onItemUse(@Nonnull final EntityPlayer entityPlayer,
final World world, final BlockPos blockPos, final EnumHand hand, @Nonnull final World world, @Nonnull final BlockPos blockPos, @Nonnull final EnumHand hand,
final EnumFacing facing, final float hitX, final float hitY, final float hitZ) { @Nonnull final EnumFacing facing, final float hitX, final float hitY, final float hitZ) {
if (world.isRemote) { if (world.isRemote) {
return EnumActionResult.FAIL; return EnumActionResult.FAIL;
} }