Merge branch '1.9' of https://github.com/TechReborn/TechReborn into 1.9
This commit is contained in:
commit
ab51699e5a
13 changed files with 159 additions and 108 deletions
|
@ -80,9 +80,9 @@ dependencies {
|
|||
if(!f.exists()){
|
||||
f.mkdir()
|
||||
}
|
||||
compile 'RebornCore:RebornCore-1.9:2.0.5.+:dev'
|
||||
compile 'RebornCore:RebornCore-1.9:+:dev'
|
||||
deobfCompile "mezz.jei:jei_1.9:+"
|
||||
deobfCompile 'MCMultiPart:MCMultiPart-experimental:1.1.0_55:universal'
|
||||
deobfCompile 'MCMultiPart:MCMultiPart-experimental:1.2.0_60:universal'
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
gource -f -1920x1080 --seconds-per-day 1 --auto-skip-seconds 1 --key --title "TechReborn" --camera-mode overview --multi-sampling --hide filenames,mouse --file-idle-time 0 --bloom-multiplier 0.05 --bloom-intensity 0.75
|
||||
D:\mark\Downloads\gource-0.42.win32\cmd\gource -f -1920x1080 --seconds-per-day 0.5 --auto-skip-seconds 1 --key --title "TechReborn" --camera-mode overview --multi-sampling --hide filenames,mouse --file-idle-time 0 --bloom-multiplier 0.05 --bloom-intensity 0.75
|
||||
pause
|
|
@ -35,6 +35,7 @@ import techreborn.events.OreUnifier;
|
|||
import techreborn.events.TRTickHandler;
|
||||
import techreborn.init.*;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.manual.loader.ManualLoader;
|
||||
import techreborn.packets.PacketAesu;
|
||||
import techreborn.packets.PacketIdsu;
|
||||
import techreborn.proxies.CommonProxy;
|
||||
|
|
|
@ -56,13 +56,13 @@ public class BlockRubberLeaves extends BlockLeaves implements ITexturedBlock, IO
|
|||
@Override
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return this.leavesFancy ? BlockRenderLayer.CUTOUT_MIPPED : BlockRenderLayer.SOLID;
|
||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return Blocks.leaves.isOpaqueCube(state);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isFullCube()
|
||||
|
|
|
@ -69,45 +69,6 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
|
|||
return new BlockStateContainer(this, FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
super.onBlockAdded(worldIn, pos, state);
|
||||
this.setDefaultFacing(worldIn, pos, state);
|
||||
}
|
||||
|
||||
private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
if (!worldIn.isRemote)
|
||||
{
|
||||
IBlockState sate = worldIn.getBlockState(pos.north());
|
||||
Block block = sate.getBlock();
|
||||
IBlockState state1 = worldIn.getBlockState(pos.south());
|
||||
Block block1 = state1.getBlock();
|
||||
IBlockState state2 = worldIn.getBlockState(pos.west());
|
||||
Block block2 = state2.getBlock();
|
||||
IBlockState state3 = worldIn.getBlockState(pos.east());
|
||||
Block block3 = state3.getBlock();
|
||||
EnumFacing enumfacing = state.getValue(FACING);
|
||||
|
||||
if (enumfacing == EnumFacing.NORTH && block.isFullBlock(state) && !block1.isFullBlock(state1))
|
||||
{
|
||||
enumfacing = EnumFacing.SOUTH;
|
||||
} else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock(state1) && !block.isFullBlock(state))
|
||||
{
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
} else if (enumfacing == EnumFacing.WEST && block2.isFullBlock(state2) && !block3.isFullBlock(state2))
|
||||
{
|
||||
enumfacing = EnumFacing.EAST;
|
||||
} else if (enumfacing == EnumFacing.EAST && block3.isFullBlock(state3) && !block2.isFullBlock(state2))
|
||||
{
|
||||
enumfacing = EnumFacing.WEST;
|
||||
}
|
||||
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
|
||||
ItemStack stack)
|
||||
|
@ -124,53 +85,6 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
|
|||
setFacing(facing, worldIn, pos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected List<ItemStack> dropInventory(IBlockAccess world, BlockPos pos, ItemStack itemToDrop)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if (tileEntity == null)
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||
|
||||
if (itemStack == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (itemStack != null && itemStack.stackSize > 0)
|
||||
{
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
items.add(itemStack.copy());
|
||||
}
|
||||
items.add(itemToDrop.copy());
|
||||
return items;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,6 @@ public class GuiIndustrialGrinder extends GuiContainer
|
|||
TileIndustrialGrinder grinder;
|
||||
ContainerIndustrialGrinder containerGrinder;
|
||||
|
||||
boolean hasMultiBlock;
|
||||
public GuiIndustrialGrinder(EntityPlayer player, TileIndustrialGrinder tilegrinder)
|
||||
{
|
||||
super(new ContainerIndustrialGrinder(tilegrinder, player));
|
||||
|
@ -31,7 +30,6 @@ public class GuiIndustrialGrinder extends GuiContainer
|
|||
{
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
hasMultiBlock = containerGrinder.connectionStatus != 1;
|
||||
super.initGui();
|
||||
}
|
||||
|
||||
|
@ -45,7 +43,7 @@ public class GuiIndustrialGrinder extends GuiContainer
|
|||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int j = 0;
|
||||
if (hasMultiBlock)
|
||||
if (containerGrinder.connectionStatus == 0)
|
||||
{
|
||||
// GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - j, 114, 10);
|
||||
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
|
||||
|
|
|
@ -58,21 +58,9 @@ public class ItemWrench extends ItemTR implements ITexturedItem
|
|||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
if (!player.isSneaking())
|
||||
if (!player.isSneaking() && !player.worldObj.isRemote)
|
||||
{
|
||||
if (tile instanceof TileEnergyStorage || tile instanceof IWrenchable)
|
||||
{
|
||||
if(((IWrenchable)tile).wrenchCanSetFacing(player, side.getOpposite())){
|
||||
|
||||
tile.getWorld().setBlockState(tile.getPos(),
|
||||
tile.getWorld().getBlockState(pos).withProperty(BlockBatBox.FACING, side.getOpposite()));
|
||||
|
||||
return EnumActionResult.SUCCESS;
|
||||
}else{
|
||||
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
} else if (tile instanceof TileMachineBase)
|
||||
if (tile instanceof TileMachineBase)
|
||||
{
|
||||
if (side != EnumFacing.DOWN && side != EnumFacing.UP)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package techreborn.manual.loader;
|
||||
|
||||
/**
|
||||
* Created by Mark on 16/04/2016.
|
||||
*/
|
||||
public class DownloadablePackageInfo {
|
||||
|
||||
PackageInfo packageInfo;
|
||||
|
||||
String md5;
|
||||
|
||||
String fileName;
|
||||
|
||||
}
|
86
src/main/java/techreborn/manual/loader/ManualLoader.java
Normal file
86
src/main/java/techreborn/manual/loader/ManualLoader.java
Normal file
|
@ -0,0 +1,86 @@
|
|||
package techreborn.manual.loader;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import techreborn.manual.saveFormat.ManualFormat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 23/04/2016.
|
||||
*/
|
||||
public class ManualLoader {
|
||||
|
||||
public static final String MANUAL_VERSION = "0";
|
||||
|
||||
File configDir;
|
||||
|
||||
public ManualLoader(File configDir) {
|
||||
this.configDir = configDir;
|
||||
}
|
||||
|
||||
VersionsInfo info = null;
|
||||
|
||||
public void load() throws IOException {
|
||||
File manualdir = new File(configDir, "manual");
|
||||
if (!manualdir.exists()) {
|
||||
manualdir.mkdir();
|
||||
}
|
||||
|
||||
URL url = new URL("http://modmuss50.me/techreborn/manual/versions.json");
|
||||
URLConnection con = url.openConnection();
|
||||
InputStream in = con.getInputStream();
|
||||
String encoding = con.getContentEncoding();
|
||||
encoding = encoding == null ? "UTF-8" : encoding;
|
||||
String body = IOUtils.toString(in, encoding);
|
||||
Gson gson = new Gson();
|
||||
info = gson.fromJson(body, new TypeToken<VersionsInfo>() {
|
||||
}.getType());
|
||||
|
||||
DownloadablePackageInfo downloadablePackageInfo = null;
|
||||
|
||||
if(info != null){
|
||||
for(DownloadablePackageInfo packageInfo : info.versions){
|
||||
if(packageInfo.packageInfo.version.equals(MANUAL_VERSION)){
|
||||
downloadablePackageInfo = packageInfo;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(downloadablePackageInfo != null){
|
||||
File zipLocation = new File(manualdir, downloadablePackageInfo.fileName);
|
||||
if(zipLocation.exists()){
|
||||
String md5 = getMD5(zipLocation);
|
||||
if(md5.equals(downloadablePackageInfo.md5)){
|
||||
//Oh look we allready have it!
|
||||
}
|
||||
} else {
|
||||
FileUtils.copyURLToFile(new URL("http://modmuss50.me/techreborn/manual/packages/" + downloadablePackageInfo.fileName), zipLocation);
|
||||
String md5 = getMD5(zipLocation);
|
||||
if(md5.equals(downloadablePackageInfo.md5)){
|
||||
//ok the downloaded file is valid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String getMD5(File file) throws IOException {
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
String md5 = DigestUtils.md5Hex(fis);
|
||||
fis.close();
|
||||
return md5;
|
||||
}
|
||||
|
||||
|
||||
}
|
14
src/main/java/techreborn/manual/loader/PackageInfo.java
Normal file
14
src/main/java/techreborn/manual/loader/PackageInfo.java
Normal file
|
@ -0,0 +1,14 @@
|
|||
package techreborn.manual.loader;
|
||||
|
||||
/**
|
||||
* Created by Mark on 16/04/2016.
|
||||
*/
|
||||
public class PackageInfo {
|
||||
|
||||
public String name;
|
||||
|
||||
public String version;
|
||||
|
||||
public String language;
|
||||
|
||||
}
|
16
src/main/java/techreborn/manual/loader/VersionsInfo.java
Normal file
16
src/main/java/techreborn/manual/loader/VersionsInfo.java
Normal file
|
@ -0,0 +1,16 @@
|
|||
package techreborn.manual.loader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Mark on 16/04/2016.
|
||||
*/
|
||||
public class VersionsInfo {
|
||||
|
||||
String name;
|
||||
|
||||
String lastUpdated;
|
||||
|
||||
List<DownloadablePackageInfo> versions;
|
||||
|
||||
}
|
|
@ -18,6 +18,10 @@ import techreborn.client.hud.ChargeHud;
|
|||
import techreborn.client.keybindings.KeyBindings;
|
||||
import techreborn.client.render.entitys.RenderNukePrimed;
|
||||
import techreborn.entitys.EntityNukePrimed;
|
||||
import techreborn.manual.loader.ManualLoader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
|
@ -29,6 +33,17 @@ public class ClientProxy extends CommonProxy
|
|||
{
|
||||
super.preInit(event);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNukePrimed.class, new RenderManagerNuke());
|
||||
|
||||
ManualLoader loader = new ManualLoader(new File(event.getModConfigurationDirectory(), "techreborn"));
|
||||
|
||||
new Thread(() ->
|
||||
{
|
||||
try {
|
||||
loader.load();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -90,6 +90,11 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IWrenchable,
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFacing(EnumFacing enumFacing) {
|
||||
worldObj.setBlockState(pos, worldObj.getBlockState(pos).withProperty(BlockEnergyStorage.FACING, enumFacing));
|
||||
}
|
||||
|
||||
@Override public float getWrenchDropRate()
|
||||
{
|
||||
return 1.0F;
|
||||
|
|
Loading…
Add table
Reference in a new issue