mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Added out own textures for the spellbook and added a second variant
This commit is contained in:
parent
762636f9bd
commit
17aaeec7dc
4 changed files with 17 additions and 2 deletions
|
@ -25,12 +25,17 @@ import net.minecraft.world.World;
|
|||
public class EntitySpellbook extends EntityLiving implements IMagicals {
|
||||
|
||||
private static final DataParameter<Boolean> OPENED = EntityDataManager.createKey(EntitySpellbook.class, DataSerializers.BOOLEAN);
|
||||
private static final DataParameter<Boolean> ALTERED = EntityDataManager.createKey(EntitySpellbook.class, DataSerializers.BOOLEAN);
|
||||
private static final DataParameter<Byte> OPENED_USER = EntityDataManager.createKey(EntitySpellbook.class, DataSerializers.BYTE);
|
||||
|
||||
public EntitySpellbook(World worldIn) {
|
||||
super(worldIn);
|
||||
setSize(0.6f, 0.6f);
|
||||
enablePersistence();
|
||||
|
||||
if (world.rand.nextInt(3) == 0) {
|
||||
setAltered();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,6 +43,7 @@ public class EntitySpellbook extends EntityLiving implements IMagicals {
|
|||
super.entityInit();
|
||||
dataManager.register(OPENED, true);
|
||||
dataManager.register(OPENED_USER, (byte)1);
|
||||
dataManager.register(ALTERED, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,6 +61,14 @@ public class EntitySpellbook extends EntityLiving implements IMagicals {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean getIsAltered() {
|
||||
return dataManager.get(ALTERED);
|
||||
}
|
||||
|
||||
public void setAltered() {
|
||||
dataManager.set(ALTERED, true);
|
||||
}
|
||||
|
||||
public boolean getIsOpen() {
|
||||
return dataManager.get(OPENED);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,8 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
public class RenderSpellbook extends RenderLiving<EntitySpellbook> {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation("textures/entity/enchanting_table_book.png");
|
||||
private static final ResourceLocation BLUE = new ResourceLocation("unicopia", "textures/entity/enchanting_table_book_blue.png");
|
||||
private static final ResourceLocation NORMAL = new ResourceLocation("unicopia", "textures/entity/enchanting_table_book.png");
|
||||
|
||||
public RenderSpellbook(RenderManager rendermanagerIn) {
|
||||
super(rendermanagerIn, new ModelSpellbook(), 0);
|
||||
|
@ -19,7 +20,7 @@ public class RenderSpellbook extends RenderLiving<EntitySpellbook> {
|
|||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntitySpellbook entity) {
|
||||
return texture;
|
||||
return entity.getIsAltered() ? BLUE : NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1,015 B |
Binary file not shown.
After Width: | Height: | Size: 471 B |
Loading…
Reference in a new issue