Taking a break now, 63
This commit is contained in:
parent
fd0fa8c66e
commit
7a441cea77
7 changed files with 54 additions and 45 deletions
|
@ -37,6 +37,7 @@ import org.apache.logging.log4j.Logger;
|
||||||
import reborncore.api.recipe.RecipeHandler;
|
import reborncore.api.recipe.RecipeHandler;
|
||||||
import reborncore.common.multiblock.MultiblockEventHandler;
|
import reborncore.common.multiblock.MultiblockEventHandler;
|
||||||
import reborncore.common.multiblock.MultiblockServerTickHandler;
|
import reborncore.common.multiblock.MultiblockServerTickHandler;
|
||||||
|
import reborncore.common.registration.RegistrationManager;
|
||||||
import reborncore.common.util.Torus;
|
import reborncore.common.util.Torus;
|
||||||
import techreborn.api.TechRebornAPI;
|
import techreborn.api.TechRebornAPI;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
@ -62,7 +63,6 @@ public class TechReborn {
|
||||||
// @SidedProxy(clientSide = TechReborn.CLIENT_PROXY_CLASS, serverSide = TechReborn.SERVER_PROXY_CLASS)
|
// @SidedProxy(clientSide = TechReborn.CLIENT_PROXY_CLASS, serverSide = TechReborn.SERVER_PROXY_CLASS)
|
||||||
public static CommonProxy proxy;
|
public static CommonProxy proxy;
|
||||||
public static TechReborn INSTANCE;
|
public static TechReborn INSTANCE;
|
||||||
public static File configDir;
|
|
||||||
|
|
||||||
public static final ItemGroup ITEMGROUP = new ItemGroup(-1, MOD_ID) {
|
public static final ItemGroup ITEMGROUP = new ItemGroup(-1, MOD_ID) {
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
@ -77,11 +77,12 @@ public class TechReborn {
|
||||||
|
|
||||||
INSTANCE = this;
|
INSTANCE = this;
|
||||||
|
|
||||||
configDir = new File(new File("teamreborn"), "techreborn");
|
RegistrationManager registrationManager = new RegistrationManager("techreborn");
|
||||||
|
|
||||||
//CommonProxy.isChiselAround = Loader.isModLoaded("ctm");
|
//CommonProxy.isChiselAround = Loader.isModLoaded("ctm");
|
||||||
TechRebornAPI.subItemRetriever = new SubItemRetriever();
|
TechRebornAPI.subItemRetriever = new SubItemRetriever();
|
||||||
ModFluids.init();
|
//Done like this to load them here
|
||||||
|
ModFluids.values();
|
||||||
|
|
||||||
ClientboundPackets.init();
|
ClientboundPackets.init();
|
||||||
ServerboundPackets.init();
|
ServerboundPackets.init();
|
||||||
|
|
|
@ -60,6 +60,6 @@ public class RollingMachineRecipes extends RecipeMethods {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void register(ResourceLocation resourceLocation, ItemStack output, Object... componentsObjects) {
|
static void register(ResourceLocation resourceLocation, ItemStack output, Object... componentsObjects) {
|
||||||
TechRebornAPI.addRollingOreMachinceRecipe(resourceLocation, output, componentsObjects);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,13 +25,16 @@
|
||||||
package techreborn.items;
|
package techreborn.items;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockFlowingFluid;
|
||||||
import net.minecraft.block.BlockStaticLiquid;
|
import net.minecraft.block.BlockStaticLiquid;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
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.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Fluids;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
|
@ -84,7 +87,7 @@ public class DynamicCell extends Item {
|
||||||
if (!worldIn.isRemote) {
|
if (!worldIn.isRemote) {
|
||||||
RayTraceResult result = rayTrace(worldIn, playerIn, true);
|
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();
|
BlockPos pos = result.getBlockPos();
|
||||||
IBlockState state = worldIn.getBlockState(pos);
|
IBlockState state = worldIn.getBlockState(pos);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
|
@ -104,19 +107,20 @@ public class DynamicCell extends Item {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (block instanceof BlockStaticLiquid) {
|
} else if (block instanceof BlockFlowingFluid) {
|
||||||
Fluid fluid = state.getMaterial() == Material.LAVA ? FluidRegistry.LAVA : FluidRegistry.WATER;
|
//TODO 1.13 fix me
|
||||||
|
// Fluid fluid = state.getMaterial() == Material.LAVA ? Fluids.LAVA : Fluids.WATER;
|
||||||
if (tryAddCellToInventory(playerIn, stack, fluid)) {
|
//
|
||||||
if (fluid != FluidRegistry.WATER)
|
// if (tryAddCellToInventory(playerIn, stack, fluid)) {
|
||||||
worldIn.setBlockToAir(pos);
|
// if (fluid != Fluids.WATER)
|
||||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
// worldIn.setBlockToAir(pos);
|
||||||
}
|
// return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||||
|
// }
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ItemStack usedCell = stack.copy();
|
ItemStack usedCell = stack.copy();
|
||||||
usedCell.setCount(1);
|
usedCell.setCount(1);
|
||||||
IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(usedCell);
|
IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(usedCell).orElseGet(null);
|
||||||
if (fluidHandler != null) {
|
if (fluidHandler != null) {
|
||||||
FluidStack fluid = fluidHandler.drain(DynamicCell.CAPACITY, false);
|
FluidStack fluid = fluidHandler.drain(DynamicCell.CAPACITY, false);
|
||||||
if (fluid != null){
|
if (fluid != null){
|
||||||
|
@ -145,8 +149,8 @@ public class DynamicCell extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
public void getSubItems(ItemGroup tab, NonNullList<ItemStack> subItems) {
|
||||||
if (!isInCreativeTab(tab)) {
|
if (!isInGroup(tab)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
subItems.add(getEmptyCell(1));
|
subItems.add(getEmptyCell(1));
|
||||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.IItemPropertyGetter;
|
import net.minecraft.item.IItemPropertyGetter;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.ItemUseContext;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.*;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -68,14 +69,17 @@ public class ItemFrequencyTransmitter extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos,
|
public EnumActionResult onItemUse(ItemUseContext context) {
|
||||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
EntityPlayer player = context.getPlayer();
|
||||||
ItemStack stack = player.getHeldItem(hand);
|
World world = context.getWorld();
|
||||||
|
BlockPos pos = context.getPos();
|
||||||
|
ItemStack stack = context.getItem();
|
||||||
|
|
||||||
stack.setTag(new NBTTagCompound());
|
stack.setTag(new NBTTagCompound());
|
||||||
stack.getTag().putInt("x", pos.getX());
|
stack.getTag().putInt("x", pos.getX());
|
||||||
stack.getTag().putInt("y", pos.getY());
|
stack.getTag().putInt("y", pos.getY());
|
||||||
stack.getTag().putInt("z", pos.getZ());
|
stack.getTag().putInt("z", pos.getZ());
|
||||||
stack.getTag().putInt("dim", world.provider.getDimension());
|
stack.getTag().putInt("dim", world.getDimension().getType().getId());
|
||||||
|
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponentString(
|
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponentString(
|
||||||
|
@ -87,7 +91,7 @@ public class ItemFrequencyTransmitter extends Item {
|
||||||
TextFormatting.GOLD + pos.getZ() +
|
TextFormatting.GOLD + pos.getZ() +
|
||||||
TextFormatting.GRAY + " " + I18n.format("techreborn.message.in") + " " +
|
TextFormatting.GRAY + " " + I18n.format("techreborn.message.in") + " " +
|
||||||
TextFormatting.GOLD + DimensionManager.getProviderType(world.provider.getDimension())
|
TextFormatting.GOLD + DimensionManager.getProviderType(world.provider.getDimension())
|
||||||
.getName() + " (" + world.provider.getDimension() + ")"));
|
.getName() + " (" + world.getDimension().getType().getRegistryName() + ")"));
|
||||||
}
|
}
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,9 @@ public class ItemManual extends Item {
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(final World world, final EntityPlayer player,
|
public ActionResult<ItemStack> onItemRightClick(final World world, final EntityPlayer player,
|
||||||
final EnumHand hand) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ import net.minecraft.world.chunk.IChunkProvider;
|
||||||
import net.minecraft.world.gen.IChunkGenerator;
|
import net.minecraft.world.gen.IChunkGenerator;
|
||||||
import net.minecraft.world.gen.feature.AbstractTreeFeature;
|
import net.minecraft.world.gen.feature.AbstractTreeFeature;
|
||||||
import net.minecraft.world.gen.feature.NoFeatureConfig;
|
import net.minecraft.world.gen.feature.NoFeatureConfig;
|
||||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
|
||||||
import net.minecraftforge.common.IPlantable;
|
import net.minecraftforge.common.IPlantable;
|
||||||
import net.minecraftforge.fml.common.IWorldGenerator;
|
import net.minecraftforge.fml.common.IWorldGenerator;
|
||||||
import techreborn.TechReborn;
|
import techreborn.TechReborn;
|
||||||
|
@ -61,29 +60,30 @@ public class RubberTreeGenerator extends AbstractTree implements IWorldGenerator
|
||||||
}
|
}
|
||||||
|
|
||||||
public RubberTreeGenerator(boolean isWorldGen) {
|
public RubberTreeGenerator(boolean isWorldGen) {
|
||||||
super(!isWorldGen);
|
super();
|
||||||
this.isWorldGen = isWorldGen;
|
this.isWorldGen = isWorldGen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public boolean generate(World worldIn, Random rand, BlockPos position) {
|
// public boolean generate(World worldIn, Random rand, BlockPos position) {
|
||||||
int retries = rand.nextInt(3) + 2;
|
// int retries = rand.nextInt(3) + 2;
|
||||||
for (int c = 0; c < retries; c++) {
|
// for (int c = 0; c < retries; c++) {
|
||||||
int x = position.getX() + 8 + rand.nextInt(16);
|
// int x = position.getX() + 8 + rand.nextInt(16);
|
||||||
int z = position.getZ() + 8 + rand.nextInt(16);
|
// int z = position.getZ() + 8 + rand.nextInt(16);
|
||||||
int y = worldIn.getHeight(x, z) - 1;
|
// int y = worldIn.getHeight(x, z) - 1;
|
||||||
while (worldIn.isAirBlock(new BlockPos(x, y, z)) && y > 0) {
|
// while (worldIn.isAirBlock(new BlockPos(x, y, z)) && y > 0) {
|
||||||
y--;
|
// y--;
|
||||||
}
|
// }
|
||||||
if (!growTree(worldIn, rand, x, y + 1, z)) {
|
// if (!growTree(worldIn, rand, x, y + 1, z)) {
|
||||||
retries--;
|
// retries--;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public boolean growTree(IWorld world, Random rand, int x, int y, int z) {
|
public boolean growTree(IWorld world, Random rand, int x, int y, int z) {
|
||||||
|
/*
|
||||||
int treeHeight = rand.nextInt(5) + TechReborn.worldGen.config.rubberTreeConfig.treeBaseHeight;
|
int treeHeight = rand.nextInt(5) + TechReborn.worldGen.config.rubberTreeConfig.treeBaseHeight;
|
||||||
int worldHeight = world.getHeight();
|
int worldHeight = world.getHeight();
|
||||||
if (y >= 1 && y + treeHeight + 1 <= worldHeight) {
|
if (y >= 1 && y + treeHeight + 1 <= worldHeight) {
|
||||||
|
@ -184,6 +184,7 @@ public class RubberTreeGenerator extends AbstractTree implements IWorldGenerator
|
||||||
}
|
}
|
||||||
return hasPlacedBlock;
|
return hasPlacedBlock;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,6 @@ package techreborn.world.village;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.gen.feature.structure.StructurePiece;
|
import net.minecraft.world.gen.feature.structure.StructurePiece;
|
||||||
import net.minecraft.world.gen.feature.structure.VillagePieces;
|
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 net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -38,7 +36,7 @@ public class VillagePlantaionHandler implements VillagerRegistry.IVillageCreatio
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VillagePieces.PieceWeight getVillagePieceWeight(Random random, int i) {
|
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
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue