Taking a break now, 63
This commit is contained in:
parent
fd0fa8c66e
commit
7a441cea77
7 changed files with 54 additions and 45 deletions
|
@ -25,13 +25,16 @@
|
|||
package techreborn.items;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlowingFluid;
|
||||
import net.minecraft.block.BlockStaticLiquid;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Fluids;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ActionResult;
|
||||
|
@ -84,7 +87,7 @@ public class DynamicCell extends Item {
|
|||
if (!worldIn.isRemote) {
|
||||
RayTraceResult result = rayTrace(worldIn, playerIn, true);
|
||||
|
||||
if (result != null && result.typeOfHit == RayTraceResult.Type.BLOCK) {
|
||||
if (result != null && result.type == RayTraceResult.Type.BLOCK) {
|
||||
BlockPos pos = result.getBlockPos();
|
||||
IBlockState state = worldIn.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
|
@ -104,19 +107,20 @@ public class DynamicCell extends Item {
|
|||
|
||||
}
|
||||
|
||||
} else if (block instanceof BlockStaticLiquid) {
|
||||
Fluid fluid = state.getMaterial() == Material.LAVA ? FluidRegistry.LAVA : FluidRegistry.WATER;
|
||||
|
||||
if (tryAddCellToInventory(playerIn, stack, fluid)) {
|
||||
if (fluid != FluidRegistry.WATER)
|
||||
worldIn.setBlockToAir(pos);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
} else if (block instanceof BlockFlowingFluid) {
|
||||
//TODO 1.13 fix me
|
||||
// Fluid fluid = state.getMaterial() == Material.LAVA ? Fluids.LAVA : Fluids.WATER;
|
||||
//
|
||||
// if (tryAddCellToInventory(playerIn, stack, fluid)) {
|
||||
// if (fluid != Fluids.WATER)
|
||||
// worldIn.setBlockToAir(pos);
|
||||
// return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
// }
|
||||
|
||||
} else {
|
||||
ItemStack usedCell = stack.copy();
|
||||
usedCell.setCount(1);
|
||||
IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(usedCell);
|
||||
IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(usedCell).orElseGet(null);
|
||||
if (fluidHandler != null) {
|
||||
FluidStack fluid = fluidHandler.drain(DynamicCell.CAPACITY, false);
|
||||
if (fluid != null){
|
||||
|
@ -145,8 +149,8 @@ public class DynamicCell extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
if (!isInCreativeTab(tab)) {
|
||||
public void getSubItems(ItemGroup tab, NonNullList<ItemStack> subItems) {
|
||||
if (!isInGroup(tab)) {
|
||||
return;
|
||||
}
|
||||
subItems.add(getEmptyCell(1));
|
||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -68,14 +69,17 @@ public class ItemFrequencyTransmitter extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
public EnumActionResult onItemUse(ItemUseContext context) {
|
||||
EntityPlayer player = context.getPlayer();
|
||||
World world = context.getWorld();
|
||||
BlockPos pos = context.getPos();
|
||||
ItemStack stack = context.getItem();
|
||||
|
||||
stack.setTag(new NBTTagCompound());
|
||||
stack.getTag().putInt("x", pos.getX());
|
||||
stack.getTag().putInt("y", pos.getY());
|
||||
stack.getTag().putInt("z", pos.getZ());
|
||||
stack.getTag().putInt("dim", world.provider.getDimension());
|
||||
stack.getTag().putInt("dim", world.getDimension().getType().getId());
|
||||
|
||||
if (!world.isRemote) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponentString(
|
||||
|
@ -87,7 +91,7 @@ public class ItemFrequencyTransmitter extends Item {
|
|||
TextFormatting.GOLD + pos.getZ() +
|
||||
TextFormatting.GRAY + " " + I18n.format("techreborn.message.in") + " " +
|
||||
TextFormatting.GOLD + DimensionManager.getProviderType(world.provider.getDimension())
|
||||
.getName() + " (" + world.provider.getDimension() + ")"));
|
||||
.getName() + " (" + world.getDimension().getType().getRegistryName() + ")"));
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,9 @@ public class ItemManual extends Item {
|
|||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(final World world, final EntityPlayer player,
|
||||
final EnumHand hand) {
|
||||
player.openGui(TechReborn.INSTANCE, EGui.MANUAL.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posY);
|
||||
throw new UnsupportedOperationException("1.13 fix me");
|
||||
//player.openGui(TechReborn.INSTANCE, EGui.MANUAL.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posY);
|
||||
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
|
||||
//return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue