-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Clayconia Alluvia for getting clay before iron+gold
- Loading branch information
1 parent
3448d63
commit 3cdb3ff
Showing
6 changed files
with
151 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
src/main/java/com/gmail/pharaun/gregtania/botania/SubTileClayconiaAlluvia.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
package com.gmail.pharaun.gregtania.botania; | ||
/** | ||
* This class was created by <Vazkii>. It's distributed as | ||
* part of the Botania Mod. Get the Source Code in github: | ||
* https://github.com/Vazkii/Botania | ||
* | ||
* Botania is Open Source and distributed under the | ||
* Botania License: http://botaniamod.net/license.php | ||
* | ||
* File Created @ [May 17, 2014, 12:05:37 AM (GMT)] | ||
*/ | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.entity.item.EntityItem; | ||
import net.minecraft.init.Items; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.ChunkCoordinates; | ||
import vazkii.botania.api.lexicon.LexiconEntry; | ||
import vazkii.botania.api.subtile.RadiusDescriptor; | ||
import vazkii.botania.api.subtile.SubTileFunctional; | ||
import vazkii.botania.common.core.handler.ConfigHandler; | ||
import vazkii.botania.common.lexicon.LexiconData; | ||
|
||
public class SubTileClayconiaAlluvia extends SubTileFunctional { | ||
|
||
private static final int COST = 240; | ||
private static final int RANGE = 5; | ||
private static final int RANGE_Y = 3; | ||
|
||
private static final int RANGE_MINI = 2; | ||
private static final int RANGE_Y_MINI = 1; | ||
|
||
public static LexiconEntry lexiconEntry; | ||
|
||
@Override | ||
public void onUpdate() { | ||
super.onUpdate(); | ||
|
||
if(!supertile.getWorldObj().isRemote && ticksExisted % 5 == 0) { | ||
if(mana >= COST) { | ||
ChunkCoordinates coords = getCoordsToPut(); | ||
if(coords != null) { | ||
supertile.getWorldObj().setBlockToAir(coords.posX, coords.posY, coords.posZ); | ||
if(ConfigHandler.blockBreakParticles) | ||
supertile.getWorldObj().playAuxSFX(2001, coords.posX, coords.posY, coords.posZ, Block.getIdFromBlock(Block.getBlockFromName("sand"))); | ||
EntityItem item = new EntityItem(supertile.getWorldObj(), coords.posX + 0.5, coords.posY + 0.5, coords.posZ + 0.5, new ItemStack(Items.clay_ball)); | ||
supertile.getWorldObj().spawnEntityInWorld(item); | ||
mana -= COST; | ||
} | ||
} | ||
} | ||
} | ||
|
||
public ChunkCoordinates getCoordsToPut() { | ||
List<ChunkCoordinates> possibleCoords = new ArrayList(); | ||
|
||
int range = getRange(); | ||
int rangeY = getRangeY(); | ||
|
||
for(int i = -range; i < range + 1; i++) | ||
for(int j = -rangeY; j < rangeY + 1; j++) | ||
for(int k = -range; k < range + 1; k++) { | ||
int x = supertile.xCoord + i; | ||
int y = supertile.yCoord + j; | ||
int z = supertile.zCoord + k; | ||
Block block = supertile.getWorldObj().getBlock(x, y, z); | ||
if(block == Block.getBlockFromName("gravel")) | ||
possibleCoords.add(new ChunkCoordinates(x, y, z)); | ||
} | ||
|
||
if(possibleCoords.isEmpty()) | ||
return null; | ||
return possibleCoords.get(supertile.getWorldObj().rand.nextInt(possibleCoords.size())); | ||
} | ||
|
||
@Override | ||
public RadiusDescriptor getRadius() { | ||
return new RadiusDescriptor.Square(toChunkCoordinates(), getRange()); | ||
} | ||
|
||
public int getRange() { | ||
return RANGE; | ||
} | ||
|
||
public int getRangeY() { | ||
return RANGE_Y; | ||
} | ||
|
||
@Override | ||
public int getColor() { | ||
return 0x7B8792; | ||
} | ||
|
||
@Override | ||
public int getMaxMana() { | ||
return 1920; | ||
} | ||
|
||
@Override | ||
public LexiconEntry getEntry() { | ||
return lexiconEntry; | ||
} | ||
|
||
public static class Mini extends SubTileClayconiaAlluvia { | ||
@Override public int getRange() { return RANGE_MINI; } | ||
@Override public int getRangeY() { return RANGE_Y_MINI; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+1.29 KB
src/main/resources/assets/gregtania/textures/blocks/clayconiaAlluvia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.