mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-24 22:14:45 +00:00
Fix texture errors, fix pool and apothecary collision detection
This commit is contained in:
1 parent
b701f197ee
commit
8eedaa5563
16 files changed
+28
-82
No files matched your search
@@ -42,62 +42,11 @@ import java.util.Locale;
|
||||
public final class IconHelper {
|
||||
|
||||
public static TextureAtlasSprite forName(TextureMap ir, String name) {
|
||||
return ir.registerSprite(new ResourceLocation(LibResources.PREFIX_MOD, name));
|
||||
return ir.registerSprite(new ResourceLocation(LibResources.PREFIX_MOD + name));
|
||||
}
|
||||
|
||||
public static TextureAtlasSprite forName(TextureMap ir, String name, String dir) {
|
||||
return ir.registerSprite(new ResourceLocation(LibResources.PREFIX_MOD, dir + "/" + name));
|
||||
}
|
||||
|
||||
public static TextureAtlasSprite forBlock(TextureMap ir, Block block) {
|
||||
return forName(ir, block.getUnlocalizedName().replaceAll("tile\\.", ""));
|
||||
}
|
||||
|
||||
public static TextureAtlasSprite forBlock(TextureMap ir, Block block, int i) {
|
||||
return forBlock(ir, block, Integer.toString(i));
|
||||
}
|
||||
|
||||
public static TextureAtlasSprite forBlock(TextureMap ir, Block block, int i, String dir) {
|
||||
return forBlock(ir, block, Integer.toString(i), dir);
|
||||
}
|
||||
|
||||
public static TextureAtlasSprite forBlock(TextureMap ir, Block block, String s) {
|
||||
return forName(ir, block.getUnlocalizedName().replaceAll("tile\\.", "") + s);
|
||||
}
|
||||
|
||||
public static TextureAtlasSprite forBlock(TextureMap ir, Block block, String s, String dir) {
|
||||
return forName(ir, block.getUnlocalizedName().replaceAll("tile\\.", "") + s, dir);
|
||||
}
|
||||
|
||||
public static TextureAtlasSprite forItem(TextureMap ir, Item item) {
|
||||
return forName(ir, item.getUnlocalizedName().replaceAll("item\\.", ""));
|
||||
}
|
||||
|
||||
public static TextureAtlasSprite forItem(TextureMap ir, Item item, int i) {
|
||||
return forItem(ir, item, Integer.toString(i));
|
||||
}
|
||||
|
||||
public static TextureAtlasSprite forItem(TextureMap ir, Item item, String s) {
|
||||
return forName(ir, item.getUnlocalizedName().replaceAll("item\\.", "") + s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and bake an arbitrary model
|
||||
*/
|
||||
public static IFlexibleBakedModel loadAndBakeArbitraryModel(ResourceLocation location) {
|
||||
|
||||
try {
|
||||
IModel unbaked = ModelLoaderRegistry.getModel(location);
|
||||
return unbaked.bake(unbaked.getDefaultState(), DefaultVertexFormats.ITEM, new Function<ResourceLocation, TextureAtlasSprite>() {
|
||||
@Override
|
||||
public TextureAtlasSprite apply(ResourceLocation input) {
|
||||
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString());
|
||||
}
|
||||
});
|
||||
} catch (IOException ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ir.registerSprite(new ResourceLocation(LibResources.PREFIX_MOD + dir + "/" + name));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class BlockAlfPortal extends BlockModContainer implements IWandable, ILex
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTextureStitch(TextureStitchEvent.Pre evt) {
|
||||
portalTex = IconHelper.forBlock(evt.map, this, "Inside");
|
||||
portalTex = IconHelper.forName(evt.map, "alfheimPortalInside", "blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -127,7 +127,8 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World par1World, BlockPos pos, Entity par5Entity) {
|
||||
public void onEntityCollidedWithBlock(World par1World, BlockPos pos, IBlockState state, Entity par5Entity) {
|
||||
System.out.println("Collide");
|
||||
if(par5Entity instanceof EntityItem) {
|
||||
TileAltar tile = (TileAltar) par1World.getTileEntity(pos);
|
||||
if(tile.collideEntityItem((EntityItem) par5Entity))
|
||||
|
||||
@@ -85,8 +85,8 @@ public class BlockLightRelay extends BlockModContainer implements IWandable, ILe
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onTextureStitch(TextureStitchEvent.Pre evt) {
|
||||
worldIcon = IconHelper.forBlock(evt.map, this, 1);
|
||||
worldIconRed = IconHelper.forBlock(evt.map, this, 3);
|
||||
worldIcon = IconHelper.forName(evt.map, "lightRelay1", "blocks");
|
||||
worldIconRed = IconHelper.forName(evt.map, "lightRelay3", "blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -69,6 +69,11 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 2; // todo
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, BotaniaStateProps.COLOR);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class BlockAlchemyCatalyst extends BlockMod implements ILexiconable, IPoo
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTextureStitch(TextureStitchEvent.Pre evt) {
|
||||
overlay = IconHelper.forBlock(evt.map, this, 3);
|
||||
overlay = IconHelper.forName(evt.map, "alchemyCatalyst3", "blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -68,7 +68,7 @@ public class BlockEnchanter extends BlockModContainer implements IWandable, ILex
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onTextureStitch(TextureStitchEvent.Pre evt) {
|
||||
overlay = IconHelper.forBlock(evt.map, this, "Overlay");
|
||||
overlay = IconHelper.forName(evt.map, "enchanterOverlay", "blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,7 +53,7 @@ public class BlockManaVoid extends BlockModContainer implements ILexiconable, IP
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onTextureStitch(TextureStitchEvent.Pre evt) {
|
||||
overlay = IconHelper.forBlock(evt.map, this, 1);
|
||||
overlay = IconHelper.forName(evt.map, "manaVoid1", "blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -101,7 +101,7 @@ public class BlockPool extends BlockModContainer implements IWandHUD, IWandable,
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onTextureStitch(TextureStitchEvent.Pre evt) {
|
||||
manaIcon = IconHelper.forName(evt.map, "manaWater");
|
||||
manaIcon = IconHelper.forName(evt.map, "manaWater", "blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -151,7 +151,7 @@ public class BlockPool extends BlockModContainer implements IWandHUD, IWandable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World par1World, BlockPos pos, Entity par5Entity) {
|
||||
public void onEntityCollidedWithBlock(World par1World, BlockPos pos, IBlockState state, Entity par5Entity) {
|
||||
if(par5Entity instanceof EntityItem) {
|
||||
TilePool tile = (TilePool) par1World.getTileEntity(pos);
|
||||
if(tile.collideEntityItem((EntityItem) par5Entity))
|
||||
@@ -160,7 +160,7 @@ public class BlockPool extends BlockModContainer implements IWandHUD, IWandable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World p_149743_1_, BlockPos pos, IBlockState state, AxisAlignedBB p_149743_5_, List p_149743_6_, Entity p_149743_7_) {
|
||||
public void addCollisionBoxesToList(World p_149743_1_, BlockPos pos, IBlockState state, AxisAlignedBB p_149743_5_, List<AxisAlignedBB> p_149743_6_, Entity p_149743_7_) {
|
||||
float f = 1F / 16F;
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
|
||||
super.addCollisionBoxesToList(p_149743_1_, pos, state, p_149743_5_, p_149743_6_, p_149743_7_);
|
||||
|
||||
@@ -82,7 +82,7 @@ public class BlockTerraPlate extends BlockModContainer implements ILexiconable {
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onTextureStitch(TextureStitchEvent.Pre evt) {
|
||||
overlay = IconHelper.forBlock(evt.map, this, "Overlay");
|
||||
overlay = IconHelper.forName(evt.map, "terraPlateOverlay", "blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,7 @@ public class TriggerManaDetector extends StatementBase implements ITriggerIntern
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerIcons(TextureStitchEvent.Pre evt) {
|
||||
icon = IconHelper.forName(evt.map, "triggers/manaDetector");
|
||||
icon = IconHelper.forName(evt.map, "triggers/manaDetector", "items");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TriggerManaLevel extends StatementBase implements ITriggerExternal
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerIcons(TextureStitchEvent.Pre evt) {
|
||||
icon = IconHelper.forName(evt.map, "triggers/mana" + WordUtils.capitalizeFully(state.name()));
|
||||
icon = IconHelper.forName(evt.map, "triggers/mana" + WordUtils.capitalizeFully(state.name()), "items");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ public class TriggerRuneAltarCanCraft extends StatementBase implements ITriggerE
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerIcons(TextureStitchEvent.Pre evt) {
|
||||
icon = IconHelper.forName(evt.map, "triggers/runeAltarCanCraft");
|
||||
icon = IconHelper.forName(evt.map, "triggers/runeAltarCanCraft", "items");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ public class ItemTerrasteelHelm extends ItemTerrasteelArmor implements IManaDisc
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onTextureStitch(TextureStitchEvent evt) {
|
||||
willIcon = IconHelper.forName(evt.map, "willFlame");
|
||||
willIcon = IconHelper.forName(evt.map, "willFlame", "items");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -72,19 +72,10 @@ public class ItemManaResource extends ItemMod implements IFlowerComponent, IElve
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onTextureStitch(TextureStitchEvent.Pre evt) {
|
||||
tailIcon = IconHelper.forName(evt.map, "tail");
|
||||
phiFlowerIcon = IconHelper.forName(evt.map, "phiFlower");
|
||||
goldfishIcon = IconHelper.forName(evt.map, "goldfish");
|
||||
nerfBatIcon = IconHelper.forName(evt.map, "nerfBat");
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onModelBake(ModelBakeEvent evt) {
|
||||
/*evt.modelRegistry.putObject(new ModelResourceLocation("botania:item/tail", "inventory"), IconHelper.loadAndBakeArbitraryModel(new ResourceLocation("botania:item/tail")));
|
||||
evt.modelRegistry.putObject(new ModelResourceLocation("botania:item/phiFlower", "inventory"), IconHelper.loadAndBakeArbitraryModel(new ResourceLocation("botania:item/phiFlower")));
|
||||
evt.modelRegistry.putObject(new ModelResourceLocation("botania:item/goldfish", "inventory"), IconHelper.loadAndBakeArbitraryModel(new ResourceLocation("botania:item/goldfish")));
|
||||
evt.modelRegistry.putObject(new ModelResourceLocation("botania:item/nerfBat", "inventory"), IconHelper.loadAndBakeArbitraryModel(new ResourceLocation("botania:item/nerfBat")));*/
|
||||
tailIcon = IconHelper.forName(evt.map, "tail", "items");
|
||||
phiFlowerIcon = IconHelper.forName(evt.map, "phiFlower", "items");
|
||||
goldfishIcon = IconHelper.forName(evt.map, "goldfish", "items");
|
||||
nerfBatIcon = IconHelper.forName(evt.map, "nerfBat", "items");
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ItemKingKey extends ItemRelic implements IManaUsingItem {
|
||||
public void registerIcons(TextureStitchEvent.Pre event) {
|
||||
weaponIcons = new TextureAtlasSprite[WEAPON_TYPES];
|
||||
for(int i = 0; i < WEAPON_TYPES; i++)
|
||||
weaponIcons[i] = IconHelper.forName(event.map, "gateWeapon" + i);
|
||||
weaponIcons[i] = IconHelper.forName(event.map, "gateWeapon" + i, "items");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user