mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
some cleanup
This commit is contained in:
parent
a082fce0a0
commit
13c3df3330
20 changed files with 60 additions and 79 deletions
|
@ -46,7 +46,7 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
|||
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.compat.CraftingTweaksCompat;
|
||||
import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
@ -116,8 +116,7 @@ public class ActuallyAdditions{
|
|||
new CommonEvents();
|
||||
InitCrafting.init();
|
||||
InitEntities.init();
|
||||
|
||||
CraftingTweaksCompat.register();
|
||||
CompatUtil.registerCraftingTweaksCompat();
|
||||
|
||||
proxy.init(event);
|
||||
|
||||
|
@ -148,7 +147,7 @@ public class ActuallyAdditions{
|
|||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
if(server != null){
|
||||
World world = server.getEntityWorld();
|
||||
if(world != null){
|
||||
if(world != null && !world.isRemote){
|
||||
WorldData.get(world, true).markDirty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,11 +18,7 @@ import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestLarge;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestMedium;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerCustom;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
|
|
@ -15,7 +15,6 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
|
|||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
|
|
|
@ -101,6 +101,18 @@ public class GuiMainPage extends GuiBooklet{
|
|||
super(previousScreen, null);
|
||||
}
|
||||
|
||||
private static List<IBookletEntry> getDisplayedEntries(){
|
||||
List<IBookletEntry> displayed = new ArrayList<IBookletEntry>();
|
||||
|
||||
for(IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES){
|
||||
if(entry.visibleOnFrontPage()){
|
||||
displayed.add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
return displayed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
|
@ -290,16 +302,4 @@ public class GuiMainPage extends GuiBooklet{
|
|||
public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer){
|
||||
|
||||
}
|
||||
|
||||
private static List<IBookletEntry> getDisplayedEntries(){
|
||||
List<IBookletEntry> displayed = new ArrayList<IBookletEntry>();
|
||||
|
||||
for(IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES){
|
||||
if(entry.visibleOnFrontPage()){
|
||||
displayed.add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
return displayed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,10 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
|
||||
public class PageTrials extends BookletPage{
|
||||
|
||||
private final int buttonId;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private GuiButton button;
|
||||
|
||||
private final int buttonId;
|
||||
|
||||
public PageTrials(int localizationKey, boolean button, boolean text){
|
||||
super(localizationKey);
|
||||
|
||||
|
|
|
@ -105,6 +105,7 @@ public class WorldData extends WorldSavedData{
|
|||
public static void clear(){
|
||||
if(data != null){
|
||||
data = null;
|
||||
ModUtil.LOGGER.info("Unloaded WorldData!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerGrinder;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||
|
@ -29,6 +26,9 @@ import net.minecraft.util.text.TextFormatting;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiGrinder extends GuiContainer{
|
||||
|
||||
|
|
|
@ -44,6 +44,11 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles{
|
|||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
public static boolean isWearing(EntityPlayer player){
|
||||
ItemStack face = player.inventory.armorInventory.get(3);
|
||||
return StackUtil.isValid(face) && face.getItem() instanceof IGoggles;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onClientTick(ClientTickEvent event){
|
||||
|
@ -85,11 +90,6 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles{
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean isWearing(EntityPlayer player){
|
||||
ItemStack face = player.inventory.armorInventory.get(3);
|
||||
return StackUtil.isValid(face) && face.getItem() instanceof IGoggles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.RARE;
|
||||
|
|
|
@ -13,8 +13,6 @@ package de.ellpeck.actuallyadditions.mod.items.base;
|
|||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.compat.TeslaForgeUnitsWrapper;
|
||||
import de.ellpeck.actuallyadditions.mod.util.compat.TeslaUtil;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
|
|
@ -31,17 +31,6 @@ import java.util.List;
|
|||
|
||||
public class DefaultFarmerBehavior implements IFarmerBehavior{
|
||||
|
||||
@Override
|
||||
public FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer){
|
||||
int use = 350;
|
||||
if(farmer.getEnergy() >= use*2){
|
||||
if(defaultPlant(world, pos, this.getPlantablePlantFromStack(seed, world, pos), farmer, use)){
|
||||
return FarmerResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
return FarmerResult.FAIL;
|
||||
}
|
||||
|
||||
public static boolean defaultPlant(World world, BlockPos pos, IBlockState toPlant, IFarmer farmer, int use){
|
||||
if(toPlant != null){
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
|
@ -86,6 +75,17 @@ public class DefaultFarmerBehavior implements IFarmerBehavior{
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FarmerResult tryPlantSeed(ItemStack seed, World world, BlockPos pos, IFarmer farmer){
|
||||
int use = 350;
|
||||
if(farmer.getEnergy() >= use*2){
|
||||
if(defaultPlant(world, pos, this.getPlantablePlantFromStack(seed, world, pos), farmer, use)){
|
||||
return FarmerResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
return FarmerResult.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FarmerResult tryHarvestPlant(World world, BlockPos pos, IFarmer farmer){
|
||||
int use = 250;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.util.compat;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCrafter;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockCrops;
|
||||
|
@ -55,4 +56,11 @@ public final class CompatUtil{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerCraftingTweaksCompat(){
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tagCompound.setString("ContainerClass", ContainerCrafter.class.getName());
|
||||
tagCompound.setString("AlignToGrid", "left");
|
||||
FMLInterModComms.sendMessage("craftingtweaks", "RegisterProvider", tagCompound);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
package de.ellpeck.actuallyadditions.mod.util.compat;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCrafter;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
|
||||
public class CraftingTweaksCompat{
|
||||
|
||||
private static final String MOD_ID = "craftingtweaks";
|
||||
|
||||
public static void register(){
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tagCompound.setString("ContainerClass", ContainerCrafter.class.getName());
|
||||
tagCompound.setString("AlignToGrid", "left");
|
||||
FMLInterModComms.sendMessage(MOD_ID, "RegisterProvider", tagCompound);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue