mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +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;
|
||||
|
|
|
@ -76,12 +76,12 @@ public class BlockSlabs extends BlockBase{
|
|||
public boolean isOpaqueCube(IBlockState state){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
public boolean isFullCube(IBlockState state){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer){
|
||||
if(facing.ordinal() == 1){
|
||||
|
|
|
@ -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!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ public class ClientEvents{
|
|||
if(tileHit instanceof TileEntityBase){
|
||||
TileEntityBase base = (TileEntityBase)tileHit;
|
||||
if(base.isRedstoneToggle()){
|
||||
String strg = String.format("%s: %s", StringUtil.localize("info."+ModUtil.MOD_ID+".redstoneMode.name"), TextFormatting.DARK_RED+StringUtil.localize("info."+ModUtil.MOD_ID+".redstoneMode."+(base.isPulseMode ? "pulse" : "deactivation"))+TextFormatting.RESET);
|
||||
String strg = String.format("%s: %s", StringUtil.localize("info."+ModUtil.MOD_ID+".redstoneMode.name"), TextFormatting.DARK_RED+StringUtil.localize("info."+ModUtil.MOD_ID+".redstoneMode."+(base.isPulseMode ? "pulse" : "deactivation"))+TextFormatting.RESET);
|
||||
font.drawStringWithShadow(strg, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+5, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
|
||||
String expl;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -84,7 +84,7 @@ public class FilterSettingsGui extends Gui{
|
|||
else if(this.modButton.isMouseOver()){
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.add(TextFormatting.BOLD+(this.theSettings.respectMod ? StringUtil.localize("info."+ModUtil.MOD_ID+".gui.respectMod") : StringUtil.localize("info."+ModUtil.MOD_ID+".gui.ignoreMod")));
|
||||
|
||||
|
||||
list.addAll(mc.fontRendererObj.listFormattedStringToWidth(StringUtil.localize("info."+ModUtil.MOD_ID+".gui.respectModInfo"), 200));
|
||||
|
||||
GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRendererObj);
|
||||
|
@ -92,7 +92,7 @@ public class FilterSettingsGui extends Gui{
|
|||
else if(this.oredictButton.isMouseOver()){
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.add(TextFormatting.BOLD+(this.theSettings.respectOredict == 0 ? StringUtil.localize("info."+ModUtil.MOD_ID+".gui.ignoreOredict") : (this.theSettings.respectOredict == 1 ? StringUtil.localize("info."+ModUtil.MOD_ID+".gui.respectOredictSoft") : StringUtil.localize("info."+ModUtil.MOD_ID+".gui.respectOredictHard"))));
|
||||
|
||||
|
||||
String type = null;
|
||||
if(this.theSettings.respectOredict == 1){
|
||||
type = "one";
|
||||
|
@ -102,7 +102,7 @@ public class FilterSettingsGui extends Gui{
|
|||
}
|
||||
|
||||
if(type != null){
|
||||
list.addAll(mc.fontRendererObj.listFormattedStringToWidth(StringUtil.localize("info."+ModUtil.MOD_ID+".gui.respectOredictInfo."+type), 200));
|
||||
list.addAll(mc.fontRendererObj.listFormattedStringToWidth(StringUtil.localize("info."+ModUtil.MOD_ID+".gui.respectOredictInfo."+type), 200));
|
||||
}
|
||||
GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.fontRendererObj);
|
||||
}
|
||||
|
|
|
@ -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{
|
||||
|
||||
|
@ -85,8 +85,8 @@ public class GuiGrinder extends GuiContainer{
|
|||
this.energy.drawOverlay(x, y);
|
||||
|
||||
if(this.isDouble && this.buttonAutoSplit.isMouseOver()){
|
||||
|
||||
this.drawHoveringText(Collections.singletonList(TextFormatting.BOLD+(this.tileGrinder.isAutoSplit ? StringUtil.localize("info."+ModUtil.MOD_ID+".gui.autoSplitItems.on") : StringUtil.localize("info."+ModUtil.MOD_ID+".gui.autoSplitItems.off"))), x, y);
|
||||
|
||||
this.drawHoveringText(Collections.singletonList(TextFormatting.BOLD+(this.tileGrinder.isAutoSplit ? StringUtil.localize("info."+ModUtil.MOD_ID+".gui.autoSplitItems.on") : StringUtil.localize("info."+ModUtil.MOD_ID+".gui.autoSplitItems.off"))), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -240,6 +240,6 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi
|
|||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced){
|
||||
super.addInformation(stack, playerIn, tooltip, advanced);
|
||||
|
||||
tooltip.add(String.format("%d/%d %s",this.getStoredBlaze(stack) , MAX_BLAZE, StringUtil.localize("item."+ModUtil.MOD_ID+".item_misc_ring.storage")));
|
||||
tooltip.add(String.format("%d/%d %s", this.getStoredBlaze(stack), MAX_BLAZE, StringUtil.localize("item."+ModUtil.MOD_ID+".item_misc_ring.storage")));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -61,7 +59,7 @@ public abstract class ItemEnergy extends ItemBase{
|
|||
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
if(storage != null){
|
||||
NumberFormat format = NumberFormat.getInstance();
|
||||
list.add(String.format("%s/%s Crystal Flux",format.format(storage.getEnergyStored()),format.format(storage.getMaxEnergyStored())));
|
||||
list.add(String.format("%s/%s Crystal Flux", format.format(storage.getEnergyStored()), format.format(storage.getMaxEnergyStored())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -266,7 +266,7 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay{
|
|||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getExtraDisplayString(){
|
||||
return StringUtil.localize("info."+ModUtil.MOD_ID+".laserRelay.energy.extra") + ": " +TextFormatting.DARK_RED+StringUtil.localize(this.mode.name)+TextFormatting.RESET;
|
||||
return StringUtil.localize("info."+ModUtil.MOD_ID+".laserRelay.energy.extra")+": "+TextFormatting.DARK_RED+StringUtil.localize(this.mode.name)+TextFormatting.RESET;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -219,7 +219,7 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay{
|
|||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getExtraDisplayString(){
|
||||
return StringUtil.localize("info."+ModUtil.MOD_ID+".laserRelay.fluid.extra") + ": " +TextFormatting.DARK_RED+StringUtil.localize(this.mode.name)+TextFormatting.RESET;
|
||||
return StringUtil.localize("info."+ModUtil.MOD_ID+".laserRelay.fluid.extra")+": "+TextFormatting.DARK_RED+StringUtil.localize(this.mode.name)+TextFormatting.RESET;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -148,7 +148,7 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay{
|
|||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getExtraDisplayString(){
|
||||
return StringUtil.localize("info."+ModUtil.MOD_ID+".laserRelay.item.extra") + ": " + TextFormatting.DARK_RED+this.getPriority()+TextFormatting.RESET;
|
||||
return StringUtil.localize("info."+ModUtil.MOD_ID+".laserRelay.item.extra")+": "+TextFormatting.DARK_RED+this.getPriority()+TextFormatting.RESET;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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