mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 07:13:28 +01:00
More Fixes °~°
Continuing some other time.
This commit is contained in:
parent
51872bbc23
commit
8f959c92aa
27 changed files with 221 additions and 39 deletions
|
@ -19,14 +19,13 @@ import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockCoffeeMachine extends BlockContainerBase{
|
||||
|
@ -88,22 +87,21 @@ public class BlockCoffeeMachine extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){
|
||||
int meta = PosUtil.getMetadata(pos, world);
|
||||
float f = 0.0625F;
|
||||
|
||||
if(rotation == 0){
|
||||
PosUtil.setMetadata(pos, world, 0, 2);
|
||||
if(meta == 0){
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F, 1F, 1F-f*3F);
|
||||
}
|
||||
if(rotation == 1){
|
||||
PosUtil.setMetadata(pos, world, 3, 2);
|
||||
if(meta == 1){
|
||||
this.setBlockBounds(0F, 0F, 0F, 1F-f*3F, 1F, 1F);
|
||||
}
|
||||
if(rotation == 2){
|
||||
PosUtil.setMetadata(pos, world, 1, 2);
|
||||
if(meta == 2){
|
||||
this.setBlockBounds(0F, 0F, f*3F, 1F, 1F, 1F);
|
||||
}
|
||||
if(rotation == 3){
|
||||
PosUtil.setMetadata(pos, world, 2, 2);
|
||||
if(meta == 3){
|
||||
this.setBlockBounds(f*3F, 0F, 0F, 1F, 1F, 1F);
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,8 +78,10 @@ public class BlockColoredLamp extends BlockBase{
|
|||
return true;
|
||||
}
|
||||
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if(stack != null){
|
||||
//Changing Colors
|
||||
int[] oreIDs = OreDictionary.getOreIDs(player.getCurrentEquippedItem());
|
||||
int[] oreIDs = OreDictionary.getOreIDs(stack);
|
||||
if(oreIDs.length > 0){
|
||||
for(int oreID : oreIDs){
|
||||
String name = OreDictionary.getOreName(oreID);
|
||||
|
@ -97,6 +99,7 @@ public class BlockColoredLamp extends BlockBase{
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -206,7 +206,8 @@ public class BookletUtils{
|
|||
currentEntry.chapters.clear();
|
||||
|
||||
for(IBookletChapter chapter : currentEntry.allChapters){
|
||||
if(chapter.getLocalizedName().toLowerCase(Locale.ROOT).contains(booklet.searchField.getText().toLowerCase(Locale.ROOT))){
|
||||
String searchFieldText = booklet.searchField.getText().toLowerCase(Locale.ROOT);
|
||||
if(chapter.getLocalizedName().toLowerCase(Locale.ROOT).contains(searchFieldText) || getChapterStacksContainString(searchFieldText, chapter)){
|
||||
currentEntry.chapters.add(chapter);
|
||||
}
|
||||
}
|
||||
|
@ -218,6 +219,20 @@ public class BookletUtils{
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean getChapterStacksContainString(String text, IBookletChapter chapter){
|
||||
for(BookletPage page : chapter.getPages()){
|
||||
ItemStack[] pageStacks = page.getItemStacksForPage();
|
||||
if(pageStacks != null){
|
||||
for(ItemStack stack : pageStacks){
|
||||
if(stack.getDisplayName().toLowerCase(Locale.ROOT).contains(text)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void openIndexEntry(GuiBooklet booklet, IBookletEntry entry, int page, boolean resetTextField){
|
||||
booklet.searchField.setVisible(entry instanceof BookletEntryAllSearch);
|
||||
|
|
|
@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.booklet.entry;
|
|||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
@ -44,10 +43,6 @@ public class BookletEntry implements IBookletEntry{
|
|||
return this.chapters;
|
||||
}
|
||||
|
||||
public void addChapter(BookletChapter chapter){
|
||||
this.chapters.add(chapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedNameWithFormatting(){
|
||||
return this.color+this.getLocalizedName();
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
package de.ellpeck.actuallyadditions.mod.booklet.entry;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -26,7 +25,7 @@ public class BookletEntryAllSearch extends BookletEntry{
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void addChapter(BookletChapter chapter){
|
||||
public void addChapter(IBookletChapter chapter){
|
||||
this.allChapters.add(chapter);
|
||||
this.chapters = (ArrayList<IBookletChapter>)this.allChapters.clone();
|
||||
}
|
||||
|
@ -34,5 +33,6 @@ public class BookletEntryAllSearch extends BookletEntry{
|
|||
@Override
|
||||
public void setChapters(List<IBookletChapter> chapters){
|
||||
this.allChapters = (ArrayList<IBookletChapter>)chapters;
|
||||
this.chapters = (ArrayList<IBookletChapter>)this.allChapters.clone();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,6 +118,7 @@ public class CreativeTab extends CreativeTabs{
|
|||
add(InitBlocks.blockPillarQuartzSlab);
|
||||
|
||||
add(InitBlocks.blockColoredLamp);
|
||||
add(InitBlocks.blockColoredLampOn);
|
||||
add(InitBlocks.blockLampPowerer);
|
||||
add(InitBlocks.blockTreasureChest);
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
|
|||
drops.addAll(blockToBreak.getDrops(worldObj, coordsBlock, worldObj.getBlockState(coordsBlock), 0));
|
||||
|
||||
if(WorldUtil.addToInventory(this, drops, false, true)){
|
||||
worldObj.playAuxSFX(2001, this.getPos(), Block.getIdFromBlock(blockToBreak)+(meta << 12));
|
||||
worldObj.playAuxSFX(2001, coordsBlock, Block.getIdFromBlock(blockToBreak)+(meta << 12));
|
||||
WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, this.getPos(), i);
|
||||
WorldUtil.addToInventory(this, drops, true, true);
|
||||
this.storage.extractEnergy(ENERGY_USE, false);
|
||||
|
|
|
@ -46,7 +46,7 @@ public class WorldUtil{
|
|||
public static void breakBlockAtSide(EnumFacing side, World world, BlockPos pos, int offset){
|
||||
BlockPos c = getCoordsFromSide(side, pos, offset);
|
||||
if(c != null){
|
||||
world.setBlockToAir(pos);
|
||||
world.setBlockToAir(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampGray",
|
||||
"parent": "actuallyadditions:block/blockColoredLampLightGray",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampBlackOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampBlueOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampBrownOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampCyanOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampGrayOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampGreenOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampLightBlueOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampLightGrayOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampLimeOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampMagentaOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampOrangeOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampPinkOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampPurpleOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampRedOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampWhiteOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampYellowOn",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampRed",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "actuallyadditions:block/blockColoredLampWhite-",
|
||||
"parent": "actuallyadditions:block/blockColoredLampWhite",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
|
|
Loading…
Reference in a new issue