Taking a break now, 63

This commit is contained in:
modmuss50 2019-02-22 15:11:38 +00:00
parent fd0fa8c66e
commit 7a441cea77
7 changed files with 54 additions and 45 deletions

View file

@ -37,6 +37,7 @@ import org.apache.logging.log4j.Logger;
import reborncore.api.recipe.RecipeHandler;
import reborncore.common.multiblock.MultiblockEventHandler;
import reborncore.common.multiblock.MultiblockServerTickHandler;
import reborncore.common.registration.RegistrationManager;
import reborncore.common.util.Torus;
import techreborn.api.TechRebornAPI;
import techreborn.config.ConfigTechReborn;
@ -62,7 +63,6 @@ public class TechReborn {
// @SidedProxy(clientSide = TechReborn.CLIENT_PROXY_CLASS, serverSide = TechReborn.SERVER_PROXY_CLASS)
public static CommonProxy proxy;
public static TechReborn INSTANCE;
public static File configDir;
public static final ItemGroup ITEMGROUP = new ItemGroup(-1, MOD_ID) {
@OnlyIn(Dist.CLIENT)
@ -77,11 +77,12 @@ public class TechReborn {
INSTANCE = this;
configDir = new File(new File("teamreborn"), "techreborn");
RegistrationManager registrationManager = new RegistrationManager("techreborn");
//CommonProxy.isChiselAround = Loader.isModLoaded("ctm");
TechRebornAPI.subItemRetriever = new SubItemRetriever();
ModFluids.init();
//Done like this to load them here
ModFluids.values();
ClientboundPackets.init();
ServerboundPackets.init();

View file

@ -60,6 +60,6 @@ public class RollingMachineRecipes extends RecipeMethods {
}
static void register(ResourceLocation resourceLocation, ItemStack output, Object... componentsObjects) {
TechRebornAPI.addRollingOreMachinceRecipe(resourceLocation, output, componentsObjects);
}
}

View file

@ -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));

View file

@ -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;
}

View file

@ -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));
}
}

View file

@ -35,7 +35,6 @@ import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.feature.AbstractTreeFeature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.fml.common.IWorldGenerator;
import techreborn.TechReborn;
@ -61,29 +60,30 @@ public class RubberTreeGenerator extends AbstractTree implements IWorldGenerator
}
public RubberTreeGenerator(boolean isWorldGen) {
super(!isWorldGen);
super();
this.isWorldGen = isWorldGen;
}
@Override
public boolean generate(World worldIn, Random rand, BlockPos position) {
int retries = rand.nextInt(3) + 2;
for (int c = 0; c < retries; c++) {
int x = position.getX() + 8 + rand.nextInt(16);
int z = position.getZ() + 8 + rand.nextInt(16);
int y = worldIn.getHeight(x, z) - 1;
while (worldIn.isAirBlock(new BlockPos(x, y, z)) && y > 0) {
y--;
}
if (!growTree(worldIn, rand, x, y + 1, z)) {
retries--;
}
}
return false;
}
// @Override
// public boolean generate(World worldIn, Random rand, BlockPos position) {
// int retries = rand.nextInt(3) + 2;
// for (int c = 0; c < retries; c++) {
// int x = position.getX() + 8 + rand.nextInt(16);
// int z = position.getZ() + 8 + rand.nextInt(16);
// int y = worldIn.getHeight(x, z) - 1;
// while (worldIn.isAirBlock(new BlockPos(x, y, z)) && y > 0) {
// y--;
// }
// if (!growTree(worldIn, rand, x, y + 1, z)) {
// retries--;
// }
// }
//
// return false;
// }
public boolean growTree(IWorld world, Random rand, int x, int y, int z) {
/*
int treeHeight = rand.nextInt(5) + TechReborn.worldGen.config.rubberTreeConfig.treeBaseHeight;
int worldHeight = world.getHeight();
if (y >= 1 && y + treeHeight + 1 <= worldHeight) {
@ -184,6 +184,7 @@ public class RubberTreeGenerator extends AbstractTree implements IWorldGenerator
}
return hasPlacedBlock;
}
*/
return false;
}

View file

@ -27,8 +27,6 @@ package techreborn.world.village;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.gen.feature.structure.StructurePiece;
import net.minecraft.world.gen.feature.structure.VillagePieces;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
import java.util.List;
@ -38,7 +36,7 @@ public class VillagePlantaionHandler implements VillagerRegistry.IVillageCreatio
@Override
public VillagePieces.PieceWeight getVillagePieceWeight(Random random, int i) {
return new StructurePiece.PieceWeight(VillageComponentRubberPlantaion.class, 5, 1);
return new VillagePieces.PieceWeight(VillageComponentRubberPlantaion.class, 5, 1);
}
@Override