我對此代碼有問題,它說「無法訪問的代碼」。
上面說的是Eclipse編輯器中的無法訪問的代碼
EntityLivingBase entity = (EntityLivingBase) theObject;
是無法訪問的代碼。
這裏是我的代碼:
@Override
public void onRender() {
if (!this.isToggled())
return;
for(Object theObject : mc.theWorld.loadedEntityList) {
if(!(theObject instanceof EntityLivingBase)) {
continue;
EntityLivingBase entity = (EntityLivingBase) theObject;
if(entity instanceof EntityPlayer) {
if(entity != mc.thePlayer)
player(entity);
continue;
}
if (entity instanceof EntityMob) {
mob(entity);
continue;
}
if (entity instanceof EntityAnimal) {
animal(entity);
continue;
}
passive(entity);
}
}
super.onRender();
}
我懷疑你可以刪除所有這些繼續語句,並且你的邏輯在最初的if語句中是錯誤的。 '!(EntityLivingBase的Object實例)'應該是'EntityLivingBase'的對象實例,然後你立即將它轉換爲它。不要稱之爲「theObject」。稱之爲比這更有意義的東西:) – ManoDestra
謝謝,你這爲我工作! 現在工作。 〜我沒有真正使用Java腳本,我還在學習。 謝謝! – LiamYS
@LiamYS請學習[tag:java]和[tag:javascript]之間的區別(除了相似的名稱和algol-like語法外,它們很**不同)。 –