mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
Minor fixes and cleanings
This commit is contained in:
1 parent
95fc132f9f
commit
364cf37747
9 files changed
+86
-72
No files matched your search
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.client.gui.lexicon.button;
|
||||
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.audio.SimpleSound;
|
||||
import net.minecraft.client.audio.SoundHandler;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import vazkii.botania.common.core.handler.ModSounds;
|
||||
@@ -23,7 +23,7 @@ public class GuiButtonLexicon extends GuiButton {
|
||||
|
||||
@Override
|
||||
public void playPressSound(SoundHandler handler) {
|
||||
handler.playSound(PositionedSoundRecord.getMasterRecord(ModSounds.lexiconPage, 1.0F));
|
||||
handler.play(SimpleSound.master(ModSounds.lexiconPage, 1.0F));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,11 +11,10 @@ package vazkii.botania.client.model;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
@@ -14,9 +14,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -28,7 +26,6 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import thaumcraft.api.crafting.IInfusionStabiliser;
|
||||
|
||||
@@ -22,7 +22,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.BiomeStoneVariant;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.ModFluffBlocks;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
|
||||
@@ -38,14 +38,12 @@ import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
@@ -75,6 +75,7 @@ import vazkii.botania.common.item.interaction.thaumcraft.ItemManasteelHelmReveal
|
||||
import vazkii.botania.common.item.interaction.thaumcraft.ItemTerrasteelHelmRevealing;
|
||||
import vazkii.botania.common.item.lens.*;
|
||||
import vazkii.botania.common.item.material.ItemDye;
|
||||
import vazkii.botania.common.item.material.ItemEnderAir;
|
||||
import vazkii.botania.common.item.material.ItemManaResource;
|
||||
import vazkii.botania.common.item.material.ItemPestleAndMortar;
|
||||
import vazkii.botania.common.item.material.ItemPetal;
|
||||
@@ -136,7 +137,7 @@ public final class ModItems {
|
||||
public static final Item redString = new ItemManaResource(defaultBuilder()).setRegistryName(LibMisc.MOD_ID, LibItemNames.MANA_RESOURCE_NAMES[12]);
|
||||
public static final Item dreamwoodTwig = new ItemManaResource(defaultBuilder()).setRegistryName(LibMisc.MOD_ID, LibItemNames.MANA_RESOURCE_NAMES[13]);
|
||||
public static final Item gaiaIngot = new ItemManaResource(defaultBuilder()).setRegistryName(LibMisc.MOD_ID, LibItemNames.MANA_RESOURCE_NAMES[14]);
|
||||
public static final Item enderAirBottle = new ItemManaResource(defaultBuilder()).setRegistryName(LibMisc.MOD_ID, LibItemNames.MANA_RESOURCE_NAMES[15]);
|
||||
public static final Item enderAirBottle = new ItemEnderAir(defaultBuilder()).setRegistryName(LibMisc.MOD_ID, LibItemNames.MANA_RESOURCE_NAMES[15]);
|
||||
public static final Item manaString = new ItemManaResource(defaultBuilder()).setRegistryName(LibMisc.MOD_ID, LibItemNames.MANA_RESOURCE_NAMES[16]);
|
||||
public static final Item manasteelNugget = new ItemManaResource(defaultBuilder()).setRegistryName(LibMisc.MOD_ID, LibItemNames.MANA_RESOURCE_NAMES[17]);
|
||||
public static final Item terrasteelNugget = new ItemManaResource(defaultBuilder()).setRegistryName(LibMisc.MOD_ID, LibItemNames.MANA_RESOURCE_NAMES[18]);
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package vazkii.botania.common.item.material;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.dimension.EndDimension;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import vazkii.botania.common.entity.EntityEnderAirBottle;
|
||||
import vazkii.botania.common.item.ItemMod;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
|
||||
public class ItemEnderAir extends ItemMod {
|
||||
public ItemEnderAir(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onPlayerInteract(PlayerInteractEvent.RightClickBlock event) {
|
||||
ItemStack stack = event.getItemStack();
|
||||
boolean correctStack = !stack.isEmpty() && stack.getItem() == Items.GLASS_BOTTLE;
|
||||
boolean ender = event.getWorld().getDimension() instanceof EndDimension;
|
||||
|
||||
if(correctStack && ender) {
|
||||
if (event.getWorld().isRemote) {
|
||||
event.getEntityPlayer().swingArm(event.getHand());
|
||||
} else {
|
||||
ItemStack stack1 = new ItemStack(ModItems.enderAirBottle);
|
||||
|
||||
ItemHandlerHelper.giveItemToPlayer(event.getEntityPlayer(), stack1);
|
||||
|
||||
stack.shrink(1);
|
||||
|
||||
event.getWorld().playSound(null, event.getPos(), SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.5F, 1F);
|
||||
}
|
||||
|
||||
event.setCanceled(true);
|
||||
event.setCancellationResult(EnumActionResult.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if(!player.abilities.isCreativeMode)
|
||||
stack.shrink(1);
|
||||
|
||||
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 0.5F, 0.4F / (random.nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
if(!world.isRemote) {
|
||||
EntityEnderAirBottle b = new EntityEnderAirBottle(player, world);
|
||||
b.shoot(player, player.rotationPitch, player.rotationYaw, 0F, 1.5F, 1F);
|
||||
world.spawnEntity(b);
|
||||
}
|
||||
else player.swingArm(hand);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
}
|
||||
@@ -21,10 +21,8 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProviderEnd;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import vazkii.botania.api.item.IPetalApothecary;
|
||||
import vazkii.botania.api.recipe.IElvenItem;
|
||||
@@ -37,36 +35,11 @@ import vazkii.botania.common.item.ModItems;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
// todo 1.13 further break this up
|
||||
@Mod.EventBusSubscriber
|
||||
public class ItemManaResource extends ItemMod implements IFlowerComponent, IElvenItem {
|
||||
public ItemManaResource(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onPlayerInteract(PlayerInteractEvent.RightClickBlock event) {
|
||||
ItemStack stack = event.getItemStack();
|
||||
boolean correctStack = !stack.isEmpty() && stack.getItem() == Items.GLASS_BOTTLE;
|
||||
boolean ender = event.getWorld().provider instanceof WorldProviderEnd;
|
||||
|
||||
if(correctStack && ender) {
|
||||
if (event.getWorld().isRemote) {
|
||||
event.getEntityPlayer().swingArm(event.getHand());
|
||||
} else {
|
||||
ItemStack stack1 = new ItemStack(ModItems.enderAirBottle);
|
||||
|
||||
ItemHandlerHelper.giveItemToPlayer(event.getEntityPlayer(), stack1);
|
||||
|
||||
stack.shrink(1);
|
||||
|
||||
event.getWorld().playSound(null, event.getPos(), SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.5F, 1F);
|
||||
}
|
||||
|
||||
event.setCanceled(true);
|
||||
event.setCancellationResult(EnumActionResult.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float par8, float par9, float par10) {
|
||||
@@ -84,28 +57,6 @@ public class ItemManaResource extends ItemMod implements IFlowerComponent, IElve
|
||||
return super.onItemUse(player, world, pos, hand, side, par8, par9, par10);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if(this == ModItems.enderAirBottle) {
|
||||
if(!player.capabilities.isCreativeMode)
|
||||
stack.shrink(1);
|
||||
|
||||
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
if(!world.isRemote) {
|
||||
EntityEnderAirBottle b = new EntityEnderAirBottle(player, world);
|
||||
b.shoot(player, player.rotationPitch, player.rotationYaw, 0F, 1.5F, 1F);
|
||||
world.spawnEntity(b);
|
||||
}
|
||||
else player.swingArm(hand);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
|
||||
return ActionResult.newResult(EnumActionResult.PASS, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getParticleColor(ItemStack stack) {
|
||||
return 0x9b0000;
|
||||
|
||||
@@ -15,11 +15,9 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -28,7 +26,7 @@ import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.internal.IGuiLexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
@@ -84,10 +82,10 @@ public class PageShedding extends PageEntity {
|
||||
List<String> parsedTooltip = new ArrayList<>();
|
||||
boolean first = true;
|
||||
|
||||
for(String s : tooltipData) {
|
||||
String s_ = s;
|
||||
for(ITextComponent s : tooltipData) {
|
||||
String s_ = s.getFormattedText();
|
||||
if(!first)
|
||||
s_ = TextFormatting.GRAY + s;
|
||||
s_ = TextFormatting.GRAY + s.getFormattedText();
|
||||
parsedTooltip.add(s_);
|
||||
first = false;
|
||||
}
|
||||
@@ -102,20 +100,20 @@ public class PageShedding extends PageEntity {
|
||||
}
|
||||
else if(tooltipEntity) {
|
||||
List<String> parsedTooltip = new ArrayList<>();
|
||||
parsedTooltip.add(EntityList.getEntityString(dummyEntity));
|
||||
parsedTooltip.add(I18n.format(dummyEntity.getType().getTranslationKey()));
|
||||
vazkii.botania.client.core.helper.RenderHelper.renderTooltip(mx, my, parsedTooltip);
|
||||
}
|
||||
|
||||
tooltipStack = null;
|
||||
tooltipEntry = tooltipEntity = false;
|
||||
GlStateManager.disableBlend();
|
||||
mouseDownLastTick = Mouse.isButtonDown(0);
|
||||
mouseDownLastTick = GLFW.glfwGetMouseButton(Minecraft.getInstance().mainWindow.getHandle(), GLFW.GLFW_MOUSE_BUTTON_LEFT) == GLFW.GLFW_PRESS;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void renderItem(IGuiLexiconEntry gui, int xPos, int yPos, ItemStack stack) {
|
||||
ItemRenderer render = Minecraft.getInstance().getItemRenderer();
|
||||
boolean mouseDown = Mouse.isButtonDown(0);
|
||||
boolean mouseDown = GLFW.glfwGetMouseButton(Minecraft.getInstance().mainWindow.getHandle(), GLFW.GLFW_MOUSE_BUTTON_LEFT) == GLFW.GLFW_PRESS;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
|
||||
Reference in new issue
Block a user