Auto Format code
This commit is contained in:
parent
112b1657cf
commit
796df6c055
503 changed files with 12260 additions and 16291 deletions
|
@ -12,13 +12,13 @@ import net.minecraft.world.World;
|
|||
|
||||
public class IC2WrenchHelper {
|
||||
|
||||
static ItemToolWrench wrench;
|
||||
static ItemToolWrench wrench;
|
||||
|
||||
public static EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
||||
EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand){
|
||||
if(wrench == null){
|
||||
wrench = (ItemToolWrench) IC2Items.getItem("wrench").getItem();
|
||||
}
|
||||
return wrench.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
|
||||
}
|
||||
public static EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
||||
EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
|
||||
if (wrench == null) {
|
||||
wrench = (ItemToolWrench) IC2Items.getItem("wrench").getItem();
|
||||
}
|
||||
return wrench.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,85 +8,82 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class OreDictUtils
|
||||
{
|
||||
public class OreDictUtils {
|
||||
|
||||
public static String toFirstLower(String string) {
|
||||
if(string == null || string.isEmpty()) return string;
|
||||
if (string == null || string.isEmpty())
|
||||
return string;
|
||||
return Character.toLowerCase(string.charAt(0)) + string.substring(1);
|
||||
}
|
||||
|
||||
public static String toFirstUpper(String string) {
|
||||
if(string.isEmpty()) return string;
|
||||
if (string.isEmpty())
|
||||
return string;
|
||||
return Character.toUpperCase(string.charAt(0)) + string.substring(1);
|
||||
}
|
||||
|
||||
public static String joinDictName(String prefix, String name) {
|
||||
return prefix + toFirstUpper(name);
|
||||
}
|
||||
public static String joinDictName(String prefix, String name) {
|
||||
return prefix + toFirstUpper(name);
|
||||
}
|
||||
|
||||
public static String[] getDictData(String prefixed) {
|
||||
StringBuilder prefixBuilder = new StringBuilder();
|
||||
StringBuilder nameBuilder = new StringBuilder();
|
||||
boolean prefixFinished = false;
|
||||
for(int i = 0; i < prefixed.length(); i++) {
|
||||
char charAt = prefixed.charAt(i);
|
||||
if(!prefixFinished) {
|
||||
if(Character.isUpperCase(charAt)) {
|
||||
nameBuilder.append(Character.toLowerCase(charAt));
|
||||
prefixFinished = true;
|
||||
} else prefixBuilder.append(charAt);
|
||||
} else nameBuilder.append(charAt);
|
||||
}
|
||||
return new String[] {
|
||||
prefixBuilder.toString(),
|
||||
nameBuilder.toString()
|
||||
};
|
||||
}
|
||||
public static String[] getDictData(String prefixed) {
|
||||
StringBuilder prefixBuilder = new StringBuilder();
|
||||
StringBuilder nameBuilder = new StringBuilder();
|
||||
boolean prefixFinished = false;
|
||||
for (int i = 0; i < prefixed.length(); i++) {
|
||||
char charAt = prefixed.charAt(i);
|
||||
if (!prefixFinished) {
|
||||
if (Character.isUpperCase(charAt)) {
|
||||
nameBuilder.append(Character.toLowerCase(charAt));
|
||||
prefixFinished = true;
|
||||
} else
|
||||
prefixBuilder.append(charAt);
|
||||
} else
|
||||
nameBuilder.append(charAt);
|
||||
}
|
||||
return new String[] {
|
||||
prefixBuilder.toString(),
|
||||
nameBuilder.toString()
|
||||
};
|
||||
}
|
||||
|
||||
public static boolean isDictPrefixed(String name, String... prefixes) {
|
||||
for(String prefix : prefixes)
|
||||
if(name.startsWith(prefix))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
public static boolean isDictPrefixed(String name, String... prefixes) {
|
||||
for (String prefix : prefixes)
|
||||
if (name.startsWith(prefix))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack getDictOreOrNull(String name, int amount) {
|
||||
List<ItemStack> ores = OreDictionary.getOres(name);
|
||||
if(ores.isEmpty()) return null;
|
||||
ItemStack ore = ores.get(0);
|
||||
ore.stackSize = amount;
|
||||
return ore;
|
||||
}
|
||||
public static ItemStack getDictOreOrNull(String name, int amount) {
|
||||
List<ItemStack> ores = OreDictionary.getOres(name);
|
||||
if (ores.isEmpty())
|
||||
return null;
|
||||
ItemStack ore = ores.get(0);
|
||||
ore.stackSize = amount;
|
||||
return ore;
|
||||
}
|
||||
|
||||
public static boolean isOre(Block block, String oreName)
|
||||
{
|
||||
public static boolean isOre(Block block, String oreName) {
|
||||
return isOre(new ItemStack(Item.getItemFromBlock(block)), oreName);
|
||||
}
|
||||
|
||||
public static boolean isOre(IBlockState state, String oreName)
|
||||
{
|
||||
public static boolean isOre(IBlockState state, String oreName) {
|
||||
return isOre(
|
||||
new ItemStack(Item.getItemFromBlock(state.getBlock()), 1, state.getBlock().getMetaFromState(state)),
|
||||
oreName);
|
||||
new ItemStack(Item.getItemFromBlock(state.getBlock()), 1, state.getBlock().getMetaFromState(state)),
|
||||
oreName);
|
||||
}
|
||||
|
||||
public static boolean isOre(Item item, String oreName)
|
||||
{
|
||||
public static boolean isOre(Item item, String oreName) {
|
||||
return isOre(new ItemStack(item), oreName);
|
||||
}
|
||||
|
||||
public static boolean isOre(ItemStack stack, String oreName)
|
||||
{
|
||||
if (stack != null && stack.getItem() != null && oreName != null)
|
||||
{
|
||||
public static boolean isOre(ItemStack stack, String oreName) {
|
||||
if (stack != null && stack.getItem() != null && oreName != null) {
|
||||
int id = OreDictionary.getOreID(oreName);
|
||||
int[] ids = OreDictionary.getOreIDs(stack);
|
||||
|
||||
for (int i : ids)
|
||||
{
|
||||
if (id == i)
|
||||
{
|
||||
for (int i : ids) {
|
||||
if (id == i) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,7 @@ package techreborn.utils;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.items.DynamicCell;
|
||||
|
||||
public class RecipeUtils
|
||||
{
|
||||
public class RecipeUtils {
|
||||
public static ItemStack getEmptyCell(int stackSize) {
|
||||
return DynamicCell.getEmptyCell(stackSize);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package techreborn.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -12,16 +10,16 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
|||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by Mark on 23/03/2016.
|
||||
*/
|
||||
public class StackWIPHandler
|
||||
{
|
||||
public class StackWIPHandler {
|
||||
ArrayList<Block> wipBlocks = new ArrayList<>();
|
||||
public static ArrayList<ItemStack> devHeads = new ArrayList<>();
|
||||
|
||||
public StackWIPHandler()
|
||||
{
|
||||
public StackWIPHandler() {
|
||||
wipBlocks.add(ModBlocks.MagicalAbsorber);
|
||||
wipBlocks.add(ModBlocks.ChunkLoader);
|
||||
wipBlocks.add(ModBlocks.ElectricCraftingTable);
|
||||
|
@ -34,24 +32,21 @@ public class StackWIPHandler
|
|||
addHead("Rushmead");
|
||||
}
|
||||
|
||||
private void addHead(String name){
|
||||
private void addHead(String name) {
|
||||
ItemStack head = new ItemStack(Items.SKULL, 1, 3);
|
||||
head.setTagCompound(new NBTTagCompound());
|
||||
head.getTagCompound().setTag("SkullOwner", new NBTTagString(name));
|
||||
devHeads.add(head);
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void toolTip(ItemTooltipEvent event)
|
||||
{
|
||||
public void toolTip(ItemTooltipEvent event) {
|
||||
Block block = Block.getBlockFromItem(event.getItemStack().getItem());
|
||||
if (block != null && wipBlocks.contains(block))
|
||||
{
|
||||
if (block != null && wipBlocks.contains(block)) {
|
||||
event.getToolTip().add(TextFormatting.RED + "WIP Coming Soon");
|
||||
}
|
||||
|
||||
if(devHeads.contains(event.getItemStack()))
|
||||
{
|
||||
|
||||
if (devHeads.contains(event.getItemStack())) {
|
||||
event.getToolTip().add(TextFormatting.GOLD + "TechReborn Developer");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,10 +5,8 @@ import net.minecraft.util.DamageSource;
|
|||
/**
|
||||
* Created by modmuss50 on 06/03/2016.
|
||||
*/
|
||||
public class ElectrialShockSource extends DamageSource
|
||||
{
|
||||
public ElectrialShockSource()
|
||||
{
|
||||
public class ElectrialShockSource extends DamageSource {
|
||||
public ElectrialShockSource() {
|
||||
super("shock");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,10 +5,8 @@ import net.minecraft.util.DamageSource;
|
|||
/**
|
||||
* Created by modmuss50 on 05/03/2016.
|
||||
*/
|
||||
public class FusionDamageSource extends DamageSource
|
||||
{
|
||||
public FusionDamageSource()
|
||||
{
|
||||
public class FusionDamageSource extends DamageSource {
|
||||
public FusionDamageSource() {
|
||||
super("fusion");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,5 +5,5 @@ import reborncore.common.recipes.RecipeCrafter;
|
|||
|
||||
public interface IMachineUpgrade {
|
||||
|
||||
public void processUpgrade(RecipeCrafter crafter, ItemStack stack);
|
||||
public void processUpgrade(RecipeCrafter crafter, ItemStack stack);
|
||||
}
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
package techreborn.utils.upgrade;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class UpgradeHandler {
|
||||
|
||||
RecipeCrafter crafter;
|
||||
RecipeCrafter crafter;
|
||||
|
||||
Inventory inventory;
|
||||
Inventory inventory;
|
||||
|
||||
ArrayList<Integer> slots = new ArrayList<>();
|
||||
ArrayList<Integer> slots = new ArrayList<>();
|
||||
|
||||
public UpgradeHandler(RecipeCrafter crafter, Inventory inventory, int... slots) {
|
||||
this.crafter = crafter;
|
||||
this.inventory = inventory;
|
||||
for (int slot : slots) {
|
||||
this.slots.add(slot);
|
||||
}
|
||||
}
|
||||
public UpgradeHandler(RecipeCrafter crafter, Inventory inventory, int... slots) {
|
||||
this.crafter = crafter;
|
||||
this.inventory = inventory;
|
||||
for (int slot : slots) {
|
||||
this.slots.add(slot);
|
||||
}
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
if (crafter.parentTile.getWorld().isRemote)
|
||||
return;
|
||||
crafter.resetPowerMulti();
|
||||
crafter.resetSpeedMulti();
|
||||
for (int slot : this.slots) {
|
||||
ItemStack stack = inventory.getStackInSlot(slot);
|
||||
if (stack != null && stack.getItem() instanceof IMachineUpgrade) {
|
||||
((IMachineUpgrade) stack.getItem()).processUpgrade(crafter, stack);
|
||||
}
|
||||
}
|
||||
if (crafter.currentRecipe != null)
|
||||
crafter.currentNeededTicks = (int) (crafter.currentRecipe.tickTime()
|
||||
* (1.0 - crafter.getSpeedMultiplier()));
|
||||
}
|
||||
public void tick() {
|
||||
if (crafter.parentTile.getWorld().isRemote)
|
||||
return;
|
||||
crafter.resetPowerMulti();
|
||||
crafter.resetSpeedMulti();
|
||||
for (int slot : this.slots) {
|
||||
ItemStack stack = inventory.getStackInSlot(slot);
|
||||
if (stack != null && stack.getItem() instanceof IMachineUpgrade) {
|
||||
((IMachineUpgrade) stack.getItem()).processUpgrade(crafter, stack);
|
||||
}
|
||||
}
|
||||
if (crafter.currentRecipe != null)
|
||||
crafter.currentNeededTicks = (int) (crafter.currentRecipe.tickTime()
|
||||
* (1.0 - crafter.getSpeedMultiplier()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue