Start on the update

This commit is contained in:
modmuss50 2016-11-19 12:50:08 +00:00
parent c8d8ce0241
commit a0e6a2dc34
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
112 changed files with 522 additions and 503 deletions

View file

@ -13,6 +13,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
@ -58,7 +59,8 @@ public class DynamicCell extends Item {
}
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World worldIn, EntityPlayer playerIn, EnumHand hand) {
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) {
ItemStack stack = playerIn.getHeldItem(hand);
if (!worldIn.isRemote) {
RayTraceResult result = rayTrace(worldIn, playerIn, true);
@ -99,14 +101,14 @@ public class DynamicCell extends Item {
public boolean tryAddCellToInventory(EntityPlayer player, ItemStack stack, Fluid fluid) {
if (player.inventory.addItemStackToInventory(DynamicCell.getCellWithFluid(fluid))) {
--stack.stackSize;
stack.shrink(1);
return true;
}
return false;
}
@Override
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems) {
subItems.add(getEmptyCell(1));
for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
subItems.add(getCellWithFluid(fluid));
@ -134,7 +136,7 @@ public class DynamicCell extends Item {
Validate.notNull(fluid);
ItemStack stack = new ItemStack(ModItems.dynamicCell);
getFluidHandler(stack).fill(new FluidStack(fluid, CAPACITY), true);
stack.stackSize = stackSize;
stack.setCount(stackSize);
return stack;
}

View file

@ -21,11 +21,11 @@ public class ItemDestructopack extends ItemTextureBase implements ITexturedItem
}
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStack, World world, EntityPlayer player,
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player,
EnumHand hand) {
player.openGui(Core.INSTANCE, GuiHandler.destructoPackID, world, (int) player.posX, (int) player.posY,
(int) player.posY);
return new ActionResult<>(EnumActionResult.SUCCESS, itemStack);
return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}
@Override

View file

@ -32,8 +32,9 @@ public class ItemFrequencyTransmitter extends ItemTextureBase implements ITextur
}
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos,
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
stack.setTagCompound(new NBTTagCompound());
stack.getTagCompound().setInteger("x", pos.getX());
stack.getTagCompound().setInteger("y", pos.getY());
@ -56,8 +57,9 @@ public class ItemFrequencyTransmitter extends ItemTextureBase implements ITextur
}
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player,
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player,
EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if (player.isSneaking()) {
stack.setTagCompound(null);
if (!world.isRemote && ConfigTechReborn.FreqTransmitterChat) {

View file

@ -21,8 +21,9 @@ public class ItemScrapBox extends ItemTextureBase implements ITexturedItem {
}
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStack, World world, EntityPlayer player,
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player,
EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if (!world.isRemote) {
int random = world.rand.nextInt(ScrapboxList.stacks.size());
ItemStack out = ScrapboxList.stacks.get(random).copy();
@ -33,11 +34,10 @@ public class ItemScrapBox extends ItemTextureBase implements ITexturedItem {
player.getPosition().getY() + yOffset, player.getPosition().getZ() + zOffset, out);
entityitem.setPickupDelay(20);
world.spawnEntityInWorld(entityitem);
itemStack.stackSize--;
world.spawnEntity(entityitem);
stack.shrink(1);
}
return new ActionResult<>(EnumActionResult.SUCCESS, itemStack);
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}
@Override

View file

@ -83,9 +83,9 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedI
}
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
public EnumActionResult onItemUse( EntityPlayer playerIn, World worldIn, BlockPos pos,
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
return TorchHelper.placeTorch(playerIn.getHeldItem(hand), playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
}
@Override

View file

@ -70,9 +70,9 @@ public class ItemCloakingDevice extends ItemTextureBase implements IEnergyItemIn
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
ItemStack itemstack1 = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
if (itemstack1 == null) {
if (itemstack1 == ItemStack.EMPTY) {
player.setItemStackToSlot(EntityEquipmentSlot.CHEST, itemStack.copy());
itemStack.stackSize = 0;
itemStack.setCount(0);
}
return itemStack;

View file

@ -37,12 +37,12 @@ public class ItemDebugTool extends ItemTextureBase implements ITexturedItem {
}
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos,
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof IEnergyInterfaceTile) {
if (!tile.getWorld().isRemote) {
playerIn.addChatComponentMessage(
playerIn.sendMessage(
new TextComponentString(TextFormatting.GREEN + "Power" + TextFormatting.BLUE
+ PowerSystem.getLocaliszedPower(((IEnergyInterfaceTile) tile).getEnergy())));
}

View file

@ -81,9 +81,9 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
}
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos,
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
return TorchHelper.placeTorch(playerIn.getHeldItem(hand), playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
}
@Override

View file

@ -81,9 +81,9 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITex
}
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos,
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
return TorchHelper.placeTorch(playerIn.getHeldItem(hand), playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
}
@Override

View file

@ -69,9 +69,9 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
modifier = 9;
if (slot == EntityEquipmentSlot.MAINHAND) {
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(),
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(),
new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double) modifier, 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(),
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(),
new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4000000953674316D, 0));
}
return multimap;
@ -130,8 +130,9 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
}
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player,
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player,
EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if (player.isSneaking()) {
if (!PoweredItem.canUseEnergy(cost, stack)) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(

View file

@ -88,9 +88,9 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITextu
}
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos,
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
return TorchHelper.placeTorch(playerIn.getHeldItem(hand), playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
}
@Override

View file

@ -25,11 +25,11 @@ public class ItemTechManual extends ItemTextureBase implements ITexturedItem {
}
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World world, EntityPlayer player,
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player,
EnumHand hand) {
player.openGui(Core.INSTANCE, GuiHandler.manuelID, world, (int) player.posX, (int) player.posY,
(int) player.posY);
return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);
return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}
@Override

View file

@ -49,13 +49,13 @@ public class ItemWrench extends ItemTR implements ITexturedItem {
}
@Override
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos,
EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
if(!PermissionAPI.hasPermission(player.getGameProfile(), RebornPermissions.WRENCH_BLOCK, new BlockPosContext(player, pos, world.getBlockState(pos), side))){
return EnumActionResult.FAIL;
}
if (CompatManager.isIC2Loaded) {
EnumActionResult result = IC2WrenchHelper.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
EnumActionResult result = IC2WrenchHelper.onItemUseFirst(player.getHeldItem(hand), player, world, pos, side, hitX, hitY, hitZ, hand);
if (result == EnumActionResult.SUCCESS) {
return result;
}
@ -68,7 +68,7 @@ public class ItemWrench extends ItemTR implements ITexturedItem {
return EnumActionResult.FAIL;
}
if (!player.isSneaking() && !player.worldObj.isRemote) {
if (!player.isSneaking() && !player.world.isRemote) {
if (tile instanceof TileMachineBase) {
if (side != EnumFacing.DOWN && side != EnumFacing.UP) {
((TileMachineBase) tile).setFacing(side);
@ -76,17 +76,17 @@ public class ItemWrench extends ItemTR implements ITexturedItem {
}
}
}
return super.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
return super.onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand);
}
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos,
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if(!PermissionAPI.hasPermission(player.getGameProfile(), RebornPermissions.WRENCH_BLOCK, new BlockPosContext(player, pos, world.getBlockState(pos), facing))){
return EnumActionResult.FAIL;
}
if (CompatManager.isIC2Loaded) {
EnumActionResult result = IC2WrenchHelper.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
EnumActionResult result = IC2WrenchHelper.onItemUse(player.getHeldItem(hand), player, world, pos, hand, facing, hitX, hitY, hitZ);
if (result == EnumActionResult.SUCCESS) {
return result;
}
@ -106,8 +106,8 @@ public class ItemWrench extends ItemTR implements ITexturedItem {
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack itemStack = inventory.getStackInSlot(i);
if (itemStack != null) {
if (itemStack.stackSize > 0) {
if (itemStack != ItemStack.EMPTY) {
if (itemStack.getCount() > 0) {
if (itemStack.getItem() instanceof ItemBlock)
if (!(((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase) || !(((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid)
@ -147,7 +147,7 @@ public class ItemWrench extends ItemTR implements ITexturedItem {
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
entityItem.motionZ = rand.nextGaussian() * factor;
if (!world.isRemote) {
world.spawnEntityInWorld(entityItem);
world.spawnEntity(entityItem);
}
}
}