Skip to content

Commit

Permalink
Merge branch 'Roadhog360:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
iocmet authored Oct 28, 2023
2 parents 7bc1625 + 2183fab commit 3119c35
Show file tree
Hide file tree
Showing 20 changed files with 97 additions and 118 deletions.
2 changes: 1 addition & 1 deletion src/main/java/ganymedes01/etfuturum/blocks/BaseSlab.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public String[] getTypes() {
public void registerBlockIcons(IIconRegister reg) {
setIcons(new IIcon[getTypes().length]);
for (int i = 0; i < getIcons().length; i++) {
getIcons()[i] = "".equals(getTypes()[i]) ? reg.registerIcon(getTextureName()) : reg.registerIcon(getTypes()[i]);
getIcons()[i] = "".equals(getTypes()[i]) ? reg.registerIcon(getTextureName()) : reg.registerIcon((getTextureDomain().isEmpty() ? "" : getTextureDomain() + ":") + getTypes()[i]);
}
blockIcon = getIcons()[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void registerBlockIcons(IIconRegister reg) {
((TextureMap) reg).setTextureEntry(getTypes()[i], icon);
getIcons()[i] = icon;
} else {
getIcons()[i] = "".equals(getTypes()[i]) ? reg.registerIcon(getTextureName()) : reg.registerIcon(getTypes()[i]);
getIcons()[i] = "".equals(getTypes()[i]) ? reg.registerIcon(getTextureName()) : reg.registerIcon((getTextureDomain().isEmpty() ? "" : getTextureDomain() + ":") + getTypes()[i]);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public IIcon getIcon(int side, int meta) {
public void registerBlockIcons(IIconRegister reg) {
setIcons(new IIcon[getTypes().length]);
for (int i = 0; i < getIcons().length; i++) {
getIcons()[i] = "".equals(getTypes()[i]) ? reg.registerIcon(getTextureName()) : reg.registerIcon(getTypes()[i]);
getIcons()[i] = "".equals(getTypes()[i]) ? reg.registerIcon(getTextureName()) : reg.registerIcon((getTextureDomain().isEmpty() ? "" : getTextureDomain() + ":") + getTypes()[i]);
}
blockIcon = getIcons()[0];
}
Expand Down
21 changes: 16 additions & 5 deletions src/main/java/ganymedes01/etfuturum/blocks/BaseWall.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import java.util.List;

public class BaseWall extends BlockWall {
public class BaseWall extends BlockWall implements ISubBlocksBlock {

private final Block[] blocks;
private final int[] metas;
Expand Down Expand Up @@ -67,12 +67,23 @@ public int damageDropped(int meta) {
return meta % variations;
}

public String getWallName(ItemStack stack) {
return "tile." + Utils.getUnlocalisedName(names != null && names.length > 0 ? names[stack.getItemDamage() % variations] : getUnlocalizedName().substring(6 + Reference.MOD_ID.length()));
}

@Override
public boolean canPlaceTorchOnTop(World world, int x, int y, int z) {
return true;
}

@Override
public IIcon[] getIcons() {
return new IIcon[0];
}

@Override
public String[] getTypes() {
return names;
}

@Override
public String getNameFor(ItemStack stack) {
return "tile." + getNameDomain() + "." + (names != null && names.length > 0 ? names[stack.getItemDamage() % variations] : getUnlocalizedName().substring(6 + Reference.MOD_ID.length()));
}
}
8 changes: 6 additions & 2 deletions src/main/java/ganymedes01/etfuturum/blocks/BlockCopper.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@
public class BlockCopper extends BaseSubtypesBlock implements IDegradable {

public BlockCopper() {
super(Material.iron, "copper_block", "exposed_copper", "weathered_copper", "oxidized_copper", "cut_copper", "exposed_cut_copper", "weathered_cut_copper",
this("copper_block", "exposed_copper", "weathered_copper", "oxidized_copper", "cut_copper", "exposed_cut_copper", "weathered_cut_copper",
"oxidized_cut_copper", "waxed_copper_block", "waxed_exposed_copper", "waxed_weathered_copper", "waxed_oxidized_copper", "waxed_cut_copper", "waxed_exposed_cut_copper",
"waxed_weathered_cut_copper", "waxed_oxidized_cut_copper");
}

public BlockCopper(String... types) {
super(Material.iron, types);
setHardness(3);
setResistance(6);
setHarvestLevel("pickaxe", 1);
Expand All @@ -46,7 +50,7 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer e
public void registerBlockIcons(IIconRegister reg) {
setIcons(new IIcon[8]);
for (int i = 0; i < getIcons().length; i++) {
getIcons()[i] = "".equals(getTypes()[i]) ? reg.registerIcon(getTextureName()) : reg.registerIcon(getTypes()[i]);
getIcons()[i] = reg.registerIcon((getTextureDomain().isEmpty() ? "" : getTextureDomain() + ":") + getTypes()[i]);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@

public class BlockCutCopperSlab extends BaseSlab implements IDegradable {

public BlockCutCopperSlab(boolean p_i45410_1_) {
super(p_i45410_1_, Material.iron, "cut_copper", "exposed_cut_copper", "weathered_cut_copper", "oxidized_cut_copper", "waxed_cut_copper", "waxed_exposed_cut_copper",
public BlockCutCopperSlab(boolean isDouble) {
this(isDouble, "cut_copper", "exposed_cut_copper", "weathered_cut_copper", "oxidized_cut_copper", "waxed_cut_copper", "waxed_exposed_cut_copper",
"waxed_weathered_cut_copper", "waxed_oxidized_cut_copper");
}

public BlockCutCopperSlab(boolean isDouble, String... types) {
super(isDouble, Material.iron, types);
setHardness(3);
setResistance(6);
setHarvestLevel("pickaxe", 1);
Expand All @@ -43,7 +47,7 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer e
public void registerBlockIcons(IIconRegister reg) {
setIcons(new IIcon[4]);
for (int i = 0; i < getIcons().length; i++) {
getIcons()[i] = "".equals(getTypes()[i]) ? reg.registerIcon(getTextureName()) : reg.registerIcon(getTypes()[i]);
getIcons()[i] = reg.registerIcon((getTextureDomain().isEmpty() ? "" : getTextureDomain() + ":") + getTypes()[i]);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,12 @@
public class BlockCutCopperStairs extends BaseStairs implements IDegradable {

public BlockCutCopperStairs(int p_i45428_2_) {
super(ModBlocks.COPPER_BLOCK.get(), p_i45428_2_);
String name = "cut_copper";
String subtype;
switch (meta) {
default:
subtype = "";
break;
case 5:
subtype = "exposed";
break;
case 6:
subtype = "weathered";
break;
case 7:
subtype = "oxidized";
break;
case 12:
subtype = "waxed";
break;
case 13:
subtype = "waxed_exposed";
break;
case 14:
subtype = "waxed_weathered";
break;
case 15:
subtype = "waxed_oxidized";
break;
}
setUnlocalizedNameWithPrefix(subtype + (subtype.equals("") ? "" : "_") + name);
this(ModBlocks.COPPER_BLOCK.get(), p_i45428_2_);
}

public BlockCutCopperStairs(Block baseBlock, int p_i45428_2_) {
super(baseBlock, p_i45428_2_);
setUnlocalizedNameWithPrefix(((ISubBlocksBlock) baseBlock).getTypes()[p_i45428_2_]);
setTickRandomly(meta < 7);
}

Expand Down
7 changes: 3 additions & 4 deletions src/main/java/ganymedes01/etfuturum/blocks/BlockLantern.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
import ganymedes01.etfuturum.configuration.configs.ConfigSounds;
import ganymedes01.etfuturum.core.utils.Utils;
import ganymedes01.etfuturum.lib.RenderIDs;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.block.BlockWall;
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
Expand Down Expand Up @@ -58,8 +56,9 @@ public boolean canBlockStay(World world, int x, int y, int z) {

private boolean canPlaceAbove(World world, int x, int y, int z) {
Block above = world.getBlock(x, y + 1, z);
int aboveMeta = world.getBlockMetadata(x, y + 1, z);
return world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN) || (above == ModBlocks.CHAIN.get() && world.getBlockMetadata(x, y + 1, z) == 0)
|| above instanceof BlockFence || above instanceof BlockWall;
|| above instanceof BlockFence || above instanceof BlockWall || (above instanceof BlockSlab && aboveMeta < 8) || (above instanceof BlockStairs && aboveMeta < 4);
}

private boolean canPlaceBelow(World world, int x, int y, int z) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
import ganymedes01.etfuturum.items.ItemModdedRawOre;
import ganymedes01.etfuturum.lib.Reference;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;

import java.util.List;

Expand Down Expand Up @@ -41,11 +39,7 @@ public void getSubBlocks(Item item, CreativeTabs tab, List list) {
}

@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
setIcons(new IIcon[getTypes().length]);
for (int i = 0; i < getTypes().length; i++) {
getIcons()[i] = reg.registerIcon(Reference.MOD_ID + ":" + getTypes()[i]);
}
public String getTextureDomain() {
return Reference.MOD_ID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ganymedes01.etfuturum.lib.Reference;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;

Expand All @@ -12,4 +13,12 @@ public interface ISubBlocksBlock {
String[] getTypes();

String getNameFor(ItemStack stack);

default String getTextureDomain() {
return "";
}

default String getNameDomain() {
return Reference.MOD_ID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ganymedes01.etfuturum.blocks.ISubBlocksBlock;
import ganymedes01.etfuturum.core.utils.Utils;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
Expand All @@ -25,7 +24,7 @@ public String getUnlocalizedName(ItemStack stack) {
}

private String addTilePrefix(String name) {
return name.startsWith("tile.") ? name : "tile." + Utils.getUnlocalisedName(name);
return name.startsWith("tile.") ? name : "tile." + ((ISubBlocksBlock) field_150939_a).getNameDomain() + "." + name;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import ganymedes01.etfuturum.blocks.BaseSlab;
import ganymedes01.etfuturum.blocks.ISubBlocksBlock;
import ganymedes01.etfuturum.core.utils.Utils;
import net.minecraft.block.Block;
import net.minecraft.item.ItemSlab;
import net.minecraft.item.ItemStack;
Expand All @@ -20,7 +19,7 @@ public String getUnlocalizedName(ItemStack stack) {
}

private String addTilePrefix(String name) {
return name.startsWith("tile.") ? name : "tile." + Utils.getUnlocalisedName(name);
return name.startsWith("tile.") ? name : "tile." + ((ISubBlocksBlock) field_150939_a).getNameDomain() + "." + name;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ganymedes01.etfuturum.blocks.ISubBlocksBlock;
import ganymedes01.etfuturum.core.utils.Utils;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
Expand All @@ -23,7 +22,7 @@ public String getUnlocalizedName(ItemStack stack) {
}

private String addTilePrefix(String name) {
return name.startsWith("tile.") ? name : "tile." + Utils.getUnlocalisedName(name);
return name.startsWith("tile.") ? name : "tile." + ((ISubBlocksBlock) field_150939_a).getNameDomain() + "." + name;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public int getMetadata(int p_77647_1_) {
}

public String getUnlocalizedName(ItemStack p_77667_1_) {
return ((BaseWall) field_150939_a).getWallName(p_77667_1_);
return ((BaseWall) field_150939_a).getNameFor(p_77667_1_);
}

}
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package ganymedes01.etfuturum.blocks.ores;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ganymedes01.etfuturum.blocks.BaseSubtypesBlock;
import ganymedes01.etfuturum.blocks.IEmissiveLayerBlock;
import ganymedes01.etfuturum.client.sound.ModSounds;
import ganymedes01.etfuturum.core.utils.ExternalContent;
import ganymedes01.etfuturum.lib.Reference;
import ganymedes01.etfuturum.lib.RenderIDs;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
Expand Down Expand Up @@ -65,12 +62,8 @@ public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3
}

@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
setIcons(new IIcon[getTypes().length]);
for (int i = 0; i < getTypes().length; i++) {
getIcons()[i] = reg.registerIcon(Reference.MOD_ID + ":" + getTypes()[i]);
}
public String getTextureDomain() {
return Reference.MOD_ID;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
import ganymedes01.etfuturum.core.utils.Utils;
import ganymedes01.etfuturum.lib.Reference;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
Expand Down Expand Up @@ -57,11 +55,7 @@ public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
}

@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
setIcons(new IIcon[getTypes().length]);
for (int i = 0; i < getTypes().length; i++) {
getIcons()[i] = reg.registerIcon(Reference.MOD_ID + ":" + getTypes()[i]);
}
public String getTextureDomain() {
return Reference.MOD_ID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void registerEntities() {
ModEntityList.registerEntity(EntityShulkerBullet.class, "shulker_candy", 17, EtFuturum.instance, 64, 1, true);

if (ConfigTweaks.shulkersSpawnAnywhere) {
EntityRegistry.addSpawn(EntityShulker.class, 2, 1, 2, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(Type.END));
EntityRegistry.addSpawn(EntityShulker.class, 1, 1, 2, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(Type.END));
}
}

Expand Down
14 changes: 11 additions & 3 deletions src/main/java/ganymedes01/etfuturum/items/BaseSubtypesItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ganymedes01.etfuturum.core.utils.Utils;
import ganymedes01.etfuturum.lib.Reference;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
Expand All @@ -25,7 +25,7 @@ public BaseSubtypesItem(String... types) {

@Override
public String getUnlocalizedName(ItemStack stack) {
return "item." + Utils.getUnlocalisedName(types[stack.getItemDamage() % types.length]);
return "item." + getNameDomain() + "." + types[stack.getItemDamage() % types.length];
}

@Override
Expand All @@ -48,7 +48,15 @@ public void getSubItems(Item item, CreativeTabs tabs, List list) {
public void registerIcons(IIconRegister reg) {
icons = new IIcon[types.length];
for (int i = 0; i < types.length; i++) {
icons[i] = reg.registerIcon(types[i]);
icons[i] = reg.registerIcon((getTextureDomain().isEmpty() ? "" : getTextureDomain() + ":") + types[i]);
}
}

public String getTextureDomain() {
return "";
}

public String getNameDomain() {
return Reference.MOD_ID;
}
}
Loading

0 comments on commit 3119c35

Please sign in to comment.