Targeted portals (WIP, bugged)

This commit is contained in:
Aleksey 2021-03-07 15:06:12 +03:00
parent 3446848287
commit 83fd4603ac
8 changed files with 102 additions and 92 deletions

View file

@ -15,7 +15,7 @@ public class EternalPedestalEntity extends PedestalBlockEntity {
}
public boolean hasRitual() {
return this.linkedRitual != null;
return linkedRitual != null;
}
public void linkRitual(EternalRitual ritual) {
@ -23,14 +23,14 @@ public class EternalPedestalEntity extends PedestalBlockEntity {
}
public EternalRitual getRitual() {
return this.linkedRitual;
return linkedRitual;
}
@Override
public void setLocation(World world, BlockPos pos) {
super.setLocation(world, pos);
if (hasRitual()) {
this.linkedRitual.setWorld(world);
linkedRitual.setWorld(world);
}
}
@ -38,14 +38,14 @@ public class EternalPedestalEntity extends PedestalBlockEntity {
public void fromTag(BlockState state, CompoundTag tag) {
super.fromTag(state, tag);
if (tag.contains("ritual")) {
this.linkedRitual = new EternalRitual(world);
this.linkedRitual.fromTag(tag.getCompound("ritual"));
linkedRitual = new EternalRitual(world);
linkedRitual.fromTag(tag.getCompound("ritual"));
}
}
@Override
public CompoundTag toTag(CompoundTag tag) {
if (this.hasRitual()) {
if (hasRitual()) {
tag.put("ritual", linkedRitual.toTag(new CompoundTag()));
}
return super.toTag(tag);

View file

@ -19,26 +19,26 @@ public class InfusionPedestalEntity extends PedestalBlockEntity {
public void setLocation(World world, BlockPos pos) {
super.setLocation(world, pos);
if (hasRitual()) {
this.linkedRitual.setLocation(world, pos);
linkedRitual.setLocation(world, pos);
}
}
public void linkRitual(InfusionRitual ritual) {
this.linkedRitual = ritual;
linkedRitual = ritual;
}
public InfusionRitual getRitual() {
return this.linkedRitual;
return linkedRitual;
}
public boolean hasRitual() {
return this.linkedRitual != null;
return linkedRitual != null;
}
@Override
public void tick() {
if (hasRitual()) {
this.linkedRitual.tick();
linkedRitual.tick();
}
super.tick();
}
@ -52,8 +52,8 @@ public class InfusionPedestalEntity extends PedestalBlockEntity {
public void fromTag(BlockState state, CompoundTag tag) {
super.fromTag(state, tag);
if (tag.contains("ritual")) {
this.linkedRitual = new InfusionRitual(world, pos);
this.linkedRitual.fromTag(tag.getCompound("ritual"));
linkedRitual = new InfusionRitual(world, pos);
linkedRitual.fromTag(tag.getCompound("ritual"));
}
}